Replace GitHub Actions long-lived keys with an OIDC identity provider and IAM role
A company is using GitHub Actions to run a CI/CD pipeline that accesses resources on AWS. The company has an IAM user that uses a secret key in the pipeline to authenticate to AWS. An existing IAM role with an attached policy grants the required permissions to deploy resources. The company’s security team implements a new requirement that pipelines can no longer use long-lived secret keys. A solutions architect must replace the secret key with a short-lived solution. Which solution will meet these requirements with the LEAST operational overhead?
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
GitHub Actions presents a signed OIDC token identifying the repository, workflow, and branch, so IAM can trust that token through an OIDC identity provider and the sts:AssumeRoleWithWebIdentity call issues short-lived credentials scoped to that run, with no stored secret anywhere.
A company runs CI/CD pipelines with GitHub Actions that authenticate to AWS using an IAM user secret key. Security now requires that pipelines stop using long-lived secret keys, and an existing IAM role already holds the needed deployment permissions.
Choosing SAML. GitHub Actions is built around OIDC federation for CI/CD and does not use the older SAML protocol for pipeline authentication, so an IAM SAML identity provider would never be invoked by the pipeline. IAM Roles Anywhere is likewise designed for hosts with no AWS identity, not for a cloud-native CI/CD service.
Community Discussion (3 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
GitHub Actions can supply a signed OpenID Connect identity token that asserts the repository, workflow, and branch. Creating an IAM OIDC identity provider for GitHub and a role whose trust policy permits the sts:AssumeRoleWithWebIdentity call for that provider means the pipeline exchanges the token for short-lived credentials scoped to a single run, and the existing permissions policy is attached to that role so deployment behaviour is unchanged. Because no credential is stored in the repository or pipeline secrets, the long-lived key requirement is satisfied and there is nothing to rotate or leak.Why the Other Options Are Wrong
A: GitHub Actions does not use SAML to authenticate pipelines, so an IAM SAML identity provider would sit unused and the pipeline would still need a stored credential to call AssumeRole. C: An Amazon Cognito identity pool configured for GitHub is a heavier construction that adds a user identity layer the pipeline does not need, since the workload is machine-to-machine federation rather than end-user sign-in, so it fails the least operational overhead requirement. D: IAM Roles Anywhere with a private CA trust anchor is for on-premises hosts, workstations, or devices that have no AWS identity of their own, and it requires running a credential helper process and distributing client certificates, which is far more operational work than OIDC federation.Community Comment Notes
The community voted 100 to 0 for B, and the top-voted comment gave the three reasons succinctly: GitHub does not support the aging SAML protocol, GitHub does support OIDC, and the Cognito and Roles Anywhere options are heavily overengineered for this use case. Another commenter independently ruled out A and D on the basis of the sts:AssumeRole call and confirmed B has the least operational overhead.Official Reference
Related Analysis
Practice All SAP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full SAP-C02 Practice Test →