Last active
March 18, 2019 09:11
-
-
Save ljmocic/aa7cb65d62cd5c90d855a1f92f94f853 to your computer and use it in GitHub Desktop.
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
import boto3 | |
iam = boto3.client('iam', | |
aws_access_key_id='xxxx', | |
aws_secret_access_key='xxxx') | |
def user_in_group(user, group_name): | |
for group in iam.list_groups_for_user(UserName=user)['Groups']: | |
if group_name == group['GroupName']: | |
return True | |
return False | |
print(user_in_group('ljmocic', 'Admins')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment