Sub topic 2
Tags on AWS resources
Tags are key–value labels attached to AWS resources. A tag key names a category, and its value identifies the resource’s owner or purpose. For example, Project=checkout and Environment=prod can identify production resources for a checkout system.
aws ec2 create-tags \
--resources i-0123456789abcdef0 \
--tags Key=Project,Value=checkout Key=Environment,Value=prodA tagging scheme should use consistent keys and values. Decide whether each tag is required, who owns it, and which values are valid.
AWS-generated and user-defined tags
User-defined tags are created and managed by you. They usually describe business ownership, application, environment, or lifecycle.
AWS-generated tags are created by AWS services. For example, AWS can add a creation-source tag to some resources. Their availability and meaning depend on the service. Do not use an AWS-generated tag as your only ownership control because its behavior is service-dependent.
| Tag type | Created by | Typical use |
|---|---|---|
| User-defined | Your team | Project, team, environment |
| AWS-generated | AWS service | Resource creation or service metadata |
Activating cost allocation tags
A tag on a resource does not automatically make it available in billing reports. User-defined keys must be activated as cost allocation tags. In an AWS Organization, perform activation from the management account.
aws ce update-cost-allocation-tags-status \
--cost-allocation-tags-status \
TagKey=Project,Status=Active \
TagKey=Environment,Status=Active
aws ce list-cost-allocation-tags --status ActiveActivation affects billing data after AWS processes the change. It does not repair missing tags on resources, and it does not guarantee that every AWS charge can be attributed to a tagged resource.
> callout note > Activate stable tag keys, not every temporary key. Renaming a key creates a separate reporting dimension.
Breaking down spend by tag
After activation, select a tag as the grouping dimension in Cost Explorer. For example, grouping by Project separates checkout spend from other project values. Resources without that tag appear in an empty or unallocated group.
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=ProjectThe end date is exclusive. Compare the tag groups with total service cost to find charges that tags do not explain.
Exercise
Why can an EC2 instance tagged Project=checkout still be absent from a Project grouping in Cost Explorer?
Show answer
The tag key may not be activated, billing data may not have processed the activation, or the charge may not be attributable to that resource.