Is there a way to AWS services and it return the policy or role attached to it?

0

I have a use case where I am trying to use CLI to see the policies attached to each role that list write based policies.

However, the only data I hae is the service of the role. Opposed to the actuall role itself.

I'm wondering if there's a process to do this and receive this information for services such as Lambdas, EC2, and ECS instances?

1 Answer
0

You could do something like this in the CLI:

aws iam list-roles --query Roles[?AssumeRolePolicyDocument.Statement[0].Principal.Service==\`lambda.amazonaws.com\`].RoleName

This will get you the roles that IAM trusts Lambda to assume.

profile pictureAWS
EXPERT
kentrad
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions