The following code examples show how to use ListUserPolicies
.
- AWS CLI
-
To list policies for an IAM user
The following
list-user-policies
command lists the policies that are attached to the IAM user namedBob
.aws iam list-user-policies \ --user-name
Bob
Output:
{ "PolicyNames": [ "ExamplePolicy", "TestPolicy" ] }
For more information, see Creating an IAM user in your AWS account in the AWS IAM User Guide.
-
For API details, see ListUserPolicies
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.