| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Creates a policy based on the information you provide and attaches the policy to the specified user. Use this command if you need a simple policy with no conditions, and you don't want to write the policy yourself. If you need a policy with conditions, you must write the policy yourself and upload it with iam-useruploadpolicy. For information about the contents of policies, refer to Using AWS Identity and Access Management.
A user can have only a limited number of policies. For more information, see Appendix A: Limitations on IAM Entities.
iam-useraddpolicy -u
USERNAME -p
POLICYNAME -e EFFECT
{-a ACTION ...} {-r
AMAZON RESOURCE NAME ...} [-o]
| Name | Description | Required |
|---|---|---|
|
|
Name of the user the policy is for. Type: String Default: None |
Yes |
|
|
Name you want to assign the policy. Type: String Default: None |
Yes |
|
|
The value for the policy's Type: String Valid Values: Default: None |
Yes |
|
|
The value for the policy's You can use wildcards, and you can specify more than one
The following
example specifies all the IAM actions related to
access keys or signing certificates: Type: String Default: None |
Yes |
|
|
The value for the policy's You can use wildcards, and you can specify more than one
Type: String Default: None |
Yes |
|
|
Causes the output to include the JSON policy document that IAM created for you. |
No |
If the command is successful, the output is empty. Exception: if you specified the
-o option, the output includes the JSON policy document.
The following example request adds (or updates) the policy named
AdminRoot for the user named Bob. The
-o option causes the output to include the JSON policy document we
construct for you based on the options you provided.
PROMPT> iam-useraddpolicy -u Bob -p AdminRoot -e Allow -a "*" -r "*" -o
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["*"],"Resource":["*"]}]}