有人可以告诉我是否以编程方式存在,或者从命令行(例如使用awscli)获取所有信息,这些信息显示在“EC2服务限制”页面上?
我使用过这个命令:ec2 describe-account-attributes ,但它只提供一般信息,但我需要知道以下信息:
运行按需c1.medium实例,
运行按需c1.xlarge实例
等
答案 0 :(得分:1)
我能找到的最近的是:
aws support describe-trusted-advisor-check-result \
--check-id eW7HH0l7J9 \
--query 'result.sort_by(flaggedResources[?status!="ok"],&metadata[2])[?starts_with(metadata[2],`On-Demand`)].metadata' \
--output table \
--region us-east-1
但这似乎只返回非默认限制。我的输出如下:
---------------------------------------------------------------------------------
| DescribeTrustedAdvisorCheckResult |
+-----------+------+------------------------------------+-------+-----+---------+
| us-east-1| EC2 | On-Demand instances - c3.2xlarge | xxx | 1 | Green |
| us-east-1| EC2 | On-Demand instances - c4.2xlarge | xxx | 0 | Green |
| us-west-2| EC2 | On-Demand instances - c4.2xlarge | xxxx | 0 | Green |
| us-east-1| EC2 | On-Demand instances - c4.xlarge | xxx | 0 | Green |
| us-west-2| EC2 | On-Demand instances - c4.xlarge | xxxx | 9 | Green |
| us-east-1| EC2 | On-Demand instances - m3.xlarge | xxx | 1 | Green |
| us-east-1| EC2 | On-Demand instances - m4.large | xxx | 7 | Green |
| us-west-2| EC2 | On-Demand instances - m4.large | xxx | 8 | Green |
| us-east-1| EC2 | On-Demand instances - m4.xlarge | xxx | 34 | Green |
| us-west-2| EC2 | On-Demand instances - m4.xlarge | xxx | 97 | Green |
| us-east-1| EC2 | On-Demand instances - r4.2xlarge | xx | 8 | Green |
| us-west-2| EC2 | On-Demand instances - r4.2xlarge | xx | 8 | Green |
| us-east-1| EC2 | On-Demand instances - t2.medium | xxx | 1 | Green |
| us-west-2| EC2 | On-Demand instances - t2.medium | xxxx | 1 | Green |
| us-east-1| EC2 | On-Demand instances - t2.micro | xxx | 2 | Green |
| us-west-2| EC2 | On-Demand instances - t2.micro | xxxx | 2 | Green |
| us-west-2| EC2 | On-Demand instances - t2.nano | xxxx | 1 | Green |
| us-east-1| EC2 | On-Demand instances - t2.small | xxx | 5 | Green |
| us-west-2| EC2 | On-Demand instances - t2.small | xxxx | 8 | Green |
+-----------+------+------------------------------------+-------+-----+---------+
答案 1 :(得分:-2)
是的,您可以使用describe-ec2-instance-limits
— AWS CLI Command Reference。
输出包括:
CurrentInstances - > (整数)
此AWS账户当前正在使用的指定类型的实例数。
此命令也可在其他AWS开发工具包中使用。