AWS CLI – List IAM Users
The aws iam list-users
is a handy command for managing your AWS IAM users. It lets you get a list of all the users in your AWS account, along with some basic info about each one.
You can use the --query
option to choose which info you want to see for each user. In the example you gave, the query grabs the user name, Amazon Resource Name (ARN), and create date. Here’s how the command looks:
aws iam list-users --query "Users[*].{Name:UserName,arn:Arn, CreateDate:CreateDate}"
The output of the command will be a list of JSON objects, each with the info you chose to see for a single user. This can be useful for quickly getting an overview of your IAM users and their details.
You can find more detailed information about the iam list-users
command, as well as the other iam
commands, in the AWS CLI documentation: https://docs.aws.amazon.com/cli/latest/reference/iam/index.html#cli-aws-iam.
Leave a Reply