Class: Awscli::EC2::Spot

Inherits:
Object
  • Object
show all
Defined in:
lib/awscli/ec2.rb

Overview

> ReservedInstances

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Spot

Returns a new instance of Spot.



690
691
692
# File 'lib/awscli/ec2.rb', line 690

def initialize(connection)
  @conn = connection
end

Instance Method Details

#cancel_spot_instance_requests(sid) ⇒ Object



735
736
737
738
739
740
# File 'lib/awscli/ec2.rb', line 735

def cancel_spot_instance_requests(sid)
  sr = @conn.spot_requests.get(sid)
  abort "Cannot find spot request with id: #{sid}" unless sr
  sr.destroy
  puts "Deleted spot request: #{sid}"
end

#create_spot_datafeed_subsription(bucket, prefix) ⇒ Object



722
723
724
# File 'lib/awscli/ec2.rb', line 722

def create_spot_datafeed_subsription(bucket, prefix)
  @conn.create_spot_datafeed_subscription(bucket, prefix)
end

#delete_spot_datafeed_subsriptionObject



726
727
728
# File 'lib/awscli/ec2.rb', line 726

def delete_spot_datafeed_subsription
  @conn.delete_spot_datafeed_subscription
end

#describe_spot_datafeed_subscriptionObject



698
699
700
# File 'lib/awscli/ec2.rb', line 698

def describe_spot_datafeed_subscription
  @conn.describe_spot_datafeed_subscription
end

#describe_spot_price_history(filters) ⇒ Object



702
703
704
705
706
707
708
709
710
# File 'lib/awscli/ec2.rb', line 702

def describe_spot_price_history(filters)
  puts filters
  response =  if filters.nil?
                @conn.describe_spot_price_history.body['spotPriceHistorySet']
              else
                @conn.describe_spot_price_history(filters).body['spotPriceHistorySet']
              end
  Formatador.display_table(response)
end

#describe_spot_requestsObject



694
695
696
# File 'lib/awscli/ec2.rb', line 694

def describe_spot_requests
  @conn.spot_requests.table
end

#list_filtersObject



712
713
714
715
716
717
718
719
720
# File 'lib/awscli/ec2.rb', line 712

def list_filters
  filters = [
    {:filter_name => "instance-type", :desc => "Type of instance"},
    {:filter_name => "product-description", :desc => "Product description for the Spot Price"},
    {:filter_name => "spot-price", :desc => "Spot Price. The value must match exactly (or use wildcards; greater than or less than comparison is not supported)"},
    {:filter_name => "timestamp", :desc => "Timestamp of the Spot Price history, e.g., 2010-08-16T05:06:11.000Z. You can use wildcards (* and ?)"},
  ]
  Formatador.display_table(filters, [:filter_name, :desc])
end

#request_spot_instances(options) ⇒ Object



730
731
732
733
# File 'lib/awscli/ec2.rb', line 730

def request_spot_instances(options)
  sr = @conn.spot_requests.create(options)
  puts "Created spot request: #{sr.id}"
end