Last active
November 15, 2015 00:31
-
-
Save daveslutzkin/41645691f81cb92da12d to your computer and use it in GitHub Desktop.
AWS CLI show IAM groups and policies by user
This file contains 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
for full_username in `aws iam list-users | jq '.Users[].UserName'` | |
do | |
username=`echo $full_username | tr -d '"'` | |
echo $username \\t groups `aws iam list-groups-for-user --user-name $username | jq '.Groups[].GroupName' | tr '\n' ',' | tr -d '"'` \\t policies `aws iam list-attached-user-policies --user-name $username | jq '.AttachedPolicies[].PolicyName' | tr '\n' ',' | tr -d '"'` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment