Skip to content

Instantly share code, notes, and snippets.

@mafonso
Last active October 10, 2023 05:19
Show Gist options
  • Save mafonso/7ee51981581f544ed52c to your computer and use it in GitHub Desktop.
Save mafonso/7ee51981581f544ed52c to your computer and use it in GitHub Desktop.
List Access Keys for all IAM users
for user in $(aws iam list-users --output text --no-cli-pager | awk '{print $NF}'); do
aws iam list-access-keys --user $user --output text --no-cli-pager
test $? -gt 128 && exit
done
for user in $(aws iam list-users --output text --no-cli-pager| awk '{print $NF}'); do aws iam list-access-keys --user $user --output json --no-cli-pager; done | jq
@mafonso
Copy link
Author

mafonso commented Sep 14, 2023

Thank you all. I didn't realize until now that this little thing was getting this visibility.
Some good suggestions up there that I took up in the updated version.

Also added a one-liner and JSON version more suitable to pipe into jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment