skip to content

Teams in your AWS Organization keep launching resources with no `CostCenter` tag, or spelling it `costcenter`. Explain what an AWS Organizations tag policy actually enforces, and how you would prevent untagged resources from being created at all.

level: seniorimportance: should knowfreq 45%

answer

  1. standardise first, block second
  2. report-only until proven
  3. enforced_for is narrow, not universal
  4. null condition on the request tag
  5. Config catches what the gate misses

basics

~20 s

An Organizations tag policy standardises tag keys and allowed values and reports non-compliance; with enforcement enabled for named resource types it blocks non-compliant tagging operations. It never blocks creating an untagged resource — that needs a deny policy on the aws:RequestTag condition key.

solid answer

~60 s

A tag policy is an AWS Organizations policy type you enable in the management account and attach to the root, an OU or an account. It declares the canonical spelling of a key — `CostCenter`, not `costcenter` — and optionally the set of allowed values. On its own it is a *reporting* control: Resource Groups produces an organization-wide compliance report showing which resources deviate. Adding `enforced_for` for specific resource types makes non-compliant tagging operations on those types fail, but even then it only governs tags you are setting; it never stops someone launching a resource with no tags at all. To require a tag at creation you write a deny in an SCP or IAM policy conditioned on `aws:RequestTag/CostCenter` being null, optionally with `aws:TagKeys` to constrain which keys may be used — and you accept that not every service supports tag-on-create condition keys. In practice you layer all three: tag policy for the vocabulary, a deny for the services that support it, and an AWS Config rule such as `required-tags` to catch the rest.

code

json · 9 lines
json
{
  "tags": {
    "costcenter": {
      "tag_key": { "@@assign": "CostCenter" },
      "tag_value": { "@@assign": ["CC-1001", "CC-1002"] },
      "enforced_for": { "@@assign": ["secretsmanager:*"] }
    }
  }
}

go deeper

for a junior

Know that AWS Organizations can define which tag keys and values are allowed, and that a separate permissions policy is what makes a tag mandatory. Being able to name the two mechanisms is enough here.

for a middle

Explain the split precisely: tag policies govern spelling and permitted values and report compliance, while a deny conditioned on a null aws:RequestTag/<key> is what refuses an untagged creation. Mention that enforcement in a tag policy covers only named resource types.

for a senior

Show rollout judgment — report-only first, scope the deny to the resource types that dominate spend, expect breakage from secondary resources and unsupported actions, and back the whole thing with AWS Config detection for what already exists.

for a principal

Own the tradeoff between enforcement friction and allocation coverage. Decide how small the mandatory key set is, who arbitrates new values, whether teams are blocked or merely reported on, and what level of unallocated spend the organization will simply accept.

## Three different controls, often confused Governing tags at organization scale uses three mechanisms that do genuinely different things. Candidates who name only one usually name the wrong one. ### 1. Tag policies — the vocabulary A **tag policy** is a policy type in AWS Organizations (it must be enabled in the management account, and the organization needs all features enabled). You attach it to the root, an OU or a single account, and policies inherit down the tree. What it declares is the *shape* of a tag: the canonical capitalisation of the key, and optionally the list of permitted values. ```json { "tags": { "costcenter": { "tag_key": { "@@assign": "CostCenter" }, "tag_value": { "@@assign": ["CC-1001", "CC-1002"] }, "enforced_for": { "@@assign": ["secretsmanager:*"] } } } } ``` By default this is **advisory**. Nothing is blocked; instead Resource Groups produces an organization-wide compliance report telling you which resources carry a key with the wrong case or a value outside the list. That report is exactly what a cost allocation programme needs, because a mis-cased key silently splits a chargeback report in two. The `enforced_for` element raises it to a **preventive** control, but narrowly: for the resource types you list, a tagging operation that would produce a non-compliant tag fails. Two limits matter. First, it applies only to the resource types you name, and the supported list is service-specific, not universal. Second — and this is the part interviewers probe — it constrains tags you *are* setting; it has nothing to say about a resource created with no tags whatsoever, which is the actual failure mode in a cost allocation programme. ### 2. Deny on the tag-on-create condition keys — the gate To make a tag mandatory you deny the creating action unless the request carries it. The global condition key `aws:RequestTag/<key>` reflects tags supplied *in the request*, and `aws:TagKeys` is the set of keys supplied. ```json { "Effect": "Deny", "Action": "ec2:RunInstances", "Resource": "arn:aws:ec2:*:*:instance/*", "Condition": { "Null": { "aws:RequestTag/CostCenter": "true" } } } ``` Put this in a service control policy to apply it across accounts, or in the roles teams actually use. `Null` with `"true"` means "the key is absent from the request", so this denies any `RunInstances` that does not tag the instance. You can pair it with `"ForAllValues:StringEquals": {"aws:TagKeys": [...]}` to reject unknown keys. The hard part is coverage. Support for tag-on-create condition keys is per service and per action, and it is not universal: some actions do not accept tags at creation at all, and some create secondary resources (volumes, ENIs, snapshots) that the parent call may or may not propagate tags to. Writing one deny per creating action across a whole estate is real work with real breakage risk, which is why most organizations scope it to the handful of expensive resource types that dominate the bill. ### 3. Detection and remediation — the safety net Whatever the gate misses, detection catches. The AWS Config managed rule `required-tags` evaluates resources against a list of keys and flags the non-compliant ones; it can be deployed organization-wide as a conformance pack and wired to an automatic remediation that tags or notifies. This is also where you catch resources created before the policy existed. ## Why this ordering The three layers map to three failure modes. Tag policies fix *inconsistent* tagging, which corrupts reports quietly. Deny policies fix *absent* tagging on the things worth gating, at the cost of friction and breakage when a team hits an action you did not anticipate. Config rules fix *drift and history*, and they are the only one that tells you the size of the problem. A senior answer also says what none of them fix: charges with no taggable resource behind them, and services that do not carry tags through to every billing line. Those need a different allocation mechanism entirely, not a stricter tag policy. ## Rollout advice worth stating Start in report-only mode and read the compliance report before enforcing anything — turning on a deny across an organization you have not measured is how you break a deploy pipeline at 2am. Enforce on new accounts and new OUs first, give teams the compliance report for their own accounts, and only then narrow the deny to the resource types where the money actually is.

  • Why does a tag policy alone not stop an untagged resource being created?
    Because it governs the content of tags, not their presence. It evaluates tagging operations against the declared key spelling and value list, so a request that sets no tags has nothing to be non-compliant about. Absence is a permissions question, which is why you deny the create action on a null `aws:RequestTag/<key>` condition instead.
  • What breaks when you roll a deny-if-untagged policy out across an existing organization?
    Anything that creates resources through an action you did not anticipate — pipelines, autoscaling, services that create secondary resources like volumes or ENIs without propagating tags, and actions whose service does not support tag-on-create condition keys at all. Start in report-only mode, read the compliance data, scope the deny to expensive resource types, and roll out per OU.
  • How would you find resources that predate the policy?
    Detection rather than prevention: the AWS Config managed rule `required-tags` evaluated organization-wide, or a Resource Groups tag compliance report, gives you the existing population. Both can feed a remediation that tags or notifies the owner. A deny policy is blind to anything already created, so this is the only route to historical coverage.

saying these in an interview costs you the question

  • Claims a tag policy blocks untagged resource creation
  • Confuses aws:RequestTag with aws:ResourceTag
  • Enforcing organization-wide before reading the compliance report
  • Assumes every service supports tag-on-create conditions
  • Thinks SCPs can add tags rather than deny actions

context