Class: InstanceSelector::Providers::AWS
- Inherits:
-
AbstractProvider
- Object
- AbstractProvider
- InstanceSelector::Providers::AWS
- Defined in:
- lib/instance_selector/providers/aws.rb
Overview
AWS Provider
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ AWS
constructor
A new instance of AWS.
- #instances(args = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ AWS
Returns a new instance of AWS.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/instance_selector/providers/aws.rb', line 5 def initialize( = {}) @fog = .delete(:fog_client) unless @fog @options = { region: 'us-east-1' }.merge() connect end end |
Instance Method Details
#instances(args = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/instance_selector/providers/aws.rb', line 17 def instances(args = {}) expect_count = args.delete(:expect_count) filters = args_to_filters(args) instances = on_demand_instances(filters).merge(spot_instances(filters)) if expect_count && expect_count != instances.size raise UnexpectedInstanceCount, "Expected #{expect_count}, got #{instances.size}" end instances end |