Skip to content

Instantly share code, notes, and snippets.

@knishioka
Last active December 11, 2020 08:09
Show Gist options
  • Save knishioka/b0c422b912d9dc2a6747294db525c983 to your computer and use it in GitHub Desktop.
Save knishioka/b0c422b912d9dc2a6747294db525c983 to your computer and use it in GitHub Desktop.
Update AWS Access Key by awscli
username=
current_access_key=$(aws configure get aws_access_key_id)
aws=$(aws iam create-access-key --user-name $username)
aws configure set aws_access_key_id $(jq -r '.AccessKey.AccessKeyId' <<< $aws)
aws configure set aws_secret_access_key $(jq -r '.AccessKey.SecretAccessKey' <<< $aws)
aws iam delete-access-key --access-key-id $current_access_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment