Aws Tags

AWS Tagging Suggestions #

Tagging best practices #

Use too many tags rather than too few tags.

It is easy to change tags to accommodate changing business requirements, but consider the consequences of future changes. For example, changing access control tags means you must also update the policies that reference those tags and control access to your resources.

You can automatically enforce the tagging standards that your organization chooses to adopt by creating and deploying tag policies using AWS Organizations. Tag policies let you specify tagging rules that define valid key names and the values that are valid for each key. You can choose to only monitor, giving you an opportunity to evaluate and clean up your existing tags. Once your tags are in compliance with your chosen standards, you can then turn on enforcement in the tag policies to prevent non-compliant tags from being created.

Tag naming best practices #

A fictitious company named AnyCompany, you might define tags such as:

  • anycompany:cost-center to identify the internal Cost Center code.
  • anycompany:environment-type to identify whether the environment is development, test, or production.
  • anycompany:application-id to identify the application that the resource was created for.

The prefix ensures that tags are clearly recognizable as defined by your organization and not by AWS or a third-party tool that you might be using. Using all lowercase with hyphens for separators avoids confusion about how to capitalize a tag name. For example, anycompany:project-id is simpler to remember than ANYCOMPANY:ProjectID, anycompany:projectID, or Anycompany:ProjectId.

Tag naming limits and requirements #

The following basic naming and usage requirements apply to tags:

  • Each resource can have a maximum of 50 user created tags.
  • System created tags that begin with aws: are reserved for AWS use, and do not count against this limit. You can’t edit or delete a tag that begins with the aws: prefix.
  • For each resource, each tag key must be unique, and each tag key can have only one value.
  • The tag key must be a minimum of 1 and a maximum of 128 Unicode characters in UTF-8.
  • The tag value must be a minimum of 0 and a maximum of 256 Unicode characters in UTF-8.
  • Allowed characters can vary by AWS service. For information about what characters you can use to tag resources in a particular AWS service, see its documentation. In general, the allowed characters are letters, numbers, spaces representable in UTF-8, and the following characters: _ . : / = + - @.
  • Tag keys and values are case sensitive. As a best practice, decide on a strategy for capitalizing tags, and consistently implement that strategy across all resource types. For example, decide whether to use Costcenter, costcenter, or CostCenter, and use the same convention for all tags. Avoid using similar tags with inconsistent case treatment.

Common tagging strategies #

Tags for resource organization #

Tags are a good way to organize AWS resources in the AWS Management Console. You can configure tags to be displayed with resources, and can search and filter by tag. With the AWS Resource Groups service, you can create groups of AWS resources based on one or more tags or portions of tags. You can also create groups based on their occurrence in an AWS CloudFormation stack. Using Resource Groups and Tag Editor, you can consolidate and view data for applications that consist of multiple services, resources, and Regions in one place.

Name – Identify individual resources

  • Application ID – Identify resources that are related to a specific application
  • Application Role – Describe the function of a particular resource (such as web server, message broker, database)
  • Cluster – Identify resource farms that share a common configuration and perform a specific function for an application
  • Environment – Distinguish between development, test, and production resources
  • Version – Help distinguish between versions of resources or applications

Tags for cost allocation #

AWS Cost Explorer and detailed billing reports let you break down AWS costs by tag. Typically, you use business tags such as cost center/business unit, customer, or project to associate AWS costs with traditional cost-allocation dimensions. But a cost allocation report can include any tag. This lets you associate costs with technical or security dimensions, such as specific applications, environments, or compliance programs.

For some services, you can use an AWS-generated createdBy tag for cost allocation purposes, to help account for resources that might otherwise go uncategorized. The createdBy tag is available only for supported AWS services and resources. Its value contains data associated with specific API or console events. For more information, see AWS-Generated Cost Allocation Tags in the AWS Billing and Cost Management User Guide.

  • Project – Identify projects that the resource supports
  • Owner – Identify who is responsible for the resource
  • Cost Center/Business Unit – Identify the cost center or business unit associated with a resource, typically for cost allocation and tracking
  • Customer – Identify a specific client that a particular group of resources serves

Tags for automation #

Resource or service-specific tags are often used to filter resources during automation activities. Automation tags are used to opt in or opt out of automated tasks or to identify specific versions of resources to archive, update, or delete. For example, you can run automated start or stop scripts that turn off development environments during nonbusiness hours to reduce costs. In this scenario, Amazon Elastic Compute Cloud (Amazon EC2) instance tags are a simple way to identify instances to opt out of this action. For scripts that find and delete stale, out-of-date, or rolling Amazon EBS snapshots, snapshot tags can add an extra dimension of search criteria.

  • Date/Time – Identify the date or time a resource should be started, stopped, deleted, or rotated
  • Opt in/Opt out – Indicate whether a resource should be included in an automated activity such as starting, stopping, or resizing instances
  • Security – Determine requirements, such as encryption or enabling of Amazon VPC flow logs; identify route tables or security groups that need extra scrutiny

Tags for access control #

IAM policies support tag-based conditions, letting you constrain IAM permissions based on specific tags or tag values. For example, IAM user or role permissions can include conditions to limit EC2 API calls to specific environments (such as development, test, or production) based on their tags. The same strategy can be used to limit API calls to specific Amazon Virtual Private Cloud (Amazon VPC) networks. Support for tag-based, resource-level IAM permissions is service specific. When you use tag-based conditions for access control, be sure to define and restrict who can modify the tags. For more information about using tags to control API access to AWS resources, see AWS services that work with IAM in the IAM User Guide.

  • Confidentiality – An identifier for the specific data confidentiality level a resource supports
  • Compliance – An identifier for workloads that must adhere to specific compliance requirements

References #