user3399273
user3399273

Reputation: 139

How to get the list of policies assigned to a user using boto3 for an aws profile?

I am still in the learning phase of boto3 and I can't seem to figure out the basics as to get the list of policies assigned to a user using boto3 for an aws profile?

For example:

>> import boto3
>> client=boto3.client('iam')
>> client.get_user()

Here, client.get_user() doesn't give me the policy attribute.

Thanks

Upvotes: 5

Views: 7613

Answers (1)

Justin Blau
Justin Blau

Reputation: 121

I know this is an old question, but what you want is:

For inline policies:

inline_user_policies = client.list_user_policies(UserName=user_name)

For managed policies:

managed_user_policies = client.list_attached_user_policies(UserName=user_name)

Upvotes: 12

Related Questions