attachUserPolicy

Attaches the specified managed policy to the specified user.

You use this operation to attach a managed policy to a user. To embed an inline policy in a user, use PutUserPolicy.

As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.

For more information about policies, see Managed policies and inline policies in the IAM User Guide.

Samples


fun main() { 
   //sampleStart 
   // The following command attaches the AWS managed policy named AdministratorAccess to the IAM user
// named Alice.
iamClient.attachUserPolicy {
    userName = "Alice"
    policyArn = "arn:aws:iam::aws:policy/AdministratorAccess"
} 
   //sampleEnd
}