How to use the Cost Allocation Tags in AWS

Tim Schill
AWS Specialists
Published in
5 min readFeb 2, 2023
How to use Cost Allocation Tags in AWS

Cost allocation tags are a powerful tool that can help organizations track and allocate costs associated with their AWS resources. These tags can identify specific resources, such as development or production environments, and assign costs to the appropriate department or project. This article will cover best practices and how to avoid pitfalls when using cost allocation tags.

Design your tagging strategy

The first step when designing your tagging strategy is to identify the areas you want to be able to filter on. For example, it could be departments or teams, applications, or you may want to split the application into storage and compute. It can also be regions, environments (prod dev stage), or even specific people who own the resources.

Use your tagging strategy on resources

When designing your tagging strategy, it is crucial to establish a consistent and easy-to-understand naming convention for your tags, e.g., environment = prod, application = webserver, team = frontend, owner = john_doe. Refrain from mixing and matching upper and lowercase letters. Please keep it simple, lowercase everywhere. Also, try to avoid having whitespace in tags; this can cause trouble in some AWS services console experiences. It is also preferred to programmatically tag resources without human interaction to ensure they are consistently named.

The “billing” tag

Let’s say your application consists of multiple resources, and you install this application numerous times for different customers. The tag application would then provide the combined cost for all the application installations. Of course, you could combine multiple tags, but we prefer to have a separate tag we call billing that takes the values of other tags and combines them into one.

For example, suppose we want to use the tags application = frontend, customer = evolate, and environment = dev to give us the total cost for this particular installation in our dev environment for the customer evolate. In that case, our billing tag could look like this billing = evolate_frontend_dev. Having the billing tag will enable us to group on it in Cost Explorer and give us a nice separation of cost for our different applications as a whole.

Implementation of tags

Once your tags have been designed, the next step is to implement them. This can be done by creating tags at the time of resource creation or by applying them to existing resources. If you use Terraform, providing the tags at the provider level is a great option. Set tags at the resource level where extra detail is needed. For example, application_type could be a resource tag not provided at the provider level but rather at the resource level.

It is also highly recommended that you include steps in your pipelines to verify that tags have been provided. If not, they should fail. In the case of Terraform, you can use a tool such as tfsec to enforce tags in your templates.

You may already have resources in AWS that either need more tags or maybe have no tags at all. This is because they might have been set up manually through the console. Then you can use the “Tag Editor” found under AWS Resource Explorer to set tags on multiple resources faster than going over them manually.

Find resources to tag in the AWS Tag editor

AWS Organizations also allows you to set up tag policies. A tag policy specifies a set of tags and the allowed values for these tags, which I recommend you set up after implementing your tags.

Enable cost allocation tags

When you feel comfortable and know what tags you need for your strategy, it is time to enable them as cost allocation tags. You do this under your billing dashboard, and on the left menu, find “Cost allocation tags.” Locate the tags you want to enable, and be aware that the tags must exist already before you can find them. Enable the checkbox for the tags and click enable. It can take up to 24 hours before the tags have been activated, and you can start to use them.

Enable cost allocation tags in billing console

Monitoring costs and maintenance of tags

Once your tags have been implemented, the next step is to monitor and analyze your costs. This can be done using the AWS Cost Explorer, which allows you to view and analyze your costs by tag. You can also use the AWS Budgets service to set budget alerts for specific tags to notify you if costs exceed a certain threshold.

Cost explorer

Finally, it is essential to review and update your tags regularly. This can be done by reviewing the tag policies you created. It will tell you what resources that comply with your tag policies. It is also essential to check your tagging strategy and make any necessary changes to ensure that your tags are accurate and effective.

AWS Organization Tag Policies

But wait, Cost Categories?

AWS released Cost Categories in November 2019, and it can help you to map your cost and usage information in a more advanced structure than Cost Explorer can do on its own.

For example, you can set up rules for dimensions, such as tags and accounts, and group cost on identifiers in account names, charge types, services, regions, etc. We will follow up on Cost Categories in its own post, so make sure to follow us, so you don’t miss out!

TL;DR

Cost allocation tags in AWS can help track and allocate resource costs. When designing your tagging strategy, establish a consistent naming convention and tag resources programmatically. Implement tags through resource creation or by applying them to existing resources. Monitor and analyze costs using the AWS Cost Explorer and regularly update tags for accuracy.

--

--