That’s why temporary production access with AWS CLI-style profiles isn’t a luxury. It’s a necessity. Permanent credentials are a liability. Static keys get leaked. Long-lived sessions get abused. The safe way is short-lived, scoped, auditable access — and to make it effortless for engineers to do the right thing.
AWS CLI-style profiles make switching credentials quick and natural. You can define each set of keys in ~/.aws/config, then target them with --profile. But for high-stakes environments like production, use them with temporary security credentials from AWS STS. This gives you an expiring profile mapped to a trusted role. No leftover keys. No lingering attack surface.
A common pattern:
- One profile per environment.
- Dev and staging can use static credentials.
- Production uses profiles generated dynamically by
aws sts assume-role. - MFA enforced for every switch to production.
Example profile in ~/.aws/config:
[profile prod-temp]
role_arn = arn:aws:iam::123456789012:role/ProductionAccessRole
source_profile = default
mfa_serial = arn:aws:iam::123456789012:mfa/your-mfa-device
You run: