Remove a managed policy from a role.
Section: IAM Policies
Detach a managed policy from a role
bash
bash
aws iam detach-role-policy --role-name AppRole --policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccessExplanation
Used during least-privilege cleanup.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing IAM Policies
Attach a managed policy to a role
Grant a role the permissions from a managed policy.
Get policy document version
Read the JSON document for a specific policy version.
Simulate effective permissions
Test whether a principal can perform an action on a resource.