[英]aws - ecs: List cluster and their ec2 instances
Is there a way to list有没有办法列出
The aws cli does not seem to support such option. aws cli似乎不支持这样的选项。
I am trying to create an inventory of such resources and I want the above info to be recorded (ECS clusters + instance number / type of each of those instances)我正在尝试创建此类资源的清单,并且我希望记录上述信息(ECS 集群 + 实例编号/每个实例的类型)
Do you have the latest AWS CLI
installed so you have ecs
subcommand available?您是否安装了最新的
AWS CLI
因此您可以使用ecs
子命令?
how to list available cluster - it will return a list of clusters ARNs:如何列出可用集群 - 它将返回集群 ARN 列表:
aws ecs list-clusters
how to get container instances of the cluster - it will return a list of container instances ARNs in the cluster:如何获取集群的容器实例 - 它将返回集群中容器实例 ARN 的列表:
aws ecs list-container-instances --cluster FOOBAR
finally, how to get EC2 instance(s) ID of the container instance(s):最后,如何获取容器实例的 EC2 实例 ID:
aws ecs describe-container-instances --cluster FOOBAR --container-instances FOOBAR_CLUSTER_CONTAINER_INSTANCES_ARNS
The last command will describe particular container instance(s) where you can filter out ec2InstanceId
parameter to find out EC2 instance(s) ID.最后一个命令将描述特定的容器实例,您可以在其中过滤出
ec2InstanceId
参数以找出 EC2 实例 ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.