Search code examples
pythonamazon-web-servicesbotoamazon-iam

Python boto function for getting ALL policies associated with a ROLE?


I am looking to parse ALL IAM policies in my account for IP address restriction information. This includes groups, users, and roles.

So with boto.iam, I can:

  • list all my groups
  • iterate over those groups, getting all the policies for each group
  • iterate over those policies, parsing them for the IP restriction clause.

I can do the same for my users.

However, there is no equivalent "get_all_role_policies" command that I can find. I have verified that I can attach more than one policy to each role.

Am I missing something, or does boto just not support the same functionality for roles as they do for groups and users?


Solution

  • The version of boto that I have has a list_role_policies method and a get_role_policy method similar to the ones for users and groups. Those should allow you to find all policies for all roles.