Last active
August 29, 2015 14:18
-
-
Save motchang/9859df93b1b85aebbba7 to your computer and use it in GitHub Desktop.
aws cli で iam の group に紐づく user, policy を見る ref: http://qiita.com/motchang/items/aee024fad5e49ce872d1
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
#!/bin/bash | |
aws iam list-groups | jq '.Groups[].GroupName' | xargs -I{} echo {} | \ | |
while read g | |
do | |
echo ${g} "-------------------------------------------------------------"; | |
aws iam get-group --group-name ${g} | jq '(.Group | {GroupName, Arn}), (.Users[] | {UserName, Arn})' | |
aws iam list-group-policies --group-name ${g} | jq '.PolicyNames[]' | xargs -I{} echo {} | \ | |
while read p | |
do | |
aws iam get-group-policy --group-name ${g} --policy-name ${p} | |
done | |
one |
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
a = [1, 2, 3] | |
a.each do |n| | |
echo p | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment