Interview Prep/Python for DevOps/AWS automation with boto3

A boto3 script works locally with your SSO profile but fails in CI with `NoCredentialsError`. What is the plan?

IntermediateScenarioAWS automation with boto3
Answer

Situation read → CI has no profile and no credentials configured.

What I'd do →

  1. Set up GitHub OIDC: an IAM OIDC provider for token.actions.githubusercontent.com and a role trusting your repo and branch.
  2. Add permissions: id-token: write and aws-actions/configure-aws-credentials@v4 with role-to-assume and aws-region.
  3. Remove any profile_name="..." hardcoding from the script; let the default chain pick up env credentials.

Why → OIDC gives short-lived credentials with no secrets to store or rotate.

Interview tip → Mention restricting the trust policy sub claim to repo:org/name:ref:refs/heads/main.

All Python for DevOps questions Roadmap: Python for automation

More on AWS automation with boto3