Your CI pipeline uses long-lived AWS access keys stored as repository secrets. How do you replace them?
IntermediateScenarioSecrets and Identity Management
Answer
Situation read → Static keys in CI are the most common cloud breach path. OIDC federation removes them completely.
What I'd do →
- Create a GitHub OIDC identity provider in IAM (
token.actions.githubusercontent.com). - Create a role whose trust policy restricts
subto the exact repo and branch or environment:
"Condition": {
"StringEquals": { "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" },
"StringLike": { "token.actions.githubusercontent.com:sub": "repo:acme/orders:environment:prod" }
}
- In the workflow add
permissions: id-token: writeand useaws-actions/configure-aws-credentialswithrole-to-assume. - Run both paths for a week, then delete the IAM user and its keys.
Why → Credentials now last about an hour, are scoped to one repo and environment, and nothing exists to leak.
Interview tip → Mention the sub condition; a wildcard repo:acme/* trust is a common mistake.
More on Secrets and Identity Management
A team stores database passwords in a `.env` file committed to a private repo. How do you migrate them out?BeginnerAn auditor asks how often you rotate database credentials. You currently never do. What do you build?IntermediatePods need AWS access. A developer mounted an IAM user's keys as a Kubernetes Secret. What do you propose instead?BeginnerShould you use Kubernetes Secrets, Sealed Secrets, External Secrets Operator or the Secrets Store CSI driver?IntermediateA Slack webhook URL and a Stripe live key were posted in a public GitHub issue. What is your response sequence?BeginnerHow would you set up HashiCorp Vault so Kubernetes workloads authenticate without any static token?Advanced