Q: You discover that an IAM access key was accidentally committed to a public GitHub repository. What do you do immediately?
This is a security incident. Move fast — bots scan GitHub and abuse leaked keys within minutes.
Want to master this scenario in a live sandbox? Stephane Maarek's AWS Certified DevOps Engineer Professional Masterclass on Udemy covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "In a previous role, our monitoring paged me for a similar incident across our AWS VPC infrastructure. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix."
Initial Diagnostics & Root Cause Analysis
This is a security incident. Move fast — bots scan GitHub and abuse leaked keys within minutes.
- Immediately deactivate the key — IAM console → Users → find the user → Security credentials → Deactivate the access key.
- Create a new key if needed for the application.
- Check CloudTrail —
aws cloudtrail lookup-events --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=— see what the key was used for, including any unauthorized usage. - Assess the blast radius — what permissions did that user have? Audit anything that was changed.
- Rotate any other credentials the user/app might have touched (DB passwords, etc.).
Remediation & Permanent Safeguards
- Delete the key after deactivating and confirming the new key is working.
- Remove the commit from GitHub (history) and notify the GitHub security team if sensitive data was exposed.
- Post-incident — implement pre-commit hooks (ShieldCommit!) to prevent future secret leaks.
- Immediately deactivate the key — IAM console → Users → find the user → Security credentials → Dea...
- Create a new key if needed for the application.
- Check CloudTrail — aws cloudtrail lookup-events --lookup-attributes AttributeKey=AccessKeyId,Attr...
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Granting wildcard statements ('Action: *', 'Resource: *') in production IAM role trust and policy documents Wildcard IAM grants violate least-privilege principles, allowing unauthorized lateral movement and privilege escalation across accounts.
- Provisioning long-lived IAM access keys instead of federated IAM roles assumed via temporary STS credentials Static long-lived access keys are the primary cause of cloud credential leakage; modern architectures leverage IAM Roles with temporary STS tokens.
- Neglecting VPC NAT Gateway data processing fees and zonal placement when designing outbound egress architectures Routing cross-AZ egress through a single NAT Gateway incurs cross-AZ data transfer fees and introduces a single point of network failure.
- Overlooking AWS CloudTrail management event lag when auditing real-time infrastructure API modifications CloudTrail event delivery typically has a 5-15 minute delivery window; real-time alerting requires EventBridge event bus subscriptions.