When running in an AWS public cloud environment, many times there is a need to dissect the billing across different projects for accounting and accrual purposes. AWS provides a mechanism to aggregate related platform costs using a feature known as Cost Allocation Tags. With this feature you can designate Tags on your AWS resources to track costs on a detailed level.
From the AWS Documentation:
Activating tags for cost allocation tells AWS that the associated cost data for these tags should be made available throughout the billing pipeline. Once activated, cost allocation tags can be used as a dimension of grouping and filtering in Cost Explorer, as well as for refining AWS budget criteria.
For example, to view cost allocation based on various project resources in your AWS account, you can tag these resources (EC2 instances, S3 buckets, etc) with a tag named “Project”. Next the Project tag can be activated as a Cost Allocation Tag. From then on AWS will include this tag in associated cost data to allow for filtering based in the tag in Cost Explorer reports.
Let’s walk through the steps of setting this up:
- Log in to your AWS Management Console
- Tag all the resources with a Tag Key as Project and Value as per your various projects. Understand that this may not be possible for every resource type.
- Navigate to My Billing Dashboard > Cost Allocation Tags
- Under User-Defined Cost Allocation Tags section, select the tag “Project” and click the “Activate” button.
Once a tag is activated it will take around 24 hours for billing data to appear under this tag.
Next, to view the costs under a project, do the following:
- Log in to your AWS Management Console
- Navigate to My Billing Dashboard > Cost Explorer
- Click “Launch Cost Explorer”
- On the right side of the page under Filters section, click the Tag filter and select the Project tag, then the Tag Value to filter cost by the Project
As you can see from the screenshot below, now we can see exactly how much each project is costing per day (or month, if selected)
Some important points to consider:
- Cost allocation tagging is “managed” via the master billing account at the root of the AWS organization. If your account is part of an organization you will have to contact this account administrator to enable the cost allocation tags.
- The error message in the previous screenshot will always appear in tenancies not allocated the management permission.
- Some resources notably bandwidth charges cannot be tagged and thus cannot be accounted under cost allocation tagging. A common pattern in such cases is to calculate percentage cost on each project and cost the unaccounted charges based on this percentage.