Skip to content
Advertisement

List of all roles with attached policies with Boto3

Found a useful thread here that helped me get part of a script to get a list of all roles and its attached policies:

JavaScript

I am trying to figure out how to make this work so I get a list of all the roles in our AWS account and their attached policies. I am pretty new to Python/Boto3 so any help would be greatly appreciated

Advertisement

Answer

You should be able to do something like this:

JavaScript

The paginators should help handle cases where you might have more roles / policies than the per-response limit imposed by AWS. As usual with programming there are a lot of different ways to do this, but this is one approach.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement