Skip to content

GitHub cannot assume the AWS role

2 min read · main part only; folded sections are optional

After this you can answer: GitHub cannot assume its AWS role. What do you check before changing permissions?

Diagnostic scenario: Configure AWS credentials fails with the repository’s recorded error, “Not authorized to perform sts:AssumeRoleWithWebIdentity.” No AWS deployment has started.

AWS STS, the service issuing temporary credentials, refused the role exchange. This is Allowed: the role’s trust policy decides who may assume it. It is not a database password or a security group problem. An ECR permission added to the role cannot repair its trust policy.

flowchart TB
A[OIDC login failed] --> B{Job can request token?}
B -->|No| C[Check id-token permission]
B -->|Yes| D{Correct role and account?}
D -->|No| E[Correct GitHub variable]
D -->|Yes| F{Audience and subject match?}
F -->|No| G[Repair exact trust conditions]
F -->|Yes| H[Check provider and recent IAM changes]

Check in this order for this symptom; this is a diagnostic ranking, not measured frequency.

  1. Wrong subject: publish expects main; deploy expects the dev environment. Immutable repository ids also matter.
  2. Wrong role ARN or missing provider in the account selected by the GitHub variable.
  3. Wrong audience, missing id-token: write, or a recent IAM change not yet visible.

GitHub → Actions → failed job: check role selection and environment. IAM → Roles → minitickets-dev-gh-publish or minitickets-dev-gh-deploy → Trust relationships. Both require audience sts.amazonaws.com. Check IAM → Identity providers for GitHub’s issuer.

Correct the specific job variable or exact trust condition in infra/src/cicd.ts → createCicd. Publish uses the branch subject; deploy uses the environment subject. Have the owner apply reviewed trust changes before retrying CD.

Keep the roles separate and compare subject configuration whenever job context changes. Follow OIDC’s immutable-subject case instead of widening trust to every repository.

Advanced: Evidence boundaries

AWS documents the recorded subject and audience fields. A failed exchange may have no response fields. Absence of a CloudTrail event alone does not prove a request succeeded or identify a cause. GitHub settings for required reviewers are external to this repository; an environment subject alone does not prove a human approved the job.

Read this book online: https://book.theversehub.in/