Bootstrap FreeKB - Amazon Web Services (AWS) - List IAM Users Groups and Roles Details using the AWS CLI
Amazon Web Services (AWS) - List IAM Users Groups and Roles Details 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.

The aws iam get-account-authorization-details command can be used to list details about users, groups, roles and policies.

aws iam get-account-authorization-details

 

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

aws iam get-account-authorization-details --query 'UserDetailList[?UserName==`johndoe`]'

 

Something like this should be returned.

{
    "UserDetailList": [
        {
            "Path": "/",
            "UserName": "johndoe",
            "UserId": "AIDA123456789UA6B2DRP",
            "Arn": "arn:aws:iam::123456789012:user/johndoe",
            "CreateDate": "2022-09-13T11:13:03+00:00",
            "GroupList": [],
            "AttachedManagedPolicies": [
                {
                    "PolicyName": "AdministratorAccess",
                    "PolicyArn": "arn:aws:iam::aws:policy/AdministratorAccess"
                }
            ],
            "Tags": []
        }
    ],
    "GroupDetailList": [],
    "RoleDetailList": . . .

 




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 f6a35a in the box below so that we can be sure you are a human.