Interview Prep/DevSecOps/Secrets Management and Identity

How do you configure GitHub Actions to assume an AWS role without keys?

IntermediateConceptSecrets Management and Identity
Answer

Create an IAM OIDC provider for token.actions.githubusercontent.com and a role whose trust policy restricts the sub claim:

"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 needs permissions: id-token: write and uses aws-actions/configure-aws-credentials with role-to-assume. A loose sub wildcard is the common mistake.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets Management and Identity