List IAM users in an AWS account
📑 On this page
Part 82 of AWS from Zero. This lesson changes or inspects one IAM concept so the permission model stays understandable.
What we are learning
list-users inventories IAM users in the current account. It does not include IAM Identity Center users or assumed role sessions.
Before you run it
aws sts get-caller-identity
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
USER_NAME="aws-zero-learner"
GROUP_NAME="aws-zero-readers"
ROLE_NAME="aws-zero-demo-role"IAM is global rather than regional. Use a sandbox account and a delegated administrator identity, never root access keys.
The command
aws iam list-usersIAM writes can take a short time to propagate. Inspect the resource after every change.
Inspect the result
aws iam list-users \
--query "Users[].{Name:UserName,Path:Path,Created:CreateDate,Arn:Arn}" \
--output tableRead the returned ARN, path, IDs, and attachment state instead of checking only the command exit code.
One tiny variation
aws iam list-users \
--path-prefix "/applications/" \
--query "Users[].UserName" \
--output textPaths can organize IAM resources, though tags and modern identity systems often carry more operational meaning.
Common mistake
An empty IAM user list does not mean the account has no human access. Check IAM Identity Center, roles, federation, and root-account protections separately.
Cleanup
# This lesson is read-only or reuses a named demo identity.
aws sts get-caller-identityKeep shared demo identities only while following the IAM sequence. Part 125 removes them in dependency order.
Next, we will learn Inspect one IAM user.