Interview Prep/Python for DevOps/Automation scripting & CLI design

You need to compare the live state of 300 Route 53 records against a desired YAML file and report drift. How do you approach it?

AdvancedScenarioAutomation scripting & CLI design
Answer

Situation read → Desired vs actual reconciliation, report-only.

What I'd do →

  1. Load desired records from YAML into a dict keyed by (name, type), normalizing names (trailing dot, lowercase) and sorting values.
  2. Fetch actual with the list_resource_record_sets paginator, normalized the same way.
  3. Compute set differences: missing, extra, changed (compare TTL and sorted values).
  4. Output a diff report (Markdown + JSON) and exit 2 if drift exists.
  5. Recommend moving the zone into Terraform so drift detection is terraform plan.

Why → Normalization is the hard part; without it every record looks drifted.

Interview tip → Mention normalization explicitly; it is what separates a working diff from noise.

All Python for DevOps questions Roadmap: Python for automation

More on Automation scripting & CLI design