Interview Prep/Python for DevOps/AWS automation with boto3

You are asked to tag every untagged resource in an account with `Owner=unknown`. What questions do you ask and how do you implement it?

IntermediateScenarioAWS automation with boto3
Answer

Situation read → Bulk change across services; "untagged" and "every" need definitions.

What I'd do →

  1. Ask: which tag keys are required, which resource types, and is unknown a real value or should we find the creator?
  2. Find resources with the Resource Groups Tagging API (get_resources paginator) and filter those missing the key. Note it only returns resources that have, or once had, tags; fully untagged resources may need per-service describes or AWS Config.
  3. Look up creators via CloudTrail (lookup_events for RunInstances) to set a real owner where possible.
  4. Apply with tag_resources in batches of 20 ARNs, dry-run first.
  5. Prevent recurrence with tag policies and SCPs requiring tags on create.

Why → Backfilling once is pointless without enforcement going forward.

Interview tip → Say "find the creator in CloudTrail" before defaulting to unknown.

All Python for DevOps questions Roadmap: Python for automation

More on AWS automation with boto3