Bootstrap FreeKB - Amazon Web Services (AWS) - List IAM Users using the AWS CLI
Amazon Web Services (AWS) - List IAM Users using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

  • IAM (Identity and Access Management) Roles contains one or more IAM Policies - Often, a Role will have two Policies.
  • An IAM Policy is JSON that is used to list the principals (users / groups / service accounts) that are allowed or denied to do something (such as listing) on certain resources (such as S3 Buckets).

The aws iam list-users command can be used to list the IAM users that have been created.

~]$ aws iam list-users
{
    "Users": [
        {
            "Path": "/",
            "UserName": "john.doe",
            "UserId": "AIDAABCDL76GLUA6B21234",
            "Arn": "arn:aws:iam::123456789012:user/john.doe",
            "CreateDate": "2022-09-13T11:13:03+00:00"
        }
    ]
}

 

And here is an example of how to limit the output using the --query option.

aws iam list-users --query 'Users[?UserName==`john.doe`]'

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 5152e6 in the box below so that we can be sure you are a human.