Skip to content

Instantly share code, notes, and snippets.

@dgulinobw
Created July 22, 2021 18:46
Show Gist options
  • Save dgulinobw/c5f0e93f06bfaa118aff4616b4b97341 to your computer and use it in GitHub Desktop.
Save dgulinobw/c5f0e93f06bfaa118aff4616b4b97341 to your computer and use it in GitHub Desktop.
List all users and their active access keys
#!/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