Interview Prep/AWS/IAM, Organizations and Multi-Account

Design access for a CI pipeline in GitHub Actions to deploy to AWS without storing AWS keys in GitHub.

IntermediateScenarioIAM, Organizations and Multi-Account
Answer

Situation read → OIDC federation lets GitHub present a signed token that AWS exchanges for temporary role credentials.

What I'd do →

  1. Create an IAM OIDC provider for token.actions.githubusercontent.com with audience sts.amazonaws.com
  2. Create a deploy role whose trust policy uses sts:AssumeRoleWithWebIdentity and a condition token.actions.githubusercontent.com:sub equal to repo:acme/shop:ref:refs/heads/main
  3. In the workflow set permissions: id-token: write and use aws-actions/configure-aws-credentials with role-to-assume
  4. Scope the role policy to only the resources it deploys

Why → No secret exists to steal, tokens last about an hour, and the sub condition ties the role to one repo and branch.

Interview tip → Call out that a missing sub condition lets any repo on GitHub assume the role.

aws All AWS questions Roadmap: AWS core services

More on IAM, Organizations and Multi-Account