AWS Official Blog

New Amazon EC2 Feature: Resource Tagging

by Jeff Barr | on | in Amazon CloudFront, Amazon EC2 |

It is really easy to start up that first Amazon EC2 instance, and then another, and another as you find more and more ways to put it to use. It is really easy to create some EBS volumes, attach them to your instances, and to store lots and lots of data on them. The same goes for other EC2 resources such as security groups, and EBS snapshots.

As your usage starts to grow from one instance and one application to many instances spanning multiple applications, it can be difficult to track which instances are assigned to which application, which EBS volumes store what data, and so forth.

We’ve just released a very powerful tagging feature to allow you to tag your EC2 resources (and also certain shared resources) using up to ten key-value pairs per resource. Each tag consists of a key (up to 128 characters) and a value (up to 256 characters). The tags are stored in the AWS cloud as part of your AWS account, and are private to the account.

You can tag the following types of resources: EC2 instances, Amazon Machine Images (AMIs), EBS volumes, EBS snapshots, and Amazon VPC resources such as VPCs, subnets, connections, and gateways. You can tag existing resources and you can tag new resources right after you create them.

You can manipulate your tags using three new API calls:

CreateTags allows you to tag one or more EC2 resources with one or more tags.

DescribeTags gives you the tags associated with one or more resources. The returned tags can be filtered by resource identifier, resource type, key, or value. You can, for example, retrieve all of the tags for a given resource, or you can retrieve all of the resources (regardless of type) with a given tag.

DeleteTags allows you to delete a set of tags from a set of resources.

The existing EC2 “Describe” APIs (DescribeInstances, DescribeVolumes, and so forth) return the tags associated with each of the resources in the response.

You can also manipulate them using the EC2 command-line tools (ec2-create-tags, ec2-describe-tags, and ec2-delete-tags) and from the AWS Management Console.

You can create and delete tags using the AWS Management Console. You can view the tags associated with any resource, you can use a tag as a column in any resource list, and you can filter any view by tag.

Here’s a tour of the new console features. I’ve tagged EC2 instances, but you can also tag many other types of resources.

You can tag new instances as part of the Request Instances Wizard:

You can also tag existing instances (I’m sure that you’ve been a part of at least one “Project Phoenix” in your career):

You can select an instance to see its tags:

The tag names can be used as columns, allowing you to hide and show them, and to see the values:

In the following illustration I have created tags named Use Case and Project on some EC2 instances:

As you can see, a column that represents a tag also includes a filter control:

Clicking the control gives you the ability to filter rows (instances in this case) by the value of the tag:

You can also use the filtering menu to find the items that don’t have a particular tag, or that have a tag with an empty value. You can use this to locate resources that are allocated but not assigned to a particular role, product, or user, for example.

Here’s a list of instances that I have tagged with a Use Case of Production:

Read more about the tagging in the newest version of the EC2 User Guide.

Next feature: Idempotent Instance Creation.

– Jeff;