列出区域或可用区中的所有EC2实例类型 [英] List all EC2 instance types in a region or AZ

查看:94
本文介绍了列出区域或可用区中的所有EC2实例类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然似乎有一些方法可以输出一些AWSCLI命令并将其过滤到此列表中,但是有人可以通过一种便捷的方法列出特定区域的所有EC2实例类型吗?

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?

还是该列表以.json文件的形式发布在某个位置,由AWS维护在某个存储桶中?

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
...


推荐答案

看来至少一种编程方式可以查询AWS Pricing API:

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 '\.'

这是要点,以备日后调整:
https://gist.github.com/nmagee/b096e6fadf9ac336da7ffdada43f656a

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

缺少的是按AWS区域分组/指定,这可能是一个重要的区别-并非每个区域都提供所有实例类型的产品。

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

这篇关于列出区域或可用区中的所有EC2实例类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆