Replace GitHub Actions long-lived keys with an OIDC identity provider and IAM role
Short answer
B Create an IAM OIDC identity provider for GitHub and have the pipeline assume a role via sts:AssumeRoleWithWebIdentity.
Question
Key Takeaways
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.
Common mistake: 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.
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
This link opens the official vendor documentation in a new tab.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
Dgix 👍 8 Answered BA is incorrect because GitHub doesn't support the aging SAML protocol. B is correct because GitHub does support OIDC. C is hysterically overengineered for this use case. D even more so.
-
AzureDP900 👍 2Option B involves creating an IAM OpenID Connect (OIDC) identity provider in AWS Identity and Access Management (IAM). This will allow the company to use GitHub OIDC authentication, which provides a short-lived token for authentication. The solution also creates a new IAM role with the appropriate trust policy that allows the sts:AssumeRoleWithWebIdentity API call from the GitHub OIDC IdP. This ensures that the pipeline can assume the necessary permissions without using long-lived secret keys.
-
VerRi 👍 1 Answered BA and D are out because of sts:AssumeRole. B with the least operational overhead.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All SAP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full SAP-C02 Practice Test →