Get your AWS instance tags from your EC2 instance

Need to read the values of your Amazon AWS EC2 instance tags?

There's a quick way that you can use to read the tags of your EC2 instance from inside the same instance. If you have the instance id (and you can get it by using the EC2 MetaData) you can use the AWS Command Line tools.

More specifically, by using the Describe Tags command of the AWS CLI you can get your instance tags in the following way:

Let's say you want to get the value of the Environment tag, you could do:

Permissions needed to get the Amazon AWS EC2 instance tags

For this to work, you have to have the ec2:DescribeTags permission in your user policies or in the IAM Profile of your instance.