tubu13
tubu13

Reputation: 934

AWS sdk ruby - get instance type specs

Is it possible to get the machine specs from the instance type?

get_spec("t1.small") => {CPU:64, RAM:8 ....HVM:true} 

is there such kind of method?

Upvotes: 0

Views: 828

Answers (2)

Trevor Rowe
Trevor Rowe

Reputation: 6528

The Amazon EC2 API does not expose these stats programmatically. For quick reference I tend to use: http://www.ec2instances.info/

They have a static JSON file you can fetch programmatically: http://www.ec2instances.info/instances.json

Upvotes: 2

BMW
BMW

Reputation: 45223

No, there is no this type of machine specs you can get directly from aws ruby SDK.

But you can develop this function by yourself to refer the url Amazon EC2 Instances types. Build an input yaml file with full informations, and search key word t1.small .

instance:
   t2.small:
       cpu: 1
       mem: 2
   t2.micro:
       cpu: 1
       mem: 1

with the ruby code, you can use the gem of yaml

$ irb
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> config=YAML::load_file('instances.yaml')
=> {"instance"=>{"t2.small"=>{"cpu"=>1, "mem"=>2}, "t2.micro"=>{"cpu"=>1, "mem"=>1}}}
irb(main):003:0> config['instance']['t2.small']
=> {"cpu"=>1, "mem"=>2}

Upvotes: 0

Related Questions