Reputation: 1
I am using python and boto to assume an AWS IAM role. I want to see what policies are attached to the role so i can loop through them and determine what actions are available for the role. I want to do this so I can know if some actions are available instead of doing this by calling them and checking if i get an error. However I cannot find a way to list the policies for the role after assuming it as the role is not authorised to perform IAM actions.
Is there anyone who knows how this is done or is this perhaps something i should not be doing.
Upvotes: 0
Views: 702
Reputation: 269091
To obtain policies, your AWS credentials require permissions to retrieve the policies.
If such permissions are not associated with the assumed role, you could use another set of credentials to retrieve the permissions (but those credentials would need appropriate IAM permissions).
There is no way to ask "What policies do I have?" without having the necessary permissions. This is an intentional part of AWS security because seeing policies can reveal some security information (eg "Oh, why am I specifically denied access to the Top-Secret-XYZ
S3 bucket?").
Upvotes: 1