Interview Prep/AWS/IAM Advanced, STS and Multi-Account

How does GitHub Actions authenticate to AWS without access keys?

IntermediateConceptIAM Advanced, STS and Multi-Account
Answer

You create an IAM OIDC identity provider for token.actions.githubusercontent.com, a role whose trust policy allows sts:AssumeRoleWithWebIdentity for that provider, and conditions that pin aud and sub to your repo and branch/environment. The workflow requests an OIDC token and the aws-actions/configure-aws-credentials action exchanges it.

"Condition": {
  "StringEquals": {"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"},
  "StringLike": {"token.actions.githubusercontent.com:sub": "repo:acme/app:ref:refs/heads/main"}
}

The workflow also needs permissions: id-token: write.

aws All AWS questions Roadmap: AWS core services

More on IAM Advanced, STS and Multi-Account