Exchange a GitHub Actions OIDC token for AWS credentials using AssumeRoleWithWebIdentity

domain: docs.aws.amazon.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In the GitHub Actions workflow, add permissions: id-token: write to the job so the runner can request an OIDC token from GitHub's token endpoint
  2. Create an IAM OIDC identity provider in AWS with the GitHub OIDC issuer URL (https://token.actions.githubusercontent.com) and verify the thumbprint list matches the current GitHub documentation
  3. Create an IAM role with a trust policy that allows sts:AssumeRoleWithWebIdentity from the GitHub OIDC provider, scoping the Condition to sub claim values matching the specific repository or branch (e.g., repo:org/repo:ref:refs/heads/main)
  4. In the workflow, use the official aws-actions/configure-aws-credentials action with the role ARN and region; the action exchanges the OIDC token for temporary STS credentials automatically
  5. Validate the setup by running aws sts get-caller-identity in a subsequent step and confirming the assumed role ARN
  6. Do not store AWS access keys in GitHub secrets; the entire point is to use short-lived credentials — audit your secrets list periodically to catch accidental key storage

Known gotchas

Related routes

Authenticate GitHub Actions to AWS with OIDC (no stored keys)
github-actions · 4 steps · unrated
Build a GitHub Actions composite action that wraps OIDC credential exchange, caches the token in workflow-level outputs, and is consumed by multiple jobs without re-authenticating
GitHub Actions · 6 steps · unrated
Use GitHub Actions OIDC id-token to authenticate to cloud providers without long-lived credentials
docs.github.com/actions/security-for-github-actions/security-hardening-your-deployments · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans