ALIYUN::RAM::AttachPolicyToRole is used to attach a policy to a specified role.

Statement

{
  "Type": "ALIYUN::RAM::AttachPolicyToRole",
  "Properties": {
    "PolicyName": String,
    "PolicyType": String,
    "RoleName": String
  }
}

Properties

Parameter Type Required Editable Description Constraint
PolicyName String No No The name of the authorization policy. None
PolicyType String No No The type of the authorization policy. Valid values:
  • System
  • Custom
RoleName String No No The name of the RAM role, such as dev. Valid values: 1025 to 10000. You cannot use the following commonly used port numbers: 2222, 4500, 4510, 4560, 7505, 9000, 9001, and 9002.

Response parameters

Fn::GetAtt

None

Sample request

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Resources:
      AttachPolicyToRole:
        Type: ALIYUN::RAM::AttachPolicyToRole
        Properties:
          PolicyName: OSS-Administrator
          PolicyType: Custom
          RoleName: OSSAdminRole
    
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Resources": {
        "AttachPolicyToRole": {
          "Type": "ALIYUN::RAM::AttachPolicyToRole",
          "Properties": {
            "PolicyName": "OSS-Administrator",
            "PolicyType": "Custom",
            "RoleName": "OSSAdminRole"
          }
        }
      }
    }