从实例中查询EC2标签实例、标签

2023-09-11 08:03:53 作者:浮白

亚马逊最近添加的标注EC2实例与键 - 值对,使大量虚拟机的有点容易管理的奇妙功能。

Amazon recently added the wonderful feature of tagging EC2 instances with key-value pairs to make management of large numbers of VMs a bit easier.

有一些方法来查询这些标签以相同的方式,因为一些其他用户设置的数据?例如:

Is there some way to query these tags in the same way as some of the other user-set data? For example:

$ wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone
us-east-1d

有没有查询标签有些类似的方式?

Is there some similar way to query the tags?

推荐答案

您可以使用 AWS元数据工具(检索您的实例ID)和新标签API 检索标签当前实例。

You can use a combination of the AWS metadata tool (to retrieve your instance ID) and the new Tag API to retrieve the tags for the current instance.

 
精彩推荐
图片推荐