Created
July 22, 2021 18:46
-
-
Save dgulinobw/c5f0e93f06bfaa118aff4616b4b97341 to your computer and use it in GitHub Desktop.
List all users and their active access keys
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
#!/usr/bin/env python | |
from __future__ import print_function | |
import boto3 | |
iam = boto3.resource('iam') | |
for user in iam.users.all(): | |
for key in user.access_keys.all(): | |
if key.status == "Active": | |
print("user: {}, key: {}".format(user.name, key.id)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment