Skip to Content
Cloud Engineering Academy
15. Multi-Account Governance & FinOps

Tagging strategy and tag policies: ownership, cost allocation and enforcement

Design a small mandatory tag set for Harbourline, standardise it with Organizations tag policies, enforce it at creation time with SCPs, Config rules and CDK, activate it for cost allocation, and audit coverage with a C# tool.

intermediate⏱ 1 h 30 min🟢 FreeSCS-C03SAP-C03SOA-C03CLF-C02

Assumes: .NET 10 LTS · AWS SDK for .NET v4 · AWS CLI v2 · CDK v2 (Amazon.CDK.Lib 2.277.0) · Terraform AWS provider v6 · Region us-east-1. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lesson you can:

  • Choose a mandatory tag set (owner, cost centre, application, environment, data classification) and explain what each tag is used for.
  • Write an AWS Organizations tag policy, attach it to an OU, and explain exactly what it does and does not enforce.
  • Combine four layers of enforcement: tag policy (value standardisation), SCP (deny create without tag), AWS Config rule (detect missing tags) and infrastructure as code (apply tags by default).
  • Activate user-defined tags as cost allocation tags in the management account, and explain why activation is not retroactive by default.
  • Audit tag coverage with the Resource Groups Tagging API from C#, and explain the blind spot that API has.

Prerequisites

Why this matters in banking

Three different people ask three questions that all depend on tags.

  • Finance asks: "Which business line spent the 41,000 dollars that appeared under Amazon EC2 last month?" Without a CostCenter tag the answer is "somebody in the payments account" and the chargeback conversation goes nowhere.
  • Security operations asks: "This S3 bucket has customer data in it. Who owns it, and is it classified as confidential?" At 02:00 during an incident, a bucket with no Owner and no DataClassification tag costs real minutes.
  • The auditor asks: "Show me that every production resource that stores personal data is identified as such." A tag set that is applied by code and checked automatically is much stronger evidence than a spreadsheet.

Tags are weak by design. They are free-text labels that anyone with the right permission can change, with case-sensitive keys and values and no built-in "this tag is required" switch. A bank therefore treats tagging as a small control system: a standard, a way to apply it, a way to detect gaps and a way to stop the worst gaps. This lesson builds that system.

Tags are not a security boundary on their own

Tags can drive access decisions (attribute-based access control with aws:ResourceTag and aws:PrincipalTag), but a cost tag such as CostCenter should never be what stops a developer reading a payments database. If a tag is used in an IAM or SCP condition, protect who can change it with an SCP of its own. Keep cost-allocation tags and access-control tags as separate sets, and have your security team review any policy that trusts a tag.

The idea in plain language

A tag is a key and a value attached to a resource, such as CostCenter = CC-4410. Keys and values are both case sensitive: costcenter, CostCenter and Costcenter are three different keys, and your cost report will show three different columns. Most of the pain in real tagging programmes comes from that single fact.

A good tagging strategy answers four questions:

  1. Which tags are mandatory? Keep the list short, because every mandatory tag is a thing people will get wrong. Five is a good ceiling.
  2. What are the allowed values? A free-text Environment tag gives you prod, Prod, production and PRD. A list of allowed values gives you one.
  3. How do tags get onto resources? Ideally never by hand: infrastructure as code applies them, and the pipeline fails when they are missing.
  4. What happens when they are missing? Detect, report, nag the owner, and for the most important resource types prevent creation.

Analogy: tags are the asset labels in a bank branch. Every laptop has a barcode sticker with an owner and a cost centre. The facilities policy (tag policy) says what the stickers must look like; the purchasing rule (SCP) says you cannot take delivery of a laptop without a sticker; the quarterly stock-take (Config) finds the ones that slipped through; and the supplier who prints the stickers before the laptop arrives (infrastructure as code) means almost none slip through at all.

Harbourline's tag standard

Tag keyExample valueUsed forAllowed values
CostCenterCC-4410Cost allocation, showback and chargebackPattern CC- plus four digits, maintained by Finance
Applicationaccounts-apiGrouping resources by system, incident response, FinOps reportsRegistered application names
EnvironmentprodSeparating production from the restprod, staging, dev, sandbox, learn
Ownerpayments-platform-teamWho to contact, who approves a changeA team name from the directory, not a person's email
DataClassificationconfidentialEvidence for GDPR / UK GDPR data mapping; drives encryption and retention checkspublic, internal, confidential, restricted

The lab convention in this course's CONVENTIONS.md (Project, Lab, Environment, Owner) is the learner-sandbox version of the same idea. In a real bank, the standard above would be the starting point and security, finance and platform teams would agree it together.

Two design rules save pain later:

  • Use team names, not people's names, for Owner. People move teams. A tag that names a person is stale within a year, and a personal email address is also personal data sitting in a billing report.
  • Do not put anything sensitive in a tag. Tags appear in billing exports, in the console and in many logs. Never put a customer identifier, a secret or a free-text reason into a tag value.

What problem the AWS service solves

AWS offers several tools. Each does one job, and none does all of them.

ToolWhat it doesWhat it does not do
Tag policy (AWS Organizations)Defines the tag keys, capitalisation and allowed values for the organisation, an OU or an account; reports non-compliant tags; optionally blocks non-compliant tagging operations for chosen resource typesDoes not make a tag mandatory. Resources with no tag, and tags not defined in the policy, are not evaluated
SCP deny with a tag conditionBlocks creation of a resource when a required tag is not in the requestOnly works for API actions that support tagging at creation; can break automation that tags after creation
AWS Config required-tags ruleDetects resources missing required tags and can trigger remediationDetects after the fact; limited to the resource types Config records and the rule supports
Infrastructure as code defaultsApplies tags to everything in a stack (CDK Tags.Of, Terraform default_tags)Only covers resources created by that code
Cost allocation tag activationMakes a tag a column in Cost Explorer, Budgets and billing exportsApplies from the activation date; does not fix resources that are untagged
Resource Groups Tagging API / Tag EditorSearches and bulk-edits tags across services and Regions; produces compliance reports against tag policiesReturns resources that have, or have previously had, tags; a resource that was never tagged may not show up

Honest limitations to remember:

  • Tag policies need all features enabled in the organisation and are managed from the management account (or a delegated administrator, ⚠ VERIFY current delegation support).
  • Not every resource type supports tags, and not every one supports enforcement by a tag policy. The enforcement list of supported resource types is service-by-service. ⚠ VERIFY the resource types you rely on in the Organizations documentation.
  • Tag limits: a resource normally holds up to 50 user-defined tags, keys up to 128 characters and values up to 256, and the aws: prefix is reserved. ⚠ VERIFY, because some services have their own limits.
  • Not every charge is taggable. Data transfer, support fees, taxes and some shared services appear in the bill with no tag. Plan a "shared and untagged" bucket in your showback report. The next lessons cover how to allocate it.

Microsoft / Azure comparison

You know (Microsoft/Azure)AWS equivalentWhat's different
Azure tags on resources and resource groupsAWS tags on resources onlyThere is no resource group that tags its children; use IaC default tags or a tag policy
Azure Policy Require a tag on resources (deny)SCP with a Null condition on aws:RequestTag/...The SCP only works for actions that accept tags on create; Azure Policy works at resource-provider level
Azure Policy Inherit a tag from the resource group (modify)No direct equivalent. IaC default tags or a Config auto-remediationAWS never silently rewrites a resource for you
Azure Policy allowed values for a tagOrganizations tag policy tag_value listTag policy also standardises key capitalisation
Tag inheritance in Cost ManagementCost allocation tags and cost categories; account-level tags in the organisationActivate tags first; a cost category can group by account, tag or service
Azure Resource Graph for tag queriesResource Explorer, Tag Editor, Resource Groups Tagging API, Config advanced queriesDifferent tools for different services and Regions
Management group policy assignmentTag policy attached to root, OU or accountPolicies inherit down the OU tree and merge into an effective policy

Architecture

Security-boundary view: the management account owns the policies and cost tag activation, workload accounts cannot detach an SCP or tag policy, and the central reporting happens in a security or FinOps account with read-only access. A tag policy is only as strong as the people who can edit it, so restrict organizations:*Policy* actions to a small platform role.

Step-by-step implementation

Agree the standard

Write the five tags, their allowed values and the owner of each list into a short document. Get Finance (for CostCenter) and Security (for DataClassification) to approve it. This takes longer than the technical steps and matters more.

Enable tag policies and create the policy

In the management account, enable the TAG_POLICY policy type on the organisation root, then create a tag policy that defines the five keys with allowed values. Start with no enforcement: let the compliance report show you how bad things are.

Attach to a test OU first

Attach the policy to the Sandbox OU (or one test account), run the compliance report and look at the noise. Only after the results make sense attach it to Workloads.

Apply tags from code

Set default tags in CDK and Terraform so new resources are born compliant. Add a pipeline check that fails the build when a required tag is missing.

Add the detection layer

Deploy the Config required-tags rule (or conformance pack equivalent) across accounts so gaps in click-ops resources are found.

Add the prevention layer, carefully

For a small number of high-value resource types (EC2 instances, RDS databases, S3 buckets), add an SCP that denies creation without CostCenter and Owner. Test it in Sandbox first, because an SCP that blocks a service that tags after creation will break deployments.

Activate cost allocation tags

Activate CostCenter, Application, Environment and Owner as cost allocation tags in the management account. From that point they are columns in Cost Explorer, Budgets and the exports covered in later lessons.

Report and chase

Run the audit tool weekly, send each owner their untagged resources, and track the percentage of cost that is tagged. A common target is above 90 percent of spend attributable to a cost centre. ⚠ VERIFY your own firm's target.

AWS Console instructions

  • Enable tag policies: Console (management account) → AWS Organizations → Policies → Tag policies → Enable tag policies.
  • Create a policy: Tag policies → Create policy. Use the visual editor to add each tag key and allowed values, or paste JSON. In the editor, the checkbox Prevent non-compliant operations for this tag with a resource type list is the enforcement switch. Leave it off at first.
  • Attach: open the policy → Targets → Attach policy → choose the OU or account.
  • See the effective policy: Organizations → AWS accounts → select an account → Policies → Effective tag policy (wording ⚠ VERIFY).
  • Compliance report: Console → Resource Groups & Tag Editor → Tag policies (in the account) for one account, or generate an organisation report from the management account. ⚠ VERIFY the console path, which has moved over time.
  • Activate cost allocation tags: Console → Billing and Cost Management → Cost allocation tags → User-defined cost allocation tags, select the keys and choose Activate. A key only appears in this list after it has been used on a resource in an account of the organisation. Activation can take up to 24 hours to take effect. ⚠ VERIFY the delay.

AWS CLI

# 1) Find the organisation root ID (run in the management account).
aws organizations list-roots --profile learn-mgmt --query 'Roots[0].Id' --output text

# 2) Enable the tag policy type on the root. Replace r-abcd with your root ID.
aws organizations enable-policy-type --root-id r-abcd --policy-type TAG_POLICY --profile learn-mgmt

# 3) Create the policy from a JSON file (shown below).
aws organizations create-policy \
  --name hl-tag-standard \
  --description "Harbourline mandatory tag keys and values" \
  --type TAG_POLICY \
  --content file://tag-policy.json \
  --profile learn-mgmt

# 4) Attach it to an OU (replace the policy ID and OU ID).
aws organizations attach-policy --policy-id p-abc123 --target-id ou-abcd-11111111 --profile learn-mgmt

# 5) Show the policy that actually applies to one account (inheritance merged).
aws organizations describe-effective-policy --policy-type TAG_POLICY \
  --target-id 111122223333 --profile learn-mgmt

# 6) Ask the Tagging API how many resources are non-compliant with the tag policy.
aws resourcegroupstaggingapi get-compliance-summary \
  --group-by TARGET_ID --region us-east-1 --profile learn-sandbox

# 7) Start an organisation-wide compliance report into an S3 bucket (management account).
aws resourcegroupstaggingapi start-report-creation \
  --s3-bucket hl-tag-reports-111122223333 --region us-east-1 --profile learn-mgmt

# 8) Activate cost allocation tags (management account).
aws ce update-cost-allocation-tags-status \
  --cost-allocation-tags-status TagKey=CostCenter,Status=Active TagKey=Owner,Status=Active \
  TagKey=Application,Status=Active TagKey=Environment,Status=Active \
  --region us-east-1 --profile learn-mgmt

# 9) Check which tags are active.
aws ce list-cost-allocation-tags --status Active --region us-east-1 --profile learn-mgmt

The tag policy for step 3:

tag-policy.json
{
  "tags": {
    "CostCenter": {
      "tag_key": { "@@assign": "CostCenter" },
      "tag_value": { "@@assign": ["CC-4410", "CC-4420", "CC-5100", "CC-9000"] }
    },
    "Environment": {
      "tag_key": { "@@assign": "Environment" },
      "tag_value": { "@@assign": ["prod", "staging", "dev", "sandbox", "learn"] },
      "enforced_for": { "@@assign": ["ec2:instance"] }
    },
    "DataClassification": {
      "tag_key": { "@@assign": "DataClassification" },
      "tag_value": { "@@assign": ["public", "internal", "confidential", "restricted"] }
    },
    "Owner": {
      "tag_key": { "@@assign": "Owner" }
    },
    "Application": {
      "tag_key": { "@@assign": "Application" }
    }
  }
}

Reading it: each top-level entry names a tag. @@assign sets a value outright (child policies in the OU tree can use @@append or @@remove to modify what a parent set). tag_value restricts allowed values. enforced_for makes a non-compliant tagging operation fail, here only for EC2 instances. Wildcards are supported in some places, such as ec2:*, and several services support enforcement while many do not. ⚠ VERIFY the supported types before you rely on enforcement. Note that Owner and Application define only the key (and its capitalisation) with no value list, which is correct for free-text values.

Infrastructure as Code

This stack, deployed in the management account, creates the tag policy, an SCP that denies creating EC2 instances and RDS databases without the CostCenter and Owner tags, and activates cost allocation tags. A second snippet shows the workload side: default tags for every resource in the app. L1 constructs are used for Organizations, and a custom resource calls Cost Explorer because Amazon.CDK.Lib 2.277.0 has no L1 construct for cost allocation tags (the stack compiles against that version; the custom resource runs only on deploy). ⚠ VERIFY runtime behaviour; the Terraform tab has a native resource

TagGovernanceStack.cs
using System.Collections.Generic;
using Amazon.CDK;
using Amazon.CDK.AWS.Organizations;
using Amazon.CDK.CustomResources;
using Constructs;

namespace Harbourline.Governance.Infra;

public sealed class TagGovernanceStack : Stack
{
    public TagGovernanceStack(Construct scope, string id, string workloadsOuId, IStackProps? props = null)
        : base(scope, id, props)
    {
        // Applies Project/Environment/Owner to the stack's own taggable resources.
        Amazon.CDK.Tags.Of(this).Add("Project", "cea-lab");
        Amazon.CDK.Tags.Of(this).Add("Environment", "learn");

        // --- Tag policy: keys, capitalisation and allowed values -----------------------------
        var tagPolicy = new Dictionary<string, object>
        {
            ["tags"] = new Dictionary<string, object>
            {
                ["CostCenter"] = new Dictionary<string, object>
                {
                    ["tag_key"] = new Dictionary<string, object> { ["@@assign"] = "CostCenter" },
                    ["tag_value"] = new Dictionary<string, object>
                    {
                        ["@@assign"] = new[] { "CC-4410", "CC-4420", "CC-5100", "CC-9000" },
                    },
                },
                ["Environment"] = new Dictionary<string, object>
                {
                    ["tag_key"] = new Dictionary<string, object> { ["@@assign"] = "Environment" },
                    ["tag_value"] = new Dictionary<string, object>
                    {
                        ["@@assign"] = new[] { "prod", "staging", "dev", "sandbox", "learn" },
                    },
                    ["enforced_for"] = new Dictionary<string, object> { ["@@assign"] = new[] { "ec2:instance" } },
                },
                ["Owner"] = new Dictionary<string, object>
                {
                    ["tag_key"] = new Dictionary<string, object> { ["@@assign"] = "Owner" },
                },
            },
        };

        new CfnPolicy(this, "TagStandard", new CfnPolicyProps
        {
            Name = "hl-tag-standard",
            Description = "Harbourline mandatory tag keys and values",
            Type = "TAG_POLICY",
            Content = tagPolicy,
            TargetIds = new[] { workloadsOuId },
        });

        // --- SCP: deny creating key resource types without CostCenter and Owner ---------------
        var scp = new Dictionary<string, object>
        {
            ["Version"] = "2012-10-17",
            ["Statement"] = new object[]
            {
                new Dictionary<string, object>
                {
                    ["Sid"] = "DenyEc2WithoutMandatoryTags",
                    ["Effect"] = "Deny",
                    ["Action"] = new[] { "ec2:RunInstances" },
                    ["Resource"] = new[] { "arn:aws:ec2:*:*:instance/*" },
                    ["Condition"] = new Dictionary<string, object>
                    {
                        ["Null"] = new Dictionary<string, object>
                        {
                            ["aws:RequestTag/CostCenter"] = "true",
                        },
                    },
                },
                new Dictionary<string, object>
                {
                    ["Sid"] = "DenyRdsWithoutOwner",
                    ["Effect"] = "Deny",
                    ["Action"] = new[] { "rds:CreateDBInstance", "rds:CreateDBCluster" },
                    ["Resource"] = "*",
                    ["Condition"] = new Dictionary<string, object>
                    {
                        ["Null"] = new Dictionary<string, object>
                        {
                            ["aws:RequestTag/Owner"] = "true",
                        },
                    },
                },
            },
        };

        new CfnPolicy(this, "RequireTagsScp", new CfnPolicyProps
        {
            Name = "hl-require-mandatory-tags",
            Description = "Deny create without CostCenter / Owner (Workloads OU). Test in Sandbox first.",
            Type = "SERVICE_CONTROL_POLICY",
            Content = scp,
            TargetIds = new[] { workloadsOuId },
        });

        // --- Cost allocation tags: activate once the keys exist on resources -------------------
        // There is no L1 construct for this in Amazon.CDK.Lib 2.277.0 (checked at compile time),
        // so a custom resource calls the Cost Explorer API. Cost Explorer's endpoint is in us-east-1.
        new AwsCustomResource(this, "ActivateCostTags", new AwsCustomResourceProps
        {
            OnCreate = new AwsSdkCall
            {
                Service = "CostExplorer",
                Action = "updateCostAllocationTagsStatus",
                Region = "us-east-1",
                Parameters = new Dictionary<string, object>
                {
                    ["CostAllocationTagsStatus"] = new object[]
                    {
                        new Dictionary<string, object> { ["TagKey"] = "CostCenter", ["Status"] = "Active" },
                        new Dictionary<string, object> { ["TagKey"] = "Application", ["Status"] = "Active" },
                        new Dictionary<string, object> { ["TagKey"] = "Environment", ["Status"] = "Active" },
                        new Dictionary<string, object> { ["TagKey"] = "Owner", ["Status"] = "Active" },
                    },
                },
                PhysicalResourceId = PhysicalResourceId.Of("hl-cost-allocation-tags"),
            },
            Policy = AwsCustomResourcePolicy.FromStatements(new[]
            {
                new Amazon.CDK.AWS.IAM.PolicyStatement(new Amazon.CDK.AWS.IAM.PolicyStatementProps
                {
                    Actions = new[] { "ce:UpdateCostAllocationTagsStatus" },
                    Resources = new[] { "*" },
                }),
            }),
        });
    }
}

On the workload side, one line in the CDK app applies default tags to every taggable construct, which is how resources are born compliant:

Program.cs (workload app)
using Amazon.CDK;
using Harbourline.Accounts.Infra;

var app = new App();
var stack = new AccountsApiStack(app, "hl-accounts-api-prod");

// Everything under the app inherits these tags. Values come from CI variables, never from code.
Amazon.CDK.Tags.Of(app).Add("CostCenter", "CC-4410");
Amazon.CDK.Tags.Of(app).Add("Application", "accounts-api");
Amazon.CDK.Tags.Of(app).Add("Environment", "prod");
Amazon.CDK.Tags.Of(app).Add("Owner", "payments-platform-team");
Amazon.CDK.Tags.Of(app).Add("DataClassification", "confidential");

app.Synth();

Complete code

A C# console tool that audits tag coverage in one account and Region using the Resource Groups Tagging API. For each resource it checks the five mandatory keys and prints a summary and a CSV of gaps. It uses only read permissions (tag:GetResources).

TagAudit.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <!-- Look up exact 4.x versions at https://api.nuget.org/v3-flatcontainer/<id>/index.json -->
    <PackageReference Include="AWSSDK.ResourceGroupsTaggingAPI" Version="4.*" />
  </ItemGroup>
</Project>
Program.cs
using System.Text;
using Amazon;
using Amazon.ResourceGroupsTaggingAPI;
using Amazon.ResourceGroupsTaggingAPI.Model;

// Mandatory keys from the Harbourline tag standard.
string[] required = ["CostCenter", "Application", "Environment", "Owner", "DataClassification"];

string profileRegion = Environment.GetEnvironmentVariable("AWS_REGION") ?? "us-east-1";
using var client = new AmazonResourceGroupsTaggingAPIClient(RegionEndpoint.GetBySystemName(profileRegion));

var gaps = new List<(string Arn, string Service, string[] Missing)>();
int total = 0;
string? token = null;

do
{
    var response = await client.GetResourcesAsync(new GetResourcesRequest
    {
        ResourcesPerPage = 100,
        PaginationToken = token,
    });

    foreach (var mapping in response.ResourceTagMappingList ?? [])
    {
        total++;
        var keys = (mapping.Tags ?? []).Select(t => t.Key).ToHashSet(StringComparer.Ordinal);
        var missing = required.Where(r => !keys.Contains(r)).ToArray();
        if (missing.Length > 0)
        {
            // ARN format: arn:partition:service:region:account:resource
            var service = mapping.ResourceARN.Split(':').ElementAtOrDefault(2) ?? "unknown";
            gaps.Add((mapping.ResourceARN, service, missing));
        }
    }

    token = string.IsNullOrEmpty(response.PaginationToken) ? null : response.PaginationToken;
}
while (token is not null);

Console.WriteLine($"Region {profileRegion}: {total} tagged-or-previously-tagged resources checked.");
Console.WriteLine($"Resources missing at least one mandatory tag: {gaps.Count} ({(total == 0 ? 0 : 100.0 * gaps.Count / total):F1}%)");
Console.WriteLine();

foreach (var group in gaps.GroupBy(g => g.Service).OrderByDescending(g => g.Count()))
{
    Console.WriteLine($"  {group.Key,-20} {group.Count(),5} resources with gaps");
}

var csv = new StringBuilder("arn,service,missing\n");
foreach (var (arn, service, missing) in gaps)
{
    csv.Append('"').Append(arn).Append("\",").Append(service).Append(",\"").Append(string.Join(';', missing)).Append("\"\n");
}
await File.WriteAllTextAsync("tag-gaps.csv", csv.ToString());
Console.WriteLine("\nWrote tag-gaps.csv");

Code explained line by line

  1. string[] required = [...] is the standard as data. In a real tool you would load it from the same JSON as the tag policy so the two cannot drift.
  2. The client is created for one Region. The Tagging API is regional, so a full audit loops over enabled Regions. Remember that your region-restricting SCP means most Regions are empty.
  3. The do ... while loop follows PaginationToken. The API returns a page and a token, and an empty token means the last page.
  4. In SDK v4 a missing collection is null rather than an empty list, so the code uses ?? [].
  5. keys is a case-sensitive set (StringComparer.Ordinal), matching how AWS treats tag keys. A resource tagged costcenter is reported as missing CostCenter, which is exactly what you want to surface.
  6. The service name comes from splitting the ARN on :. Index 2 is the service segment of every ARN.
  7. The CSV is the artefact you send to owners. Keep it out of source control, because ARNs include account IDs.

The blind spot. GetResources returns resources that are tagged or were previously tagged. A resource that has never had a tag may not appear at all, so a clean report from this tool is not proof of full coverage. Pair it with the Config required-tags rule or a Config advanced query, which reads the recorded inventory, and with Cost Explorer's "no tag" group for the spending view.

Security considerations

⚠ Learning shortcut — not for production

The lab attaches the policies to a single OU, uses a short allowed-values list typed into the policy, and runs the audit with your own SSO session. In production, the allowed values for CostCenter come from Finance's master data and are synchronised by a pipeline; policy changes go through pull request review with a security approver; the audit runs as a read-only role from a security or FinOps account; and the SCP is staged through Sandbox, then Dev, then Production with a break-glass role excluded by an ArnNotLike condition on aws:PrincipalArn.

  • Protect the tags that carry meaning. If any policy uses aws:ResourceTag/DataClassification, add a deny for tag:TagResources, ec2:CreateTags and similar actions that change that key unless the caller is a governance role.
  • SCP blast radius. A deny on ec2:RunInstances with a tag condition also blocks Auto Scaling, EMR and Batch launches that do not pass tags in the launch request. Test those paths, or exempt service-linked roles.
  • Privacy. A tag value is metadata visible to anyone with billing or tag read access. Do not use customer names, account numbers or personal emails. For UK GDPR data-mapping, a DataClassification tag is a helpful pointer, but your data inventory (record of processing activities) remains a legal and compliance document owned by your data protection officer.
  • Auditability. Tag policy changes and tag changes appear in CloudTrail (CreatePolicy, AttachPolicy, TagResource events). Keep them in the central log archive covered earlier in this module.

Banking use case

Harbourline's finance team wants monthly showback per business line. The platform team publishes the five-tag standard, attaches the tag policy to the Workloads OU in report-only mode and deploys the Config rule everywhere. The first report finds 38 percent of EC2 and RDS resources missing CostCenter. Most are created by an old Terraform module with no default tags, and a few are console-created test instances. Within a month the module is fixed, the owners of the strays are chased, and the SCP is switched on for EC2 and RDS creation in Workloads. The tagged-spend percentage in the weekly FinOps report moves from 62 to 94, and the monthly showback email becomes automatic. The same tags then give security operations an owner to page for any bucket flagged by Macie.

Common mistakes

  • Treating the tag policy as a requirement. It is not: untagged resources are ignored. Add the SCP, Config rule and IaC layers.
  • Turning on enforcement for everything on day one. Pipelines and services that tag after creation start failing. Report first, enforce later and only for chosen types.
  • Forgetting to activate cost allocation tags. Tags exist on resources but the cost report has no column for them. Activation is a separate step in the management account.
  • Expecting activation to fix history. By default it applies from activation onward. AWS has added a backfill capability for cost allocation tags, but check the current documentation and limits. ⚠ VERIFY
  • Mixed capitalisation. Environment=Prod and Environment=prod split a cost report. Use the allowed values list.
  • Tagging people. Personal emails in Owner age badly and leak personal data into billing exports.
  • Letting IaC and manual tags fight. Terraform removes tags it does not know about on the next apply unless you use default_tags and ignore_tags carefully.

Troubleshooting

SymptomLikely causeFix
PolicyTypeNotEnabledException when creating a tag policyThe TAG_POLICY type is not enabled on the rootRun enable-policy-type first; check that all features are enabled in the organisation
Tag key not offered in Cost allocation tagsThe key has not yet been used on a resource in the organisation, or you are in a member accountTag one resource, wait, and activate from the management account
Cost Explorer shows no values for an activated tagActivation takes effect up to 24 hours later and only applies to usage from then onWait, check the date range, and consider the backfill option ⚠ VERIFY
Tagging a resource fails with a tag policy errorThe enforced_for setting blocked a non-compliant valueUse a value from the policy, or remove enforcement for that resource type
SCP blocks Auto Scaling or a managed service launching instancesThe service launches resources without passing the required tag in the create requestTag via the launch template, or carve the service-linked role out of the SCP
Audit tool reports zero resources in a busy accountWrong Region, or the resources have never been taggedCheck AWS_REGION, then use Config advanced queries for the real inventory
Compliance report shows noise from old resourcesThe policy was attached to a broad OU before cleaning upScope to a test OU, fix, then widen

Cost and cleanup

Cost: free. Organizations, tag policies and SCPs have no charge. Activating cost allocation tags has no charge. The Resource Groups Tagging API has no charge. AWS Config rules cost money per evaluation and per configuration item recorded, so run the Config part only for a short session and see the Config lesson for the pricing detail. The compliance report stores a small CSV in S3 (cents). Cost Explorer API calls made from the CLI are charged a small amount per request. ⚠ VERIFY the current rate.

Teardown (management account), in this order:

# Detach the policies from the OU, then delete them.
aws organizations detach-policy --policy-id p-abc123 --target-id ou-abcd-11111111 --profile learn-mgmt
aws organizations delete-policy --policy-id p-abc123 --profile learn-mgmt

# Optional: switch the policy type off again.
aws organizations disable-policy-type --root-id r-abcd --policy-type TAG_POLICY --profile learn-mgmt

# Deactivate cost allocation tags if this was only a lab.
aws ce update-cost-allocation-tags-status \
  --cost-allocation-tags-status TagKey=CostCenter,Status=Inactive TagKey=Owner,Status=Inactive \
  --region us-east-1 --profile learn-mgmt

# Empty and delete the report bucket, then delete the Config rule if you deployed it.
aws s3 rb s3://hl-tag-reports-111122223333 --force --profile learn-mgmt
aws configservice delete-config-rule --config-rule-name hl-required-tags --profile learn-sandbox

# Confirm nothing from the lab remains.
aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=cea-lab \
  --region us-east-1 --profile learn-sandbox --query 'ResourceTagMappingList[].ResourceARN'

Exercises

  • 🟢 Guided: write the five-tag standard for your own portfolio project, create a tag policy with allowed values for Environment, attach it to a Sandbox OU and run describe-effective-policy on a sandbox account.
  • 🟡 Challenge: add a CDK Aspect or a Terraform precondition that fails the build when a stack has no CostCenter. Then explain why the SCP and the pipeline check are both needed.
  • 🔴 Live problem: finance says 30 percent of last month's EC2 and RDS spend is "unattributed", and the SCP you propose would block the data-science team's Auto Scaling groups. Write a one-page plan covering detection, a rollout order, an exception for the data-science team and how you will measure improvement.

Assignment

Produce a governance/tagging/ folder for your portfolio repository containing the tag standard (Markdown), the tag policy JSON, the SCP JSON with a test plan, the CDK or Terraform code, and the audit tool. Add a short README explaining which layer catches which failure.

Solutions

Knowledge check

Interview questions

  • How would you roll out mandatory tagging in an organisation of 80 accounts? Agree the standard first, report-only tag policy on a test OU, IaC default tags, a detection rule, then prevention SCPs for a few resource types, staged by OU with a break-glass exception. Measure tagged-spend percentage weekly.
  • What is the difference between a tag policy and an SCP for tags? A tag policy standardises keys and values and can block non-compliant tagging operations for some resource types. An SCP can deny creating a resource when a tag is missing. Only the SCP (or other controls) can make a tag mandatory.
  • Why might tag-based cost reports be wrong even with perfect tagging? Untaggable costs, shared services, activation delay and capitalisation differences. A mature FinOps practice allocates shared cost with rules (cost categories, split cost allocation) and reports the unallocated remainder openly.
  • How would you find untagged resources in a multi-account organisation? Config aggregator advanced queries for the inventory, the Tagging API compliance report for tag policy compliance, Cost Explorer grouped by tag for spend.

Certification practice

Completion checklist

  • I can explain in two sentences why a tag policy does not make tags mandatory
  • I wrote a five-tag standard with allowed values and owners
  • I created and attached a tag policy to a test OU and read the effective policy
  • I ran the audit tool and understand its blind spot
  • I ran the cleanup steps and confirmed no lab resources remain

Key takeaways

  • A small, agreed, mandatory tag set beats a long wish-list. Five tags with controlled values is enough.
  • Layer the controls: tag policy (standardise), IaC (apply), Config (detect), SCP (prevent), activation (report).
  • Tag policies standardise tags that exist. They do not require tags to exist.
  • Cost allocation tags are activated in the management account and apply going forward.
  • Tags are metadata, not secrets and not (alone) a security boundary.

Further reading

Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page