Skip to main content

GitHub Actions with AWS

Let GitHub Actions deploy to AWS using short-lived OpenID Connect credentials instead of repository-stored AWS access keys.

Integration boundary

GitHub's OIDC token can be exchanged through AWS STS for a constrained IAM role when the token claims match the role trust policy.

Supported approaches

OIDC role assumption

Recommended for hosted or self-hosted workflows because no long-lived AWS secret is stored in GitHub.

Static access keys

Supported by tooling but creates a rotation and exfiltration burden; avoid for new deployments.

Prerequisites

  • GitHub OIDC provider configured in AWS IAM
  • An IAM role with a narrowly scoped trust policy
  • Workflow id-token: write permission
  • Pinned or reviewed actions

Implementation

1

Constrain the trust policy

Match the expected repository and branch, tag or environment in the token subject; validate the audience.

2

Grant workflow token permission

Set id-token: write and the minimum repository permissions required by the job.

3

Configure credentials

Use the official AWS credentials action to request the selected role and region.

Verification

1

Print caller identity

Confirm account and assumed-role ARN without exposing credentials.

aws sts get-caller-identity
2

Test an untrusted ref

Verify that a branch or repository outside the trust condition cannot assume the role.

3

Review CloudTrail

Confirm role sessions are attributable to the expected workflow context.

Boundary failures

Common failure modes

  • Trust policy accepts every repository or branch
  • Workflow lacks id-token permission
  • Forked pull request reaches a privileged deployment job
  • Third-party action is referenced by a mutable tag
Engineering signal

Follow GitHub Actions and Amazon Web Services failures and fixes

One useful weekly email with new error references, tools, integration notes and production lessons. No daily noise.