Sub topic 10
Designing a tagging strategy
This chapter assumes you can apply a tag to a resource and activate it as a cost allocation tag. It also assumes you can group a Cost Explorer report by tag, as covered in earlier chapters. Here the question changes from how to tag to what to tag. A tagging strategy is a short set of agreed keys, allowed values and ownership rules that make your spend reports answer real questions.
Start from the questions, not the tags
Tags cost nothing to create, so teams often add many of them. Most go unused. Work backwards instead:
- List the questions finance, engineering and management ask about spend. Examples are "What does the checkout service cost per month?", "How much of our bill is non-production?" and "Which team should we charge for this?"
- For each question, name the one dimension that answers it: project, environment, owner or cost center.
- Turn each dimension into one tag key.
- Define the allowed values for each key.
- Decide who is responsible for applying each tag and how you will check it.
A small, stable set of keys
Most organizations get most of the value from four to six keys. A common starting set:
| Key | Answers | Example values | Notes |
|---|---|---|---|
| `Project` | What product or workload is this for? | `checkout`, `search` | Keep values short and stable |
| `Environment` | Is this production or not? | `prod`, `staging`, `dev` | Use a closed list of values |
| `Owner` | Who is accountable? | `payments-team` | Prefer a team or alias over a person |
| `CostCenter` | Which budget pays for it? | `cc-4021` | Match your finance system's codes |
Resist adding a key for every curiosity. Each key you add is one more thing every deployment must set correctly. A key that is only 60% populated gives you a report with a 40% gap.
Know the platform limits
These limits shape the design:
- A resource can carry up to 50 user-defined tags.
- A key can be up to 128 characters. A value can be up to 256 characters.
- Keys and values are case sensitive.
Environmentandenvironmentare different keys, andprodandProdare different values. - The
aws:prefix is reserved for AWS-generated tags. You cannot create or edit keys that start with it. - Not every resource type supports tags, and some charges, such as certain support or tax lines, are never attributable to a tag.
Naming conventions
Pick one convention and document it. Inconsistency does the most damage here, because Cost Explorer treats every spelling as a separate group.
- Key casing. Choose one style, such as
PascalCase(CostCenter), and use it everywhere. Mixed styles (cost-center,CostCenter,costcenter) each show up as a separate activated key. - Value format. Use lowercase with hyphens (
payments-team). Avoid spaces, trailing whitespace and free text. - Closed vocabularies. For keys with a small set of answers, such as
Environment, list the allowed values. For open keys such asProject, keep a registry of valid names. - No sensitive data. Tags appear in billing exports, logs and many APIs. Do not put personal data or secrets in them.
Applying tags consistently
The same tag set should be applied the same way every time. For a single resource the CLI looks like this:
aws ec2 create-tags \
--resources i-0123456789abcdef0 \
--tags Key=Project,Value=checkout Key=Environment,Value=prod Key=Owner,Value=payments-team Key=CostCenter,Value=cc-4021Manual commands do not scale. Prefer these approaches, roughly in order of reliability:
- Infrastructure as code. Set tags in your templates. Many tools let you define default tags once per provider or stack, so every resource inherits them.
- Tag at creation. Many services accept tags in the create call, so the resource is never untagged, even briefly. Tagging afterwards leaves a gap in which charges accrue without a tag.
- Automation for exceptions. Use a scheduled job or an event-driven function to fix resources that slip through.
Tags are not inherited
A tag on one resource does not automatically apply to related resources. A tagged EC2 instance does not tag its EBS volumes, snapshots or network interfaces. Some services copy tags when they create a child resource, and this is often optional. Others do not. For example, an Auto Scaling group can propagate tags to its instances only if you set that on each tag. Check each major service you use, because unpropagated tags are a common source of untagged spend.
Activation and timing
Defining a tag key on resources is not enough. As the activation chapter showed, a key must be activated as a cost allocation tag before it appears in Cost Explorer, and this is done from the management account in an organization:
aws ce update-cost-allocation-tags-status \
--cost-allocation-tags-status TagKey=Project,Status=Active TagKey=Environment,Status=Active TagKey=Owner,Status=Active TagKey=CostCenter,Status=ActivePlan for these timing effects:
- A key can take up to 24 hours to appear after you activate it.
- A key only shows in the console after at least one resource has carried it, so activate keys soon after first use.
- Tag data in cost reports normally reflects the tags a resource had while it accrued charges. Tagging a resource today does not rewrite last month's bill unless you request a backfill, which AWS supports for a limited look-back period. Check the current limits in the billing documentation.
Activate only the keys in your strategy. Activated keys are visible across reports, and an overgrown list makes grouping options harder to use.
Handling shared and untaggable costs
Some spend does not map to a single project: shared networking, a central logging account, or support charges. Decide up front how you will treat it. There are three common options:
- Shared bucket. Tag it with a value such as
Project=shared-platformso it is visible as its own row. - Allocate by rule. Use Cost Categories, covered in a later chapter, to split shared costs by percentage or by another dimension.
- Leave it central. Report it separately and allocate it by policy, outside of tags.
Whichever you choose, write it down. A report where shared costs are explicitly labeled is easier to trust than one where they hide in the untagged group.
Checking that the strategy works
After activation, verify coverage with a grouped query. The untagged group is your measure of success:
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=ProjectSpend with no Project tag comes back in a group whose tag value is empty. Divide that group's cost by the total to get an untagged percentage. Track this number monthly, and set a target such as 90% or more of spend carrying Project and Environment.
Common problems you will see in the first review:
- Several spellings of one value. Fix the source templates, then correct existing resources.
- A key that is never populated. Either enforce it or remove it from the strategy.
- Large untagged rows for one service. Look at whether that service supports tags or propagates them.
- Tags set on the resource, but cost is still empty. Confirm the key is activated and wait for the 24-hour delay.
Governance in brief
A strategy that depends on goodwill decays. Pair it with enforcement: tag policies in AWS Organizations can define allowed keys and values and report non-compliant resources. Service control policies or IAM conditions can require tags on creation. Tag Editor can find and bulk-edit tags. The next chapters on untagged spend and on enforcement and auditing cover these tools. For now, record in your strategy document who owns each key and who reviews compliance.
Exercise
Your Cost Explorer report grouped by the Environment tag shows rows for prod, Prod and production, plus a large empty row. Name two changes to your tagging strategy that would fix this, and explain why activating the tag again would not help.
Show answer
First, define a closed list of allowed values for Environment (for example prod, staging, dev) and apply it in your infrastructure templates, ideally with a tag policy that reports non-compliant values. Then correct the existing resources to use the agreed spelling. Second, apply tags at resource creation through default tags in infrastructure as code, so new resources are not left in the empty group. Activating the key again does nothing, because activation only controls whether the key appears in cost data. The split rows come from different case-sensitive values on the resources, and the empty row comes from resources that have no tag.