Interview Prep/Python for DevOps/AWS automation with boto3

You need to know which IAM permissions your Python tool needs. How do you find the minimum?

AdvancedScenarioAWS automation with boto3
Answer

Situation read → Least privilege for automation roles.

What I'd do →

  1. List every boto3 call in the code; map each to its IAM action (usually service:OperationName, but not always, e.g. list_objects_v2 is s3:ListBucket).
  2. Run the test suite or a sandbox run with CloudTrail and use IAM Access Analyzer policy generation from the CloudTrail activity.
  3. Scope resources and conditions where the API supports it (tag conditions, specific ARNs).
  4. Document the policy in the README and keep it in Terraform.

Why → Generated policies from real activity are accurate; guessing leads to *.

Interview tip → Mention Access Analyzer policy generation by name.

All Python for DevOps questions Roadmap: Python for automation

More on AWS automation with boto3