ALIYUN::RAM::AttachPolicyToUser is used to grant permissions to a specified user.

Syntax

{
  "Type": "ALIYUN::RAM::AttachPolicyToUser",
  "Properties": {
    "PolicyType": String,
    "UserName": String,
    "PolicyName": String
  }
}

Properties

Parameter Type Required Editable Description Constraint
PolicyType String Yes No The authorization policy type. Valid values:
  • System
  • Custom
UserName String Yes No The user name. N/A
PolicyName String Yes No The authorization policy name. N/A

Error code

Fn::GetAtt

None.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      AttachPolicyToUser:
        Type: ALIYUN::RAM::AttachPolicyToUser
        Properties:
          PolicyType: Custom
          UserName: dev
          PolicyName: TestPolicy
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "AttachPolicyToUser": {
          "Type": "ALIYUN::RAM::AttachPolicyToUser",
          "Properties": {
            "PolicyType": "Custom",
            "UserName": "dev",
            "PolicyName": "TestPolicy"
          }
        }
      }
    }