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.
More on Secrets Management and Identity
Why is hard-coding secrets or putting them in environment variables a problem?BeginnerWhat does HashiCorp Vault provide?BeginnerExplain Vault's seal/unseal process.IntermediateWhat are Vault dynamic secrets and why are they better than static ones?IntermediateHow do Kubernetes workloads authenticate to Vault?AdvancedWhat is AWS Secrets Manager and how does it compare with SSM Parameter Store?Beginner