Using Console
Using CLI
aws iam list-roles
to list all the roles in your AWS account.aws iam update-assume-role-policy
to update the trust policy of each misconfigured role.--role-name
parameter.--policy-document
parameter.trust-policy.json
) with the updated trust policy. The following is an example of a trust policy allowing only EC2 instances to assume the role:
Using Python
update_assume_role_policy
API.