Cost Allocation Tags are a feature provided by AWS to help you closely monitor the usage and costs of your AWS resources. These tags can be assigned to resources within your AWS accounts, allowing you to construct a customized cost allocation and governance framework that best fits your organization.
Cost Allocation Tags are helpful in better organizing the costs and usage of your AWS resources, however, they are best used in conjunction with other cost analysis tools such as Cost Explorer, AWS Budgets, Budget Reports, Cost and Usage Reports (CUR), Cost Categories, and Anomaly Detection.
What are AWS Cost Allocation Tags?
AWS Cost Allocation Tags are labels that you can assign to any applicable AWS resource. Each tag consists of two things: a key and a unique value. AWS requires that all user-defined cost allocation tags use unique keys; for AWS-generated cost allocation tags, the tags are defined, created, and applied by AWS itself or AWS Marketplace ISV using more universal conventions.
Types of AWS Cost Allocation Tags
There are two types of AWS cost allocation tags, as mentioned earlier: AWS-generated and user-defined cost allocation tags. Both types of tags require activation via the Billing and Cost Management Console to serve as cost allocation tags vs. regular operational tags (further explained in a section below). Also, applied tags are visible for only the instances that are provisioned after the activation of tags.
The two types of tags: AWS-Generated and User-Defined
AWS-Generated Cost Allocation Tags
AWS-generated cost allocation tags are viewable in the Billing and Cost Management Console and in reports. They cannot be found elsewhere, such as the AWS Tag Editor. Tags generated by AWS use the same key: aws:createdBy which is designed to capture all relevant information related to the creation of a new resource in AWS for future reference. For example:
- aws:createdBy = IAMUser: ASGHNBDGTRE :userName
- aws:createdBy = AssumedRole: NBVCXGFD :userRole
Once AWS-generated cost allocation tags are activated by the account manager, the tags are automatically activated for all account members.
Examples of AWS-Generated Tag Values
- account-type: States the account type (e.g., FederatedUser, AssumedRole, IAMUser, and Root)
- account -id: tracks the total number of root accounts or federated users who are responsible for creating resources
- access-key: tracks the IAM access key used and the session role name if applicable
- user-name: records a user name when available
There are a few limitations to AWS-Generated Cost Allocation Tags; one such limitation is these tags cannot be applied to all AWS services. The services in which these tags can be applied include:
- AWS CloudFormation
- AWS Data Pipeline
- Amazon EC2
- Amazon ElasticCache
- AWS Elastic Beanstalk
- Elastic Load Balancing
- Amazon S3 Glacier
- Amazon Kinesis
- Amazon Relational Database Service
Considerations for AWS-Generated Cost Allocation Tags
- Can only be activated by a management account
- You can’t update, edit or delete the tags
- Cannot apply to the resources that were created before the tag was activated
- The maximum active tag keys for Billing and Cost Management reports is 500
- Created using CloudTrail logs, so AWS Generated Tag creation can fail if the log file is too large to accept new entries
- Tag names and values are automatically assigned
- Tag names don’t count towards the user-defined resource tag limit of 50
- Null tag values will not appear in Cost Explorer and AWS Budgets
- If there is only one tag value that is also null, the tag key will also not appear in Cost Explorer or AWS Budgets
User-Defined Cost Allocation Tags
User-defined cost allocation tags are defined, created, and applied to resources by members of your AWS account. Usage of these tags follow the same process as AWS-generated tags, that is, they require activation and are applied only to the resources that are initiated after the activation process. These kinds of tags allow for level-2 tagging, meaning that you can tag resources launched by other resources (e.g., an Amazon EMR’s EC2).
User-defined cost allocation tags can be viewed via the Cost Management Console after enabling Budgets, Cost Explorer, Legacy reports, or AWS Cost and Usage Reports. User-defined tags also appear in the cost allocation report for you to manage and track your AWS costs.
How to Create User-Defined Cost Allocation Tags
There are several ways for you to create user-defined cost allocation tags, including:
- AWS Tag Editor
- AWS Management Console
Considerations for User-Defined Cost Allocation Tags
- The reserved prefix is “user:” which is displayed in the Cost Allocation Report
- Each key can only be used once for each resource
- In some services, you can tag a resource when you create it
- You can’t backdate the application of a tag
- Tags only start appearing on your Cost Allocation Report after you apply them
- You can apply standard base-64 encoding to your tag
- Billing and Cost Management does not encode or decode your tag for you
- Tags on non-metered services can be activated; however, these tags do not populate in the Cost Management suite
Activating Cost Allocation Tags
Cost Allocation Tags must be activated from a list of regular AWS tags. In other words, you must first create an AWS tag and then instruct AWS to use it specifically as a Cost Allocation Tag. This approach helps AWS lower the indexing overhead in its billing logs unless requested by the account administrators. The instructions to activate user-defined are documented in this article, and the AWS-defined tags are defined in this article, even though they involve identical steps.
AWS Cost Allocation Tag Use Cases
Some common use cases for cost allocation tags include:
- Automating operations
- Managing access and minimizing security risk management
- Identifying costs for business units, departments, projects, products, or regions
- Identify underutilized resources
- Building disaster recovery plans
- Forecasting resource needs
Your AWS resources can be tagged to designate the owner, the product-line, or operations team
Best Practices for Using AWS Cost Allocation Tags
This section is a high-level overview of best practices you should keep in mind when using AWS Cost Allocation Tags. Use these best practices to quickly design a tagging strategy that has room to evolve with your organization’s needs over time.
- Identifying Tag Requirements:
- Employ a cross-functional team to identify tag requirements
- Assign owners to define consistent tag values for each key
- Focus on required and conditionally required tags
- Start small; less is more
- Naming Tags and Resources:
- Design and enforce a consistent tag nomenclature
- Adhere to consistent notation formats for different resource types
- Cost Allocation Tags:
- Align Cost Allocation Tags with financial reporting dimensions
- Use them along with Linked Accounts to associate an AWS account with a master payer account
- Avoid multi-valued Cost Allocation
- Tags Tag everything
- Tag Governance and Data Management:
- Integrate with authoritative data sources
- Use compound tag values (where one key has multiple values) judiciously
- Use automation such as CloudFormation templates to proactively tag resources
- Constrain tag values with AWS Service Catalog
- Propagate tag values across related resources (for example all EBS volumes attached to an EC2)
- Lockdown tags used for access control (where tags are used to limit security access privileges to specific resources)
- Remediate untagged resources by periodically creating a list
- Implement a tag governance body that meets regularly to review best practices
Cost Allocation Tags appear in the form of a report as comma-separated values in a CSV file that can be generated via the AWS Billing and Cost Management Console. The usage and cost of resources are grouped within the CSV file based on your active tags. This report is known as the Cost Allocation Report.
Cost Allocation Tags in the Billing Dashboard
Via the billing dashboard, you can access the cost allocation report and apply tags representing your business categories such as cost centers, owners, application names, production, testing, and so on.
You can view both tagged and untagged resources and organize them accordingly to better calculate the charges for your resources. For example, if you tag your AWS resource with the application name then you will have the ability to track even a single application that utilizes the tagged resource.
AWS Cost Allocation Reports
A Cost Allocation Report is a list of the usage of your AWS resources grouped by your product category and any linked account user. It also contains, like detailed Cost and Usage Reports, the same line items with the addition of your Auto-Generated and User-Defined Cost Allocation Tags.
There are two types of cost allocation reports:
- Monthly Cost Allocation Report
- Hourly Cost Allocation Report
During a billing cycle, AWS first generates an estimated cost allocation report that gets overwritten by the actual usage throughout the billing period.
Viewing a Cost Allocation Report
You can download a CSV file and view it in a desktop spreadsheet application. The data in the file can then be organized by creating a pivot table to group the keys and values to get the combined values of tagged resources.
Unallocated Resources in Cost Allocation Reports
Unallocated resources by default follow that standard billing aggregation, that is, they get organized by the line item, account, and product.
Unexpected Costs Associated with Tagged Resources
There are several possible situations for the unexpected appearance of costs associated with tagged resources, these situations include:
- Usage exceeds the AWS Free Tier
- AWS Free Tier expires
- Bill is received after account closure
- Disabled regions with resources still active for those regions
- Elastic Beanstalk environments terminated before the termination of resources
- Elastic Load Balancing (ELB) termination before the termination of EC2 instance
- Services started in AWS OpsWorks
- Undeleted Amazon Elastic Block Store volumes and snapshots
- Unreleased Elastic IP addresses
- Services launched by other services
- Costs associated with storage services such as RDS and S3
Managing Tags Programmatically
There are several ways to automate the tagging process. Here are some:
- Auto Scaling Groups (ASG) are designed to scale in and out the number of nodes in a a cluster based on application workload. They are also able to automatically tag the nodes that are launched.
- In 2017, AWS unveiled AWS Tagging APIs that can be accessed programmatically via a script, or as part of a continuous delivery process. You can find the API functions in this article.
- The AWS Command Line Interface (CLI) is a popular method to apply changes to your AWS environment by typing commands and avoiding the need to click in a UI. The AWS CLI supports the tagging API functions.
Set Tag-based KPIs
The natural evolution of tagging and measuring is benchmarking. Defining KPIs, or Key Performance Indicators, is a great way to understand the state of your resource usage visibility over time. Here are a few examples:
- Percentage of resources where tagged resource has no tag value
- Percentage of resources that have no tags at all
- Percentage of un-tagged resources trending over time
Read 6 Cost KPIs to Drive Hybrid Cloud Value for ideas on how to measure your cloud optimization progress. Here are three additional KPIs that you can add to the list for tracking tagging success:
Percentage of untagged resources
Percentage of resources tagged with null value
Trend graph of your tagging coverage over time
How to Get the Most Out of AWS Cost Allocation Tags
Adding AWS Cost Allocation Tags to your resources is an excellent way of organizing AWS resources and separating costs, but don’t stop there. Tags should be used in conjunction with other cost analysis tools. Here are some examples of how to make use of your tags:
- Analyze your costs with Cost Explorer
- Manage your costs with AWS Budgets
- Report your budget metrics with budget reports
- Manage costs with AWS Cost Categories
- Use the AWS Price List API
AWS Cost Management Features
AWS provides many cost management services. The following services are divided into groups with specific capabilities and use cases.
- AWS Cost Allocation Tags and AWS Cost Categories allow you to organize and construct a cost allocation and governance foundation. They also allow you to use your own tagging strategy.
- AWS Cost Explorer and AWS Cost and Usage Reports allow you to generate reports to raise awareness and offer accountability for your cloud expenditure. They do so by providing you with detailed allocable cost data.
- AWS Consolidated Billing, AWS Purchase Order Management, and AWS Credit allow you to access and track billing information across the entire organization.
AWS Budget Features
AWS Budgets, AWS Budget Actions, and AWS Service Catalog allow you to budget and keep your spending in check via the budget thresholds, auto alerts, and notifications.
AWS Billing Alarm Features
You can use AWS Budgets and AWS Budget Actions to set alarms, auto alerts, and notifications for overage on any resource that is being used. You have the option to receive your budget alerts for your resources in Amazon Chime, and in Slack using the AWS Chatbot.
AWS Trusted Advisor
Using a trusted advisor is an excellent option for cost optimization. Trusted Advisor checks, across all AWS regions, your AWS infrastructure and creates a summary of the results. With the cost optimization option in the Trusted Advisor, you can view the potential monthly saving, recommendations, and cost optimization checks.
Trusted Advisor can perform the following check categories:
- Potential Monthly Savings
- Cost Optimization Checks for Underutilized Resources
- Cost Optimization Checks for Reservation
- Amazon Route 53 Latency Resource Set Check