aws Verified current stable Not installed? Security

Aws / List Iam Users

List Iam Users

Lists existing IAM users.

$
Terminal
aws iam list-users

When To Use

When reviewing all IAM users for compliance audits or permissions assessments.

Pro Tip

Use `--query` to filter users based on specific criteria to eliminate noise in results.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
--------------------------------------------------------------------------------
|                     UserName                     |            UserId            |  Arn  |
--------------------------------------------------------------------------------
|                Alice                                |  AIDI1234567890123          |  arn:aws:iam::123456789012:user/Alice  |
|                Bob                                  |  AIDI9876543210987          |  arn:aws:iam::123456789012:user/Bob    |
|                Charlie                               |  AIDI4567890123456          |  arn:aws:iam::123456789012:user/Charlie |
--------------------------------------------------------------------------------

Anatomy of Output

Understanding the result

UserId: AIDAEXAMPLEID User Identifier

Unique identifier for the IAM user.

UserName: jdoe User Name

The display name of the IAM user.

CreateDate: 2023-01-15T12:00:00Z Creation Date

Date when the user was created in the AWS account.

Power User Variants

Optimized versions

aws iam list-users --max-items 5

Limits results to 5 IAM users for quicker viewing.

aws iam list-users --query 'Users[?starts_with(UserName, `j`)]'

Filters users whose names begin with 'j'.

aws iam list-users --profile user-profile

Lists users based on a specific AWS CLI profile.

Troubleshooting

Common pitfalls

An error occurred (NoSuchEntity) when calling the ListUsers operation: User does not exist.

Solution: Verify the IAM user listed does match actual users in the account.

An error occurred (AccessDenied) when calling the ListUsers operation: User is not authorized to perform this operation.

Solution: Check IAM permissions to ensure user has list access for IAM users.

An error occurred (ServiceFailure) when calling the ListUsers operation: Service error occurred.

Solution: Retry command; this may indicate temporary service issues.

Command Breakdown

What each part is doing

aws
Base Command
The executable that performs this operation. Here it runs Aws before the shell applies any redirect operators.

How To Run

Execution path

  1. Step 1

    Run the command: `aws iam list-users`

  2. Step 2

    Verify the output shows a list of IAM users with their details.

Alternative Approaches

Comparable commands in other tools

Alternative security tools for the same job.