Interview Prep/Python for DevOps/AWS automation with boto3

You want your boto3 code to be testable without moto for pure logic. How do you structure it?

IntermediateScenarioAWS automation with boto3
Answer

Situation read → Separate decisions from API calls.

What I'd do →

  1. Fetch functions return plain data (lists of dicts).
  2. Rule functions take that data and return findings or actions, with no boto3 inside.
  3. Act functions take actions and call APIs.
  4. Test rules with plain dicts in milliseconds; test fetch/act with moto or Stubber.

Why → Most bugs are in the rules, and rules are trivial to test once they do not touch the network.

Interview tip → "Functional core, imperative shell" is the phrase.

All Python for DevOps questions Roadmap: Python for automation

More on AWS automation with boto3