Skip to content

Instantly share code, notes, and snippets.

@thomaswitt
Created January 31, 2024 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomaswitt/95c0cc2a182c34aca991f188c3290c35 to your computer and use it in GitHub Desktop.
Save thomaswitt/95c0cc2a182c34aca991f188c3290c35 to your computer and use it in GitHub Desktop.
copy-ssh-key-to-all-aws-regions.sh
for region in $(aws ec2 describe-regions --all-regions | jq -r '.Regions | map(.RegionName) | join(" ")'); do echo $region; aws ec2 import-key-pair --region $region --key-name "SSH Key" --public-key-material fileb://<(head -n 1 ~/.ssh/authorized_keys) ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment