IAM access keys should be rotated at least every 90 days
This check looks at the age of each active IAM user access key in the account. The safe setting is that every active key was created 90 days ago or less, and older keys are replaced.
Why it matters
Long-term IAM access keys do not expire on their own. A key copied into a laptop profile, a build server or a shared document keeps working until somebody removes it. The longer a key lives, the more places it has probably been copied to and the more people have had a chance to see it.
AWS describes how to rotate keys in its guide on updating access keys, and its IAM best practices recommend preferring temporary credentials over long-term keys where possible. Regular rotation limits how long a leaked key remains useful. Rotation also forces you to find every place a key is used, which exposes forgotten integrations.
Where a workload can use a role with temporary credentials instead, removing the key entirely is better than rotating it.
How to check it yourself
Console path: open IAM, then Users, select a user and open the Security credentials tab. The Access keys section shows each key's creation date and last used information. For many users, open IAM, Credential report and download it.
Read-only commands (AWS CLI, run in a test account first):
aws iam generate-credential-report
aws iam get-credential-report --query Content --output text | base64 --decodeIn the CSV, look at access_key_1_active with access_key_1_last_rotated, and the same two columns for key 2. Any active key whose last rotation date is more than 90 days ago fails the check. Generating the report does not change any IAM configuration.
How to fix it
Console steps: on the user's Security credentials tab choose Create access key, store the new key where the workload reads it, update the application, confirm that it works, then set the old key to Inactive and, after a waiting period, delete it. A user can hold two keys at once so rotation can happen without downtime.
Script option (run it yourself with suitable IAM permissions; ConfigCobra itself never changes your AWS account):
aws iam create-access-key --user-name <user-name>
aws iam update-access-key --user-name <user-name> --access-key-id <old-key-id> --status Inactive
aws iam delete-access-key --user-name <user-name> --access-key-id <old-key-id>Store the new secret in a secrets manager rather than in a file, because it is shown only once at creation.
What changes when you fix it
Whatever uses the old key is affected: scripts, build pipelines, third-party tools and developer laptops. Once the old key is made inactive, they get access denied errors until they are given the new key. The user themselves is not affected, and the user's permissions stay the same.
Reduce the risk by checking the key's last used information before deactivating it, deactivating before deleting so the step can be undone, and scheduling the change outside peak hours. Make the owner of each integration responsible for the swap, and note the rotation date so the next one is easy to plan.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Amazon Web Services Foundations v7.0.0 | 2.12 | Level 1 |
Check this on your AWS
ConfigCobra runs this check with every other control of the CIS Amazon Web Services Benchmarks, read-only.