This skill generates a self-contained bash script that safely rotates AWS IAM access keys. The script is designed to be reviewed by the user before execution — Claude should never run the rotation commands directly.
AWS key rotation is a sensitive operation: if done wrong, you can lock yourself out. Generating a script (rather than executing live) lets the user review every step, run it on the machine that actually has the credentials, and abort if anything looks off. The script includes rollback instructions in case the new key fails verification.
~/.aws/credentials for the specified profilests get-caller-identity)iam create-access-key~/.aws/credentials in-place with the new keysts get-caller-identity)iam delete-access-keyWhen the user asks to rotate their AWS keys:
default)scripts/rotate-aws-keys.sh (relative to this skill’s directory)IAM_USER and PROFILE defaults in the script based on the user’s answersbash rotate-aws-keys.sh
or with a specific profile:
bash rotate-aws-keys.sh dev
The generated script requires the following tools to be installed on the user’s machine:
aws CLI (v2 recommended)jq — used to parse the create-access-key JSON responseIf jq is missing, tell the user to install it before running the script:
brew install jqapt install jq or yum install jqThe rotation script creates timestamped backup files (e.g. ~/.aws/credentials.bak.1713000000) before modifying credentials. Over time these accumulate. A cleanup script is bundled at scripts/cleanup-aws-creds-backups.sh.
When the user asks to clean up old credential backups, or after a successful rotation if the user wants to tidy up:
scripts/cleanup-aws-creds-backups.sh (in the same directory as this SKILL.md file)cleanup-aws-creds-backups.shbash cleanup-aws-creds-backups.sh
The script will list all backup files and prompt for confirmation before deleting anything. Deletion is irreversible.
AWS_SHARED_CREDENTIALS_FILE set to a custom path, the script respects that variable automatically — it will look for backups alongside that file, not at ~/.aws/credentials.aws configure set to update credentials in-place, which preserves other profiles in the file.