Information
Access keys consist of an access key ID and secret access key, which are used to sign programmatic requests to AWS. IAM users require access keys to make programmatic calls via the AWS CLI, SDKs, or APIs. It is recommended that all access keys be rotated regularly and at least every 90 days.
Rotating access keys reduces the window of opportunity for a compromised or exposed key to be used. Regular rotation also limits the risk associated with lost, stolen, or improperly stored credentials.
Solution
Perform the following to rotate access keys:
From Console:
- Sign in to the AWS Management Console and open the IAM console ( https://console.aws.amazon.com/iam )
- Click on Users
- Select the user
- Navigate to Security credentials
Rotate Access Keys:
- Click Create access key
- Update all applications and tools to use the new access key
- After confirming successful use of the new key:
- Deactivate the old key
- Delete the old key when no longer needed
From Command Line:
- Create a new access key:
aws iam create-access-key --user-name <user-name>
- Update all applications and tools to use the new access key
- Check usage of the old key:
aws iam get-access-key-last-used --access-key-id <access-key-id>
- Deactivate the old key:
aws iam update-access-key --access-key-id <access-key-id> --status Inactive --user-name <user-name>
- After confirming no usage, delete the old key:
aws iam delete-access-key --access-key-id <access-key-id> --user-name <user-name>
Impact:
Long-lived access keys increase the risk of unauthorized access if compromised, as they may remain valid indefinitely without detection.