The following code examples show how to use DetachUserPolicy
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:
- AWS CLI
-
To detach a policy from a user
This example removes the managed policy with the ARN
arn:aws:iam::123456789012:policy/TesterPolicy
from the userBob
.aws iam detach-user-policy \ --user-name
Bob
\ --policy-arnarn:aws:iam::123456789012:policy/TesterPolicy
This command produces no output.
For more information, see Changing permissions for an IAM user in the AWS IAM User Guide.
-
For API details, see DetachUserPolicy
in AWS CLI Command Reference.
-
For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.