Bootstrap FreeKB - Amazon Web Services (AWS) - List IAM Profiles using the AWS CLI
Amazon Web Services (AWS) - List IAM Profiles 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 list-instance-profiles command can be used to list all of the IAM profiles.

aws iam list-instance-profiles

 

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

aws iam list-instance-profiles --query 'InstanceProfiles[?InstanceProfileName==`AmazonSSMRoleForInstancesQuickSetup`]'

 

Something like this should be returned.

{
    "InstanceProfiles": [
        {
            "Path": "/",
            "InstanceProfileName": "my-foo-profile",
            "InstanceProfileId": "ABCDEFG123456789",
            "Arn": "arn:aws:iam::123456789012:instance-profile/my-foo-profile",
            "CreateDate": "2021-09-09T13:29:20+00:00",
            "Roles": []
        },
        {
            "Path": "/",
            "InstanceProfileName": "my-bar-profile",
            "InstanceProfileId": "123456789ABCDEFG",
            "Arn": "arn:aws:iam::123456789012:instance-profile/my-bar-profile",
            "CreateDate": "2021-09-09T13:29:20+00:00",
            "Roles": []
        }
    ]
}

 




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