Tagging Archives - AWS Security Architect https://awssecurityarchitect.com/category/governance/tagging/ Experienced AWS, GCP and Azure Security Architect Wed, 05 Nov 2025 20:10:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 214477604 Retroactive Tagging for AWS Resources https://awssecurityarchitect.com/governance/retroactive-tagging-for-aws-resources/ https://awssecurityarchitect.com/governance/retroactive-tagging-for-aws-resources/#respond Mon, 03 Nov 2025 15:57:08 +0000 https://awssecurityarchitect.com/?p=418   AWS Retroactive Tagging – Enforcement Playbook “Retroactive” tagging (fixing existing resources) usually takes a mix of detection, bulk edit, and guardrails so drift doesn’t come back. Here’s a practical […]

The post Retroactive Tagging for AWS Resources appeared first on AWS Security Architect.

]]>
 

AWS Retroactive Tagging – Enforcement Playbook

“Retroactive” tagging (fixing existing resources) usually takes a mix of detection, bulk edit, and guardrails so drift doesn’t come back. Here’s a practical playbook with concrete AWS-native options you can use right away:

1) Find untagged or wrongly-tagged resources

  • AWS Resource Explorer / Tagging Console (Resource Groups → Tag Editor): search across accounts/Regions; export lists; bulk-apply tags.
  • AWS Resource Groups Tagging API: programmatic inventory of tags across services.
    • GetResources to list by TagFilters; TagResources to apply in bulk across services.
    • Handy for scripts/Lambda to sweep and tag nightly.
  • AWS Config (Detective): enable the managed rule required-tags (or custom rules) to mark resources non-compliant when keys/values are missing.
  • Cost Explorer / CUR (cost allocation tags): turn on Untagged costs and Cost categories to see where spend lacks tags and prioritize remediation.

2) Bulk tag existing resources (the “retroactive” fix)

  • Tag Editor (console): filter → select → apply tags to many resources in one shot.
  • CLI/SDK sweep using Tagging API:
    aws resourcegroupstaggingapi get-resources --resource-type-filters ec2:instance ...
    aws resourcegroupstaggingapi tag-resources --resource-arn-list arn1 arn2 --tags Env=Prod Owner=TeamX
  • Event-driven auto-tagging: EventBridge rule on Create* API calls → Lambda reads CloudTrail event to infer owner/account/OU and backfill tags on the new resource; schedule a nightly sweep for older ones too.
  • AWS Config + SSM Automation remediation: attach an SSM document that, on non-compliance, writes default tags (e.g., CostCenter, Environment) or looks up a CMDB to set accurate values.

3) Enforce going forward (so you don’t have to retro-tag again)

  • SCP deny without mandatory tags (preventive): At the org/OU, block Create* when required tags aren’t supplied.
    {
      "Version": "2012-10-17",
      "Statement": [{
        "Sid": "DenyCreateWithoutTags",
        "Effect": "Deny",
        "Action": ["ec2:RunInstances","rds:CreateDBInstance","s3:CreateBucket","*"],
        "Resource": "*",
        "Condition": {
          "Null": {
            "aws:RequestTag/CostCenter": "true",
            "aws:RequestTag/Environment": "true"
          }
        }
      }]
    }

    Tip: you can also require that specific tag keys exist using aws:TagKeys, and for certain services require propagation (e.g., EC2 TagSpecifications in RunInstances).

  • IAM conditions (fine-grained): on roles used to provision, require tags or specific values:
    "Condition": {
      "ForAllValues:StringEquals": { "aws:TagKeys": ["CostCenter","Environment"] }
    }
  • AWS Organizations Tag Policies (governance, not hard enforcement): define allowed keys/values and get org-wide compliance reports; pairs well with Config for enforcement.
  • AWS Control Tower guardrails (where used): use detective (and when available, proactive) controls tied to tag compliance, plus blueprints that inject mandatory tags via IaC.
  • IaC defaults:
    • CloudFormation: set Tags on stacks/stacksets and use Stack-level Tags so resources inherit.
    • Terraform: use default_tags at provider level; enforce via tflint/policy-as-code (OPA/Conftest).
    • Service Catalog: TagOptions / constraints to force tag keys/values on provisioned products.

4) “Encourage” retro-tagging on existing prod by restricting ops

  • SCP conditional denies on untagged resources: prevent StartInstances, Modify*, or Delete* when aws:ResourceTag/CostCenter is absent. That motivates teams to add tags without fully blocking their ability to create in greenfield.
{
  "Sid": "DenyOpsOnUntagged",
  "Effect": "Deny",
  "Action": [
    "ec2:StartInstances",
    "ec2:ModifyInstanceAttribute",
    "ec2:TerminateInstances"
  ],
  "Resource": "arn:aws:ec2:*:*:instance/*",
  "Condition": { "Null": { "aws:ResourceTag/CostCenter": "true" } }
}

5) Useful “auto-fill” patterns for retro tags

  • Creator/Owner tag from CloudTrail: parse userIdentity and set Owner, CreatorArn, or ProvisioningTool.
  • Env/CostCenter from account or OU: map Account ID → Environment, CostCenter via a lookup (DynamoDB/SSM Parameter Store).
  • Propagate from parents:
    • EC2 from ASG/Launch Template tags
    • EBS from instance tags
    • EKS nodes from cluster tags
    • S3 by org policy + automation script

6) Reporting & accountability

  • Tag Policy compliance reports (per OU/account/service) to track gap closure.
  • Budget filters by tag + Cost Categories that include “Untagged” to show chargeback/showback.
  • Dashboards (QuickSight/Athena over CUR) for “Untagged spend by account/service”.

Quick start recipe (minimal friction)

  1. Turn on Config required-tags across all accounts/Regions.
  2. Use Tag Editor to bulk tag the top 20% cost drivers.
  3. Deploy a Lambda sweep using the Tagging API to fill defaults nightly.
  4. Add a lightweight SCP denying Create* without Environment + CostCenter in dev/sandbox OUs first.
  5. Enable Organizations Tag Policies to standardize values and monitor drift.
  6. Make mandatory tags part of CloudFormation/Terraform scaffolding.

If you want, tell me your mandatory keys (e.g., Environment, Application, CostCenter, Owner), and I’ll draft:

  • an org-ready SCP pack (create + modify + ops-on-untagged),
  • a Config + SSM remediation document, and
  • a Lambda that retro-tags from CloudTrail and an account/OU map.

 

The post Retroactive Tagging for AWS Resources appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/governance/retroactive-tagging-for-aws-resources/feed/ 0 418