Deploy From CI: Paste AWS Keys Into GitHub Secrets?
Your GitHub Actions pipeline needs to deploy to AWS. A teammate wants to paste a long-lived IAM access key into repo secrets. Defend the better option.
Answer key reviewed by Branko Petric
Read first: Secrets and Security in GitHub Actions
Your decision
The deploy job needs AWS permissions. A teammate created an IAM user, generated an access key and secret, and wants to store them as GitHub Actions secrets so the pipeline can deploy. Do you agree, and what do you do instead?
The situation
Your service is deployed to AWS from a GitHub Actions workflow. The deploy job currently fails because it has no AWS credentials. A teammate has created an IAM user named ci-deployer, generated an access key ID and secret access key, and is about to add them as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in the repository's Actions secrets.
Context
The repository is private. The deploy needs to push a container image to ECR and update an ECS service. The teammate attached a broad policy to the IAM user to be safe and avoid permission errors mid-deploy. There is no key rotation process in place yet. The organization has several other repos that could later reuse the same pattern.
Worked interview answers
- DevOps Take Home Assignment: What Reviewers Grade and How to Pass
How to pass a DevOps take home assignment: common task types, what reviewers grade, how to scope the time, a README template, and the review call questions.
- CI/CD Scenario Based Interview Questions: GitHub Actions, Flaky Tests and Bad Deploys
CI/CD scenario based interview questions, worked: a slow pipeline, flaky tests, AWS keys vs OIDC, a hijacked action tag, rollback and manual approval gates.
Related challenges
- Your CI Has Keys to Prod and Pulls Unpinned Deps
CI pulls unpinned dependencies, runs them, and holds prod credentials. A teammate says just add a vulnerability scanner. Defend a real hardening plan.
- A GitHub Action You Use Was Hijacked. Bump the Tag and Move On?
A third-party scanner action your repos pin by tag was hijacked for half a day. A teammate bumped the tag and wants to close the ticket. Defend what you do.
- Tests Pass Locally, Fail in CI. Just Retry?
Your suite is green on your laptop but red in CI. A teammate wants to add a retry and re-run until green. Defend what you actually do.
- Access Keys Are Hardcoded on the EC2 Box. Just Rotate Them?
An app on EC2 authenticates to AWS with long-lived IAM user keys in a config file. One leaked. Defend the real fix.