AttachUserPolicy
In this article:
AttachUserPolicy#
Description#
Attaches a policy to an IAM user.
Request Parameters#
Required parameters#
PolicyArn — Amazon Resource Name (ARN) of the attached policy.
Type: String
Required: Yes
UserName — The name of the user.
Type: String
Required: Yes
Optional parameters#
ProjectName — The name of the project, which is specified when a project policy is attached.
Type: String
Required: No
Examples#
Request
https://iam.k2.cloud/?Action=AttachUserPolicy
&UserName=user-1
&ProjectName=project-1
&PolicyArn=arn:c2:iam:::policy/EC2FullAccess
Response
<AttachUserPolicyResponse>
<requestId>809c7f5f-7139-4cb8-bcea-68a533a8965c</requestId>
<ResponseMetadata>
<RequestId>809c7f5f-7139-4cb8-bcea-68a533a8965c</RequestId>
</ResponseMetadata>
</AttachUserPolicyResponse>
c2-iam AttachUserPolicy UserName user-1 ProjectName project-1 PolicyArn arn:c2:iam:::policy/EC2FullAccess
c2-iam AttachUserPolicy UserName user-1 PolicyArn arn:c2:iam:::policy/IAMFullAccess