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

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "PolicyType": {
      "Type": "String",
      "Description": "Authorization policy type. Value: \"System\" or \"Custom\".",
      "AllowedValues": [
        "System",
        "Custom"
      ]
    },
    "UserName": {
      "Type": "String",
      "Description": "User name.Example: dev."
    },
    "PolicyName": {
      "Type": "String",
      "Description": "Authorization policy name."
    }
  },
  "Resources": {
    "AttachPolicyToUser": {
      "Type": "ALIYUN::RAM::AttachPolicyToUser",
      "Properties": {
        "PolicyType": {
          "Ref": "PolicyType"
        },
        "UserName": {
          "Ref": "UserName"
        },
        "PolicyName": {
          "Ref": "PolicyName"
        }
      }
    }
  }
}

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  PolicyType:
    Type: String
    Description: 'Authorization policy type. Value: "System" or "Custom".'
    AllowedValues:
      -System
      -Custom
  UserName:
    Type: String
    Description: 'User name.Example: dev.'
  PolicyName:
    Type: String
    Description: Authorization policy name.
Resources:
  AttachPolicyToUser:
    Type: 'ALIYUN::RAM::AttachPolicyToUser'
    Properties:
      PolicyType:
        Ref: PolicyType
      UserName:
        Ref: UserName
      PolicyName:
        Ref: PolicyName