Last active
August 29, 2015 14:17
-
-
Save maimai-swap/458ae4e09778f05cf908 to your computer and use it in GitHub Desktop.
iamのグループとグループに入ってるユーザーをチェックする
This file contains hidden or 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/sh | |
AWS_PROFILE_NAME=$1 | |
groups=$(aws iam list-groups --query Groups[][GroupName] --profile $AWS_PROFILE_NAME --output text) | |
for group_name in $groups | |
do | |
aws iam get-group --group-name $group_name --query [Group.GroupName,Users[][UserName]] --profile $AWS_PROFILE_NAME | |
# inline policies | |
aws iam list-group-policies --group-name $group_name --profile $AWS_PROFILE_NAME | |
# Managed policies | |
aws iam list-attached-group-policies --group-name $group_name --profile $AWS_PROFILE_NAME | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment