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.



668
669
670
# File 'lib/awscli/ec2.rb', line 668

def initialize(connection)
  @conn = connection
end

Instance Method Details

#cancel_spot_instance_requests(sid) ⇒ Object



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

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



700
701
702
# File 'lib/awscli/ec2.rb', line 700

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

#delete_spot_datafeed_subsriptionObject



704
705
706
# File 'lib/awscli/ec2.rb', line 704

def delete_spot_datafeed_subsription
  @conn.delete_spot_datafeed_subscription
end

#describe_spot_datafeed_subscriptionObject



676
677
678
# File 'lib/awscli/ec2.rb', line 676

def describe_spot_datafeed_subscription
  @conn.describe_spot_datafeed_subscription
end

#describe_spot_price_history(filters) ⇒ Object



680
681
682
683
684
685
686
687
688
# File 'lib/awscli/ec2.rb', line 680

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



672
673
674
# File 'lib/awscli/ec2.rb', line 672

def describe_spot_requests
  @conn.spot_requests.table
end

#list_filtersObject



690
691
692
693
694
695
696
697
698
# File 'lib/awscli/ec2.rb', line 690

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



708
709
710
711
# File 'lib/awscli/ec2.rb', line 708

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