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
...
amazon-web-services amazon-ec2 aws-cli
add a comment |
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
...
amazon-web-services amazon-ec2 aws-cli
add a comment |
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
...
amazon-web-services amazon-ec2 aws-cli
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
amazon-web-services amazon-ec2 aws-cli
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
add a comment |
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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
add a comment |
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
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
edited Nov 13 at 18:01
answered Nov 13 at 17:55
pvi
113
113
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Apr 4 at 19:42
siesta
76821021
76821021
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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