Created
July 15, 2018 10:31
-
-
Save namuan/6e744de6fb4a48577c5874da0228f8ce to your computer and use it in GitHub Desktop.
Rotate AWS access keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSUSERNAME=<aws-user> | |
AWSPROFILE=<aws-profile> | |
# Get all the access keys currently used. We'll keep note of the one we are trying to rotate | |
aws iam list-access-keys --user-name $AWSUSERNAME | |
# Create a new access key | |
aws iam create-access-key --user-name $AWSUSERNAME | |
# Configure using aws-cli with the values generated from the above command | |
aws configure --profile $AWSPROFILE | |
# Delete the old access key | |
aws iam delete-access-key --access-key-id <old-access-key-id-from-first-command> --user-name AWSUSERNAME | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment