| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Takes a policy you've written and attaches it to the specified user. If a policy with that name is already attached to the user, it's overwritten with the new one. The command accepts either a string representing the policy, or a file containing the policy. For information about the contents of policies, refer to Using IAM.
A user can have only a limited number of policies. For more information, see Appendix A: Limitations on IAM Entities.
iam-useruploadpolicy -u
USERNAME -p
POLICYNAME [-f
POLICYDOCUMENTFILE | -o
POLICYDOCUMENT]
| 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 |
|
|
Path and name of the file containing the policy. Type: String Condition: Either Default: None |
Conditional |
|
|
The policy (a JSON text string). Type: String Condition: Either Default: None |
Conditional |
If the command is successful, the output is empty.
The following example adds (or updates) the policy named KeyPolicy for the user named Bob. The policy is uploaded as a text string.
PROMPT> iam-useruploadpolicy -u Bob -p KeyPolicy -o {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["iam:*AccessKey*","iam:*SigningCertificate*"],"Resource":"arn:aws:iam::123456789012:user/division_abc/subdivision_xyz/Bob"}]}The following example adds (or updates) the policy named KeyPolicy for the user named Bob. The policy is uploaded as a text file.
PROMPT> iam-useruploadpolicy -u Bob -p KeyPolicy -f C:\Policies\KeyPolicy_file.txt