Skip to content

Instantly share code, notes, and snippets.

@motchang
Last active August 29, 2015 14:18
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 motchang/9859df93b1b85aebbba7 to your computer and use it in GitHub Desktop.
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
#!/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
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