Defining and Enforcing a Tagging Strategy
This lesson explains how a tagging strategy defines mandatory tags, their allowed values and how they are enforced, since cost allocation, access control, automation and operations all depend on consistent tags.
Learning outcomes
After completing this lesson, you will be able to:
- Define a small set of mandatory tags.
- Explain how tag policies, SCPs and IaC checks enforce tags.
- Describe uses of reliable tags beyond cost, such as ABAC and automation.
Defining the tags
A tagging strategy works best with a small set of mandatory tags, each with a clear purpose. CostCenter drives cost allocation and chargeback. Application or Workload groups the resources of one system for cost reporting and operations. Environment distinguishes production from non-production, so schedules, backup plans and guardrails can differ. Owner identifies who is accountable and who receives notifications. DataClassification records sensitivity, which access control and security policies can use. The following table summarises the tags.
| Tag | Used for |
|---|---|
CostCenter | Cost allocation and chargeback |
Application or Workload | Grouping resources, cost reporting, operations |
Environment | Schedules, backup plans, guardrails that differ between production and non-production |
Owner | Accountability and notifications |
DataClassification | Access control and security policies |
Keys and values should follow one convention, including case, because tag keys are case sensitive and costcenter and CostCenter are different tags.
Enforcing tags
Tags are useful only if they are applied consistently, and voluntary tagging never reaches full coverage. Enforcement works at several points. Tag policies in AWS Organizations define the allowed keys, their capitalisation and their permitted values, and, for chosen resource types, prevent tagging operations that do not comply. SCPs deny the creation of resources without the required tags by testing aws:RequestTag and aws:TagKeys in the creation request, which stops untagged resources from existing at all.
Infrastructure as code makes compliance the default: shared modules apply mandatory tags automatically, and the CloudFormation stack-level Tags property propagates tags to every supported resource in a stack. Detection catches what prevention misses: the AWS Config required-tags rule reports non-compliant resources, and Tag Editor finds and fixes them in bulk across Regions.
Tags beyond cost
Once tags are reliable, many processes can select resources by tag rather than by name, so they apply automatically to new resources. Attribute-based access control compares a principal's tags with a resource's tags to grant access. AWS Backup plans and Systems Manager patch groups select resources by tag, so a new database tagged for daily backup is protected from creation. Schedulers stop non-production instances outside working hours by their Environment tag.
Tags used this way become security-relevant. If a tag grants access, anyone who can change it can grant themselves access, so policies must deny modifying or removing such tags except by authorised roles, and must require them at creation.
Making cost allocation tags mandatory
Finance cannot allocate 30% of the bill because resources lack a CostCenter tag. Two preventive controls close the gap. A tag policy defines the allowed values and enforces them for the chosen resource types:
{
"tags": {
"CostCenter": {
"tag_key": { "@@assign": "CostCenter" },
"tag_value": { "@@assign": ["CC-1000", "CC-2000", "CC-4410"] },
"enforced_for": { "@@assign": ["ec2:instance", "ec2:volume", "rds:db", "s3:bucket"] }
}
}
}An SCP refuses to create instances and volumes that arrive without the tag at all:
{
"Sid": "RequireCostCenter",
"Effect": "Deny",
"Action": ["ec2:RunInstances", "ec2:CreateVolume"],
"Resource": ["arn:aws:ec2:*:*:instance/*", "arn:aws:ec2:*:*:volume/*"],
"Condition": { "Null": { "aws:RequestTag/CostCenter": "true" } }
}The tag policy alone does not stop a resource being created untagged; it only rejects non-compliant values. The SCP closes that gap. For existing resources, an AWS Config required-tags rule, deployed as part of a conformance pack, lists the remaining untagged resources so that owners can fix them, and infrastructure as code modules apply the tag by default.
What does a tag policy in Organizations enforce?
Show answer
Consistent tag keys and allowed values. It reports non-compliant tags and can prevent non-compliant tagging operations for chosen resource types.
Exam Tips
Remember for the exam
- Define a small set of mandatory tags with one naming convention; tag keys are case sensitive.
- To standardise tag keys and values, use tag policies.
- To enforce tags at creation, use an SCP with aws:RequestTag and aws:TagKeys.
- To find untagged resources, use Config required-tags rules or Tag Editor.
- Protect tags that are used for access control from modification.