Skip to content

Instantly share code, notes, and snippets.

@maimai-swap
Last active August 29, 2015 14:17
Show Gist options
  • Save maimai-swap/458ae4e09778f05cf908 to your computer and use it in GitHub Desktop.
Save maimai-swap/458ae4e09778f05cf908 to your computer and use it in GitHub Desktop.
iamのグループとグループに入ってるユーザーをチェックする
#!/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