| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Takes a policy you've written and attaches it to the specified role. If a policy with that name is already attached to the role, 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 AWS Identity and Access Management.
iam-roleuploadpolicy -r
ROLENAME -p
POLICYNAME [-f
POLICYDOCUMENTFILE | -o
POLICYDOCUMENT]
| Name | Description | Required |
|---|---|---|
|
|
Name of the role 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 mypolicy for the role named myrole. The policy is uploaded as a text string.
PROMPT> iam-roleuploadpolicy -r myrole -p mypolicy -o {"Version":"2012-10-17","Statement":[{"Effect": "Allow","Action": "s3:*","Resource":"*"}]}The following example adds (or updates) the policy named mypolicy1 for the role named myrole1. The policy is uploaded as a text file.
PROMPT> iam-roleuploadpolicy -r myrole1 -p mypolicy1 -f C:\Policies\mypolicy1_file.txt