attach-user-policy¶
Attaches the specified managed policy to the specified user.
Use this API to attach a managed policy to a user. To embed an inline policy in a user, use PutUserPolicy.
For more information about policies, refer to Managed Policies and Inline Policies in the IAM User Guide.
Refer to AWS API Documentation.
Refer to AWS help for descriptions of global parameters.
Synopsis¶
attach-user-policy
--user-name <value>
--policy-arn <value>
Options¶
--user-name (string)
The name (friendly name, not ARN) of the IAM user to attach the policy to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters:
_,+,=,,,.,@, and-.
--policy-arn (string)
The Amazon Resource Name (ARN) of the IAM policy you want to attach.
For more information about ARNs, refer to Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.
Refer to AWS help for descriptions of global parameters.
Examples¶
To attach a managed policy to an IAM user
The following attach-user-policy command attaches the AWS managed policy
named AdministratorAccess to the IAM user named Alice
aws iam attach-user-policy --policy-arn arn:aws:iam:ACCOUNT-ID:aws:policy/AdministratorAccess --user-name Alice
For more information, refer to Managed Policies and Inline Policies in the Using IAM guide.
Output¶
None

