Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query EC2 instance type attributes

Is there a way to get the number of cores and amount of memory of an instance type from the command line aws tool?

Basically I want to access the data on http://aws.amazon.com/ec2/instance-types/ programmatically.

like image 580
Daniel Darabos Avatar asked Sep 24 '26 18:09

Daniel Darabos


1 Answers

Not officially. But the incredible Mitch Garnaat has a Github repository with "missingcloud" bits. On that list is instance information. You can pick that out with your favorite language. Here's an example with a bit of jq. (this is imperfect, maybe someone can help split these into instance:ramMB rows?)

$ curl --silent https://raw.githubusercontent.com/garnaat/missingcloud/master/aws.json | jq '[.services."Elastic Compute Cloud".instance_types|to_entries|.[]|.key,.value.ramMB]' | head -9
[
  "c1.medium",
  1700,
  "c1.xlarge",
  7000,
  "c3.2xlarge",
  15000,
  "c3.4xlarge",
  30000,
like image 92
tedder42 Avatar answered Sep 26 '26 08:09

tedder42



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!