Interview Prep/AWS/IAM and Access Errors

GitHub Actions OIDC fails: `Not authorized to perform sts:AssumeRoleWithWebIdentity`.

IntermediateTroubleshootingIAM and Access Errors
Answer

Likely causes → Trust policy sub or aud conditions mismatch the workflow's token.

Diagnose →

aws iam get-role --role-name gh-deploy --query Role.AssumeRolePolicyDocument
# in workflow print the token claims with a debug step (never in production logs)

Fix →

  1. Align sub with repo:org/repo:ref:refs/heads/main or environment form
  2. Ensure aud equals sts.amazonaws.com
  3. Add id-token: write permission

Prevent → Test trust policy with a staging branch pattern.

aws All AWS questions Roadmap: AWS core services

More on IAM and Access Errors