I've recently begun using the aws
gem in a Sinatra web application whose purpose is to provide a customized frontend to instance management (integrating non-AWS tools). I am currently working on the form to allow a user to set all the options that might need setting, and one of those options is instance type (m1.small, c1.medium, etc).
What I'd like is to be able to reach out to some source to pull a list of available types. I have looked through the AWS::EC2 documentation and haven't found anything matching this description. I've got no need to insist that a solution be part of the aws
gem, but even better if it is, because that's the tool I'm already using.
Do you know of a way to gather this information programmatically?
As far as I can tell this isn't possible. If it were possible, amazon would list the api call in their documentation.
I find the omission a little odd considering the've got apis to list pretty much anything else.
You could maybe kludge it via the DescribeReservedInstancesOfferings
call, which lists all the kinds of reserved instances you can buy - I would have thought that extracting the unique instance-types from that would be a reasonable approximation (as far as I know there are no instance types you can't get reserved instances for). Doesn't look like the aws
gem supports it though. The official amazon sdk does, as does fog
Here's a somewhat kludgy work-around to the fact that Amazon's still not released an API to enumerate instance types:
instance_types = Set.new()
response = {:next_token => ''}
loop do
response = ec2.client.describe_spot_price_history(
:start_time => (Time.now() - 86400).iso8601,
:end_time => Time.now().iso8601,
:product_descriptions => ['Linux/UNIX'],
:availability_zone => 'us-east-1c',
:next_token => response[:next_token]
)
response[:spot_price_history_set].each do |history_set|
instance_types.add(history_set[:instance_type])
end
if(response[:next_token].nil?)
break
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With