Get a List Of All AWS IAM Users with Python (boto3)

In this blog post, I will show you how to view all the users I have in AWS using AWS SDK for Python.

In my previous article, I have shown you how to start an AWS EC2 VM using Python.

Now, I will build on the capabilities of the previous article and show you how to access IAM with Python.

Get Started

Below, I have my Python script that connects to AWS using my AWS configure configuration.

After connecting, I will create a client object that uses IAM and shows all usernames.

import boto3
 client = boto3.client('iam') 
 response = client.list_users()
 for x in response['Users']:
 print (x['UserName']) 

After running my code, you can see all my users below.