Posted On: Jan 6, 2022
You can now access your instance's tags from the EC2 Instance Metadata Service. Tags enable you to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. This is useful when you have many resources of the same type—you can quickly identify a specific resource based on the tags that you've assigned to it. Previously, you could access your instance tags from the console or by using the describe-tags API.
Now, by accessing tags from your instance metadata, you no longer need to use the DescribeInstance or DescribeTag API calls to retrieve tag information, which reduces your API transactions per second, and lets your tag retrievals scale with the number of instances that you control. Furthermore, local processes that are running on an instance can view the instance's tag information directly from your instance metadata.
To get started, you can enable tags on instance metadata at launch in the console or CLI and you can save this launch setting in a launch template. You can also use the CLI to enable tags on instance metadata on a running instance or on a stopped instance. Enabling tags on instance metadata at launch will publish your instance tags to your instance metadata at launch. Tag changes after launch will eventually be propagated to your instance metadata.
Tags on the EC2 instance metadata service is now available in all commercial regions, including the Amazon Web Services China (Beijing) Region, operated by Sinnet, and the Amazon Web Services China (Ningxia) region, operated by NWCD.
To learn more about enabling tags on the EC2 Instance Metadata Service, see the EC2 user guide.
As a best practice, we recommend that you do not include personal, confidential or sensitive data in your tags. To learn more about tagging Amazon EC2 Resources, see the EC2 User Guide on tags.