AWS Cost Allocation Tags: Lower AWS Billing Cost Now!
This article is about how to use AWS Cost Allocation Tags to help lower AWS billing charges. We’ll start with a fictitious story and then introduce AWS Cost Allocation Tags and then move on to compliance using AWS Organizations and AWS Config, and finally we’ll review required and optional AWS tagging strategies.
Table of Contents
I’ve written a supporting article that answers the question “What Is The Purpose Of Cost Allocation Tags in AWS?” which you might helpful as well — this post includes a fake case study about Company X and how the business was able to save money using AWS Cost Allocation Tags. I also have an another article entitled “Introduction to AWS Budgets, AWS Alarms, AWS Single Sign-On (AWS Single Sign On / AWS SSO), and AWS Cost Anomaly Detection” which may be of interest as well.
AWS Cost Allocations Fictitious Story
Bob had just arrived in the office for his first day of work as the newly hired chief technical officer when he was called into a conference room by the president, Martha, who immediately introduced him to the head of accounting, Amanda. They exchanged pleasantries, and then Martha got right down to business:
âBob, we have several teams here developing software applications on Amazon and our bill is very high. We think itâs unnecessarily high, and weâd like you to look into it and bring it under control.â
Martha placed a screenshot of the Amazon Web Services (AWS) billing report on the table and pointed to it.
âThis is a problem for us: We donât know what weâre spending this money on, and we need to see more detail.â
Amanda chimed in, âBob, look, we have financial dimensions that we use for reporting purposes, and I can provide you with some guidance regarding some information weâd really like to see such that the reports that are ultimately produced mirror these dimensions â if you can do this, it would really help us internally.â
âBob, we canât stress how important this is right now. These projects are becoming very expensive for our business,â Martha reiterated.
âHow many projects do we have?â Bob inquired.
âWe have four projects in total: two in the aviation division and two in the energy division. If it matters, the aviation division has 75 developers and the energy division has 25 developers,â the CEO responded.
Bob understood the problem and responded, âIâll see what I can do and have some ideas. I might not be able to give you retrospective insight, but going forward, we should be able to get a better idea of whatâs going on and start to bring the cost down.â
The meeting ended with Bob heading to find his desk. Cost allocation tags should help us, he thought to himself as he looked for someone who might know where his office is.
What is AWS Billing and Cost Management?
đ¤ AWS Billing and Cost Management is a suite of tools and services that helps AWS customers monitor and manage their AWS usage and costs. It provides a range of features and capabilities that enable customers to optimize their usage and control their costs, including:
Cost Explorer
A tool that provides a graphical view of customers’ AWS costs and usage over time, enabling them to identify trends and patterns in their usage.
Budgets
A feature that enables customers to set custom cost and usage budgets for their AWS resources and receive alerts when they approach or exceed these limits.
Cost and Usage Reports
A set of reports that provide detailed information about customers’ AWS usage and costs, including data broken down by service, region, and other criteria.
Reserved Instances
A feature that enables customers to purchase reserved capacity for their AWS resources, providing significant discounts over on-demand pricing.
Savings Plans
A flexible pricing model that provides customers with savings on their AWS usage in exchange for a commitment to use a specific amount of compute usage over a period of time.
Cost Allocation Tags
A feature that enables customers to tag their AWS resources with metadata that can be used to allocate costs to specific teams or projects.
AWS Billing and Cost Management is designed to help customers optimize their AWS usage and control their costs, providing them with the tools and insights they need to make informed decisions about their AWS resources. By using these features, customers can better manage their AWS costs and ensure that they are getting the most value from their AWS investments. đ¤
In the next section we’ll introduce AWS Cost Allocation Tags.
Introduction to AWS Cost Allocation Tags
In this fictitious story, Bob needs to figure out where these expenses are coming from so that he can start to work on lowering the cost. The AWS cost explorer, while helpful, on its own is simply not enough in this case. Bob needs more detail, and thatâs where cost allocation tags (CATs) can be helpful. There are other tools in AWS that can assist Bob with this task, and weâll mention those in brief detail later in this article.
In general, cost allocation tags have some characteristics which we should be aware of (and if I missed something, please add your comment):
- Cost allocation tags can help demonstrate relationships between resources.
- Cost allocation tags are metadata about your resource, and these simple key-value pairs can be added to just about any resource in AWS.
- Cost allocation tags are ideally a single key and a single value juxtaposed with a single key and multiple values.
- Cost allocation tags are limited to 50 per resource.
- Cost allocation tags can have rules enforced on them, which helps to ensure consistency and also meet compliance requirements.
- Some cost allocation tags are also generated automatically by AWS (
aws:createdBy
, for example) â these tags are immutable. - Cost allocation tags can also be used for automation, operations, and access, as well as security risk management.
- As it pertains to CATs, cost allocation tags can be useful for identifying cost center, business unit, department, project, product, geographic area, or purpose, for the purposes of financial reporting.
- Cost allocation tags only appear in reports at the time the tag is created â there is no backdating.
In the next section, weâll look at the AWS billing dashboard, where we can activate a tag, and also at a report thatâs filtered by that tag.
Amazon Web Services (AWS) Cost Allocation Tags (CATs) help to organize and track costs within an AWS account. AWS Cost Allocation Tags are metadata labels that can be assigned to AWS resources such as EC2 instances, S3 buckets, or RDS databases, in order to categorize and classify the resources based on different attributes or criteria.
Several benefits that come from using AWS Cost Allocation Tags include:
- Gaining granular visibility into AWS spending
- Learning how costs are incurred across different projects, departments, and teams
- Improving cost management, budgeting, and resource optimization
- Allocating costs accurately
- Imposing better control of spending
- Analyzing usage patterns
- Developing more informed decisions when it comes to optimizing AWS infrastructure in use
Take a look at the purpose of AWS Cost Allocation Tags article to explore this subject in more detail.
AWS Cost Allocation Tags in the AWS Billing Dashboard
In this section, weâre going to look at the AWS billing dashboard, which is available to account holders and which has two items of interest: the AWS Cost Explorer and AWS Cost Allocation Tags. We can see both in the next image.
The following image demonstrates how we can filter by tag in the AWS cost management cost explorer AWS web UI.
If we filter by costCenter
tag 12345, we can get an idea below what costs are associated with this key and value, specifically.

In the next section, weâll go over three examples pertaining to how resources, such as an EC2 instance, in this case, can be tagged with two tags via the web interface, via the command line (CLI), and programmatically.
AWS Cost Allocation Tag Examples (UI, CLI, Code)
In this section, we will review three examples of how CATs can be applied to an AWS EC2 instance on creation. We will cover tagging via the web user interface (UI), via the AWS command line, and finally, we will demonstrate how an EC2 instance is tagged at creation time using Node.js.
Use AWS Cost Allocation Tags to Tag an EC2 Instance via the Web User Interface (UI)
Creating an EC2 instance via the AWS web interface is easy enough. We can see below that we can add tags in step five.

Weâve skipped ahead in this example, and below you can see step five, where weâve assigned costCenter
 and department
 key-value pairs (KVPs) to this instance.

Once the instance has been launched, we can see that the tags weâve assigned above are assigned to the instance itself.

Use AWS Cost Allocation Tags to tag an EC2 instance via the command-line interface (CLI)
This example is fairly straightforward. The steps not included here involve setting up the profile, which requires creating a user and assigning the appropriate permissions, as well as creating the VPC.
We also need to create a profile in the /Users/[user]/.aws/credentials
 file, which includes the aws_access_key_id
 and aws_secret_access_key
 with AWS-provided values. This is necessary for both the example below and the programmatic example which follows.
The following script will create a t2.micro
 instance in the us-east-1
 region and deploy it in the subnet-0969b587cc72969d2
 subnet. Most importantly for this example, the EC2 instance will be tagged with the costCenter
 and department
 KVPs.
aws ec2 run-instances --image-id ami-02354e95b39ca8dec --count 1 --instance-type t2.micro --region us-east-1 --profile thospfuller-aws-cli --subnet subnet-0969b587cc72969d2 --tag-specifications 'ResourceType=instance,Tags=[{Key=costCenter,Value=45678}, {Key=department,Value=Energy}]'
The aforementioned subnet value can be found under the VPS Subnets option as shown in the image below.
In the following image, we can see the costCenter
 and department
 tags appear on the EC2 instance.
This brings us to the last example that weâll cover here, and that is to launch programmatically an EC2 instance thatâs been tagged with the appropriate KVPs.
Use AWS Cost Allocation Tags to Tag an EC2 Instance Programmatically
Similar to the previous example, this example is fairly straightforward. The steps not included here involve setting up the profile, which requires creating a user and assigning the appropriate permissions, as well as creating the VPC.
We also need to create a profile in the /Users/[user]/.aws/credentials
 file, which includes the aws_access_key_id
 and aws_secret_access_key
 with AWS-provided values.
The following will create a t2.micro instance
 in the us-east-1
 region, deploy it in the subnet-0969b587cc72969d2
 subnet, and, most importantly for this example, tag it with the costCenter
 and department
 KVPs.
Line #49 has the costAllocation
 and department
 KVPs. Note that the gist below can be found on GitHub and the file is also available in the following repository.
/**
* https://gist.github.com/thospfuller/0a2a7809dbf75a0c7a3e2b749bed7d0b
*
* Precondition:
*
* - npm install aws-sdk
*/
const AWS = require('aws-sdk');
AWS.config["credentials"] = new AWS.SharedIniFileCredentials({profile: 'thospfuller-aws-cli'});
AWS.config["logger"] = console;
/**
* See also: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/ec2-example-creating-an-instance.html
*
* aws ec2 run-instances
* --image-id ami-02354e95b39ca8dec
* --count 1
* --instance-type t2.micro
* --region us-east-1
* --profile thospfuller-aws-cli
* --subnet subnet-0969b587cc72969d2
* --tag-specifications 'ResourceType=instance,Tags=[{Key=costCenter,Value=45678}, {Key=department,Value=Energy}]'
*/
AWS.config.update({region: 'us-east-1'});
// Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-02354e95b39ca8dec (64-bit x86) / ami-0c5bf07e510b75b11 (64-bit Arm)
const instanceParams = {
ImageId: 'ami-02354e95b39ca8dec',
InstanceType: 't2.micro',
SubnetId: 'subnet-0969b587cc72969d2',
MinCount: 1,
MaxCount: 1
};
const instancePromise = new AWS.EC2({apiVersion: '2016-11-15'}).runInstances(instanceParams).promise();
instancePromise.then(
function(data) {
console.log("Data: ", data);
const instanceId = data.Instances[0].InstanceId;
console.log("Created instance with id: ", instanceId);
let tagParams = {
Resources: [instanceId], Tags: [
{
Key: 'costCenter',
Value: '45678'
}, {
Key: 'department',
Value: 'Energy'
},
]
};
const tagPromise = new AWS.EC2({apiVersion: '2016-11-15'}).createTags(tagParams).promise();
tagPromise.then(
function(data) {
console.log("Instance created successfully.");
}).catch(
function(err) {
console.error("Unable to create an EC2 instance.", err, err.stack);
});
}).catch(
function(err) {
console.error("The request to create an EC2 instance was rejected.", err, err.stack);
});
console.log("...done!");
In the following image, we can see the output when the script is executed, along with a pointer to the costCenter
 and department
 tags. Note the instance id
 is just above the red arrow pointer which points to the tags.
In the following image, we can see the instance id
 as the EC2 instance is starting.
Finally, we can see the costCenter
 and department
 tag keys and values in the image below.

In the next section, we will discuss AWS Organizations, AWS Config, and how these services can help a business achieve tag compliance.
AWS Cost Allocation Tag & Compliance
Two choices are available to businesses that are relying on CATs to ensure consistent application and format of tags assigned to resources: AWS Organizations and AWS Config. Since one can easily learn about these directly from the source, we only provide a brief description that will help the reader see the differences:
- AWS Organizations âAWS Organizations is for account management and can consolidate multiple AWS accounts under one organization that is managed centrally; the AWS Organizations service also helps with budgeting, security, and compliance.
- AWS Config â AWS Config is also a service that helps the user with assessing, auditing, evaluating, securing, and troubleshooting the configuration of AWS-specific resources. If your business is not using AWS Organization, then AWS Config can act as an alternative for managing tags; see also Tagging Your AWS Config Resources.
Without auditing and enforcement, the business will easily end up with a mess, so itâs important to not just use the tools available to better understand where the money is going but also to ensure that all resources are created with the appropriate tags in the appropriate format. Keep in mind that engineers have to apply these changes, and without enforcement and compliance, they simply wonât do it or do it consistently and correctly [7].
In our fictitious story, not only will Bob want to take advantage of AWS Cost Allocation Tags, but heâll also additionally benefit from utilizing either AWS Organizations or AWS Config, especially seeing as heâs in charge of overseeing two divisions with 100 software engineers and support staff.
It is beyond the scope of this article to demonstrate how these two services work; however, we may delve into this in detail in a future article.
Strategies When Using AWS Cost Allocation Tags
So far weâve introduced tags and cost allocation tags, weâve demonstrated how tags can be added to a resource such as an EC2 image, and weâve reviewed how one can go about ensuring that compliance measures are in place to ensure that the tag keys and values adhere to an expected format.
The last piece of the puzzle that weâll discuss in this article involves tag strategies. It is not enough to allow engineers and managers to add tags with known values to the AWS resources theyâre using. In fact, in an organization the size of the one that Bob runs, this would be exactly what youâd want to avoid because the business has multiple divisions and many software engineers and support staff. In this case, a tagging strategy needs to be developed with input from the people managing these divisions, with the CTO at the top ensuring that tags are uniform across the business and that there is a minimum set of tags defined, along with optional tags which are applied to every taggable resource in use across the business.
Lastly, when it comes to AWS cost allocation tags (CATs) specifically, our CTO Bob will want to ensure that both a minimum set of required and optional tags are defined and that appropriate key-value pairs are married with financial reporting dimensions, which will be provided to us by, in this story, the head of accounting, Amanda.
AWS Cost Allocation Tags: Article Conclusion
In this article, we introduced AWS Cost Allocation Tags, demonstrated how they work, and reviewed two services, AWS Organizations and AWS Config, which can be used to achieve tag compliance across all AWS resources. These are not the only tools at Bobâs disposal for getting the cost of AWS usage in the business under control. In fact, the addition of any of the following should prove to be helpful as well:
- Cost management
- Budgets
- Billing alarms
- Trusted Advisor
- Third-party cost optimization software
- Continuous improvement strategy [15, 16, 17, 18]
- Developing a performance-optimized architecture [13]
We concluded the article with a basic discussion of tagging strategies, which are very important and which need to be given business-wide attention when defining a set of required and optional tags for use across the business and for cost allocation purposes.
Our budding CTO Bob will be off to a good start implementing tag strategies in the business, but what would you do? Let me know in the comments, right after you finish taking the quiz below.
Recommended Reading
- Tagging Best Practices: Implement an Effective AWS Resource Tagging Strategy
- AWS Tagging Best Practices Guide: Part 1 of 3
- AWS Tagging Best Practices Guide: Part 2 of 3
- Deactivating the AWS-Generated Cost Allocation Tags
- How to reduce your AWS costs? Save up to $500k with these guidelines!
- Cost optimization for Kubernetes on AWS
- AWS Tagging Best Practices â The Ultimate Guide
- Best Practices for Organizational Units with AWS Organizations
- The 5 Pillars of the AWS Well-Architected Framework
- AWS Spending That Canât Be Tagged
- AWS Config and AWS Organizations
- Managing AWS Organizations accounts using AWS Config and AWS CloudFormation StackSets
- Performance Efficiency
- Optimizing your cost with Rightsizing Recommendations
- (Still) learning from Toyota
- Creating a Culture of Continuous Improvement
- The Kaizen Approach to Software Development
- Why Continuous Improvement Is Worth It?
- Introduction to AWS Budgets, AWS Alarms, AWS Single Sign-On (AWS Single Sign On / AWS SSO), and AWS Cost Anomaly Detection
You must log in to post a comment.