Sub topic 4
Tagging and allocating costs to owners
This chapter assumes you can run AWS CLI commands, read JSON, and have seen the Cost Explorer grouping from the previous chapter. It covers how to label resources so every dollar of spend maps to a team, product, or environment.
Why tags matter
A bill grouped by service tells you that EC2 is expensive. It does not tell you who owns the instances. A tag is a key-value label attached to a resource, such as team=payments. Cost tools can group spend by tag, which turns a service-level bill into an ownership-level bill.
Allocation is the step that follows: assigning each cost to the team or product responsible for it. Without it, nobody feels accountable for the number.
Design a small tagging strategy
Keep the set of required keys short. Every extra key lowers compliance.
| Key | Example value | Purpose |
|---|---|---|
| `team` | `payments` | Who answers for the cost |
| `product` | `checkout` | Which product the cost supports |
| `environment` | `prod`, `dev` | Separates production from experiments |
| `cost-center` | `cc-1042` | Maps to finance reporting |
Agree on exact spelling and case. AWS tag keys and values are case-sensitive, so Team and team are different keys, and your reports will split spend between them.
Activate cost allocation tags
Tagging a resource is not enough for billing reports. In AWS, you must also activate a tag as a cost allocation tag in the Billing console. Only then does it appear in Cost Explorer and billing data. Activation is not retroactive: costs incurred before activation are not grouped by that tag.
Apply tags
Tag a resource when you create it. This example tags an existing EC2 instance (the instance ID is a placeholder):
aws ec2 create-tags \
--resources i-0123456789abcdef0 \
--tags Key=team,Value=payments Key=environment,Value=prodGroup spend by tag
Once the team tag is active, group cost by it:
aws ce get-cost-and-usage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY \
--metrics UnblendedCost \
--group-by Type=TAG,Key=teamResults include a group with an empty tag value (shown as team$). That group is your untagged spend.
Common errors
- Inconsistent values.
payments,Paymentsandpaymentappear as three teams. Define allowed values and check them. - Forgetting activation. The tag exists on resources but the report shows nothing for it.
- Untagged resources. Some costs, such as support charges and taxes, cannot be tagged. Others are simply missed. Track the untagged share as a metric and drive it down.
- Tagging only at creation by hand. Manual tagging drifts. Enforce tags in infrastructure-as-code templates, and consider tag policies in AWS Organizations to standardize keys and values.
Shared costs
Some resources serve many teams, such as a shared Kubernetes cluster or a NAT gateway. Tags cannot split these directly. Common approaches are to split the cost evenly, to split it in proportion to usage, or to assign it to a platform team. Pick one rule, write it down, and apply it consistently so teams trust the numbers.
Exercise
Your team tag is applied to all EC2 instances, but Cost Explorer shows no spend grouped under it. Give two likely causes.
Show answer
The tag was never activated as a cost allocation tag in the Billing console, or it was activated recently and past costs are not grouped by it. A third possibility is a key-spelling mismatch such as Team versus team.
Exercise
Your tag report shows large spend under an empty team value. What do you do first?
Show answer
Sort the untagged group by cost, identify the largest resources, find their owners, and tag them. Then add tag enforcement in templates or tag policies so new resources are tagged at creation.