List all EC2 instance types in a region or AZ











up vote
3
down vote

favorite












While there appear to be a few ways to output and filter some AWSCLI commands into this list, does someone have a nice+easy way to list all EC2 instance types for a specific region?



Or perhaps that list is published in a .json file up in a bucket someplace, maintained by AWS?



I'm simply looking for this sort of output:



t1.micro
t2.nano
t2.micro
t2.small
...









share|improve this question




























    up vote
    3
    down vote

    favorite












    While there appear to be a few ways to output and filter some AWSCLI commands into this list, does someone have a nice+easy way to list all EC2 instance types for a specific region?



    Or perhaps that list is published in a .json file up in a bucket someplace, maintained by AWS?



    I'm simply looking for this sort of output:



    t1.micro
    t2.nano
    t2.micro
    t2.small
    ...









    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      While there appear to be a few ways to output and filter some AWSCLI commands into this list, does someone have a nice+easy way to list all EC2 instance types for a specific region?



      Or perhaps that list is published in a .json file up in a bucket someplace, maintained by AWS?



      I'm simply looking for this sort of output:



      t1.micro
      t2.nano
      t2.micro
      t2.small
      ...









      share|improve this question















      While there appear to be a few ways to output and filter some AWSCLI commands into this list, does someone have a nice+easy way to list all EC2 instance types for a specific region?



      Or perhaps that list is published in a .json file up in a bucket someplace, maintained by AWS?



      I'm simply looking for this sort of output:



      t1.micro
      t2.nano
      t2.micro
      t2.small
      ...






      amazon-web-services amazon-ec2 aws-cli






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 25 '17 at 1:06









      John Rotenstein

      65.5k771115




      65.5k771115










      asked Jul 24 '17 at 14:21









      Neal Magee

      1,2021427




      1,2021427
























          4 Answers
          4






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Well it seems that at least one programmatic way to do this is to query the AWS Pricing API:



          #!/bin/bash

          curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products.attributes["instanceType"]' | sort -u | grep '.'


          A gist for this is here, in case of future tweaks:
          https://gist.github.com/nmagee/b096e6fadf9ac336da7ffdada43f656a



          What this is lacking is grouping/specifying by AWS Region, which can be an important distinction -- not every region has all instance type offerings.






          share|improve this answer

















          • 1




            You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
            – John Rotenstein
            Jul 25 '17 at 1:06






          • 1




            I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
            – siesta
            Apr 4 at 19:47




















          up vote
          1
          down vote













          As Far As I Know, such list is not available and cannot be queried from aws cli.



          Even when running the aws ec2 run-instances, the instance-type parameter lists available instance types and refers to aws docs



          Others have parsed the data and made it available.






          share|improve this answer





















          • Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
            – Neal Magee
            Jul 24 '17 at 16:09




















          up vote
          1
          down vote













          This is the command you can use to get all instance types in your one region of your account:



          $ aws ec2 describe-instances --region us-east-1 --filters "Name=instance- type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text


          To sort and count:



          $ | sort | uniq -c | sort -nr


          Iterate over all regions and print to stdout:



          $for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do echo $region && aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr; done


          With output redirection to file /tmp/instances:



          $ for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*" --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr >> /tmp/instances; done


          Sample Output(regions that have no instances will just be printed):



          ap-south-1
          eu-west-3
          eu-west-2
          1 m4.large
          eu-west-1
          ap-northeast-2
          1 m4.large
          ap-northeast-1
          1 m4.large
          sa-east-1
          ca-central-1
          1 m4.large
          ap-southeast-1
          ap-southeast-2
          eu-central-1
          1 m4.large
          us-east-1





          share|improve this answer






























            up vote
            0
            down vote













            As others have pointed out, this is not something you can just get out of an AWS API endpoint.



            So to fill this gap, I've built a general module for dealing with this issue.



            I hope this helps for a variety of use cases:
            https://gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45283036%2flist-all-ec2-instance-types-in-a-region-or-az%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote



              accepted










              Well it seems that at least one programmatic way to do this is to query the AWS Pricing API:



              #!/bin/bash

              curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products.attributes["instanceType"]' | sort -u | grep '.'


              A gist for this is here, in case of future tweaks:
              https://gist.github.com/nmagee/b096e6fadf9ac336da7ffdada43f656a



              What this is lacking is grouping/specifying by AWS Region, which can be an important distinction -- not every region has all instance type offerings.






              share|improve this answer

















              • 1




                You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
                – John Rotenstein
                Jul 25 '17 at 1:06






              • 1




                I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
                – siesta
                Apr 4 at 19:47

















              up vote
              3
              down vote



              accepted










              Well it seems that at least one programmatic way to do this is to query the AWS Pricing API:



              #!/bin/bash

              curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products.attributes["instanceType"]' | sort -u | grep '.'


              A gist for this is here, in case of future tweaks:
              https://gist.github.com/nmagee/b096e6fadf9ac336da7ffdada43f656a



              What this is lacking is grouping/specifying by AWS Region, which can be an important distinction -- not every region has all instance type offerings.






              share|improve this answer

















              • 1




                You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
                – John Rotenstein
                Jul 25 '17 at 1:06






              • 1




                I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
                – siesta
                Apr 4 at 19:47















              up vote
              3
              down vote



              accepted







              up vote
              3
              down vote



              accepted






              Well it seems that at least one programmatic way to do this is to query the AWS Pricing API:



              #!/bin/bash

              curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products.attributes["instanceType"]' | sort -u | grep '.'


              A gist for this is here, in case of future tweaks:
              https://gist.github.com/nmagee/b096e6fadf9ac336da7ffdada43f656a



              What this is lacking is grouping/specifying by AWS Region, which can be an important distinction -- not every region has all instance type offerings.






              share|improve this answer












              Well it seems that at least one programmatic way to do this is to query the AWS Pricing API:



              #!/bin/bash

              curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products.attributes["instanceType"]' | sort -u | grep '.'


              A gist for this is here, in case of future tweaks:
              https://gist.github.com/nmagee/b096e6fadf9ac336da7ffdada43f656a



              What this is lacking is grouping/specifying by AWS Region, which can be an important distinction -- not every region has all instance type offerings.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 24 '17 at 17:08









              Neal Magee

              1,2021427




              1,2021427








              • 1




                You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
                – John Rotenstein
                Jul 25 '17 at 1:06






              • 1




                I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
                – siesta
                Apr 4 at 19:47
















              • 1




                You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
                – John Rotenstein
                Jul 25 '17 at 1:06






              • 1




                I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
                – siesta
                Apr 4 at 19:47










              1




              1




              You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
              – John Rotenstein
              Jul 25 '17 at 1:06




              You can obtain Regional price lists that might show instance types. However, it will not go down to the AZ level. When Regions add new AZs, the new AZs often do not support older-generation instance types.
              – John Rotenstein
              Jul 25 '17 at 1:06




              1




              1




              I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
              – siesta
              Apr 4 at 19:47






              I've created a more comprehensive solution that accounts for all current instance type offerings in all possible AZs. gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b
              – siesta
              Apr 4 at 19:47














              up vote
              1
              down vote













              As Far As I Know, such list is not available and cannot be queried from aws cli.



              Even when running the aws ec2 run-instances, the instance-type parameter lists available instance types and refers to aws docs



              Others have parsed the data and made it available.






              share|improve this answer





















              • Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
                – Neal Magee
                Jul 24 '17 at 16:09

















              up vote
              1
              down vote













              As Far As I Know, such list is not available and cannot be queried from aws cli.



              Even when running the aws ec2 run-instances, the instance-type parameter lists available instance types and refers to aws docs



              Others have parsed the data and made it available.






              share|improve this answer





















              • Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
                – Neal Magee
                Jul 24 '17 at 16:09















              up vote
              1
              down vote










              up vote
              1
              down vote









              As Far As I Know, such list is not available and cannot be queried from aws cli.



              Even when running the aws ec2 run-instances, the instance-type parameter lists available instance types and refers to aws docs



              Others have parsed the data and made it available.






              share|improve this answer












              As Far As I Know, such list is not available and cannot be queried from aws cli.



              Even when running the aws ec2 run-instances, the instance-type parameter lists available instance types and refers to aws docs



              Others have parsed the data and made it available.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 24 '17 at 15:41









              Frédéric Henri

              32.8k55283




              32.8k55283












              • Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
                – Neal Magee
                Jul 24 '17 at 16:09




















              • Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
                – Neal Magee
                Jul 24 '17 at 16:09


















              Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
              – Neal Magee
              Jul 24 '17 at 16:09






              Thanks Frédéric. I have always liked that ec2instances.info page, and they note at the bottom that they are scraping this off of AWS web pages. Seems like something you should be able to grab in code though?
              – Neal Magee
              Jul 24 '17 at 16:09












              up vote
              1
              down vote













              This is the command you can use to get all instance types in your one region of your account:



              $ aws ec2 describe-instances --region us-east-1 --filters "Name=instance- type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text


              To sort and count:



              $ | sort | uniq -c | sort -nr


              Iterate over all regions and print to stdout:



              $for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do echo $region && aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr; done


              With output redirection to file /tmp/instances:



              $ for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*" --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr >> /tmp/instances; done


              Sample Output(regions that have no instances will just be printed):



              ap-south-1
              eu-west-3
              eu-west-2
              1 m4.large
              eu-west-1
              ap-northeast-2
              1 m4.large
              ap-northeast-1
              1 m4.large
              sa-east-1
              ca-central-1
              1 m4.large
              ap-southeast-1
              ap-southeast-2
              eu-central-1
              1 m4.large
              us-east-1





              share|improve this answer



























                up vote
                1
                down vote













                This is the command you can use to get all instance types in your one region of your account:



                $ aws ec2 describe-instances --region us-east-1 --filters "Name=instance- type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text


                To sort and count:



                $ | sort | uniq -c | sort -nr


                Iterate over all regions and print to stdout:



                $for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do echo $region && aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr; done


                With output redirection to file /tmp/instances:



                $ for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*" --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr >> /tmp/instances; done


                Sample Output(regions that have no instances will just be printed):



                ap-south-1
                eu-west-3
                eu-west-2
                1 m4.large
                eu-west-1
                ap-northeast-2
                1 m4.large
                ap-northeast-1
                1 m4.large
                sa-east-1
                ca-central-1
                1 m4.large
                ap-southeast-1
                ap-southeast-2
                eu-central-1
                1 m4.large
                us-east-1





                share|improve this answer

























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  This is the command you can use to get all instance types in your one region of your account:



                  $ aws ec2 describe-instances --region us-east-1 --filters "Name=instance- type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text


                  To sort and count:



                  $ | sort | uniq -c | sort -nr


                  Iterate over all regions and print to stdout:



                  $for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do echo $region && aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr; done


                  With output redirection to file /tmp/instances:



                  $ for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*" --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr >> /tmp/instances; done


                  Sample Output(regions that have no instances will just be printed):



                  ap-south-1
                  eu-west-3
                  eu-west-2
                  1 m4.large
                  eu-west-1
                  ap-northeast-2
                  1 m4.large
                  ap-northeast-1
                  1 m4.large
                  sa-east-1
                  ca-central-1
                  1 m4.large
                  ap-southeast-1
                  ap-southeast-2
                  eu-central-1
                  1 m4.large
                  us-east-1





                  share|improve this answer














                  This is the command you can use to get all instance types in your one region of your account:



                  $ aws ec2 describe-instances --region us-east-1 --filters "Name=instance- type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text


                  To sort and count:



                  $ | sort | uniq -c | sort -nr


                  Iterate over all regions and print to stdout:



                  $for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do echo $region && aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*"  --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr; done


                  With output redirection to file /tmp/instances:



                  $ for region in $(aws ec2 describe-regions --query 'Regions.{Name:RegionName}' --output text); do aws ec2 describe-instances --region $region --filters "Name=instance-type,Values=*" --query "Reservations[*].Instances[*].InstanceType" --output text | sort | uniq -c | sort -nr >> /tmp/instances; done


                  Sample Output(regions that have no instances will just be printed):



                  ap-south-1
                  eu-west-3
                  eu-west-2
                  1 m4.large
                  eu-west-1
                  ap-northeast-2
                  1 m4.large
                  ap-northeast-1
                  1 m4.large
                  sa-east-1
                  ca-central-1
                  1 m4.large
                  ap-southeast-1
                  ap-southeast-2
                  eu-central-1
                  1 m4.large
                  us-east-1






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 13 at 18:01

























                  answered Nov 13 at 17:55









                  pvi

                  113




                  113






















                      up vote
                      0
                      down vote













                      As others have pointed out, this is not something you can just get out of an AWS API endpoint.



                      So to fill this gap, I've built a general module for dealing with this issue.



                      I hope this helps for a variety of use cases:
                      https://gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b






                      share|improve this answer

























                        up vote
                        0
                        down vote













                        As others have pointed out, this is not something you can just get out of an AWS API endpoint.



                        So to fill this gap, I've built a general module for dealing with this issue.



                        I hope this helps for a variety of use cases:
                        https://gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b






                        share|improve this answer























                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          As others have pointed out, this is not something you can just get out of an AWS API endpoint.



                          So to fill this gap, I've built a general module for dealing with this issue.



                          I hope this helps for a variety of use cases:
                          https://gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b






                          share|improve this answer












                          As others have pointed out, this is not something you can just get out of an AWS API endpoint.



                          So to fill this gap, I've built a general module for dealing with this issue.



                          I hope this helps for a variety of use cases:
                          https://gist.github.com/mrsiesta/0e4fac21c0eb0e8977e1de7b5277e63b







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Apr 4 at 19:42









                          siesta

                          76821021




                          76821021






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45283036%2flist-all-ec2-instance-types-in-a-region-or-az%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to change which sound is reproduced for terminal bell?

                              Can I use Tabulator js library in my java Spring + Thymeleaf project?

                              Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents