Sub topic 10
Designing a tagging strategy
This chapter assumes you can apply tags to resources and activate them as cost allocation tags, and that you have used Cost Explorer to group spend by tag. Here you decide which tags to create and how to keep them consistent, so those reports stay useful.
Start from the questions you need to answer
A tagging strategy begins with the questions finance and engineering ask about cost, not with a list of tag names. Typical questions are:
- Which project or product does this spend belong to?
- Which team should review it?
- Is it production or non-production?
- Which budget or cost center pays for it?
Each question maps to one tag key. Keep the set small. Every key you add is one more thing people can forget or misspell.
A starter set of keys
| Key | Answers | Example values |
|---|---|---|
| Project | What is this for? | checkout, search |
| Environment | Which stage? | prod, staging, dev |
| Owner | Who is responsible? | payments-team |
| CostCenter | Who pays? | cc-1042 |
Choose keys that are useful for cost reports. Details that only help operations, such as a deployment ID, rarely belong in the set you activate.
Naming rules
Tag keys and values are case-sensitive. Project and project are two different keys, and prod and Prod are two different values. Cost Explorer will show them as separate groups, which splits one project's spend across several rows.
Agree on these rules and write them down:
- Use one capitalization style for keys, such as
PascalCase. - Use lowercase for values, with hyphens between words.
- Use a fixed list of allowed values for keys like
Environment. - Never put secrets or personal data in a tag. Tags appear in billing data and are visible to many people.
How the pieces fit together
A tag must exist on the resource, be activated in the management account, and then be used in a report. A gap at any step leaves spend unattributed.
Apply the strategy
Tag a resource using the agreed keys:
aws ec2 create-tags \
--resources i-0123456789abcdef0 \
--tags Key=Project,Value=checkout Key=Environment,Value=prodThen activate the keys from the management account:
aws ce update-cost-allocation-tags-status \
--cost-allocation-tags-status TagKey=Project,Status=Active TagKey=Environment,Status=ActiveConfirm the activation worked:
aws ce list-cost-allocation-tags --status ActiveCommon mistakes
- Too many keys. Teams stop filling them in. Start with three or four.
- Free-text values. Typing
Checkout,checkoutandcheck-outcreates three groups. - Tagging only some resource types. Not every service supports tags, and some resources, such as data transfer, may not carry them. Plan for a remainder of untagged spend.
- No owner for the strategy. Someone must maintain the list of keys and allowed values, or it drifts.
Enforcement and auditing are covered in a later chapter. For now, write the strategy down as a short document that lists each key, its allowed values, and who maintains it.
Exercise
Your Cost Explorer report grouped by the Project tag shows separate rows for "checkout" and "Checkout". What caused this, and what should you do?
Show answer
Tag values are case-sensitive, so the two spellings are different values. Agree on one convention, such as lowercase values, correct the tags on the affected resources, and restrict allowed values so the mismatch does not recur.
Exercise
You activate a new CostCenter tag today. Will last month's spend appear grouped by CostCenter automatically?
Show answer
No. Activation applies from that point forward. You can request a backfill of up to 12 months from the Billing console, but it is not automatic.