amazon-web-servicesamazon-ec2ec2-api-tools

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.


Solution

  • 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,