ALIYUN::RAM::AttachPolicyToRole

更新时间:
复制 MD 格式

Attaches a policy to a RAM role.

Syntax

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

Properties

Property name Type Required Update allowed Description Constraints
PolicyName String Yes No The policy name. None.
PolicyType String Yes No The policy type. Valid values:
  • System
  • Custom
RoleName String Yes No The role name. Example: dev. None.

Return values

Fn::GetAtt

None.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      Role:
        Type: String
        AssociationProperty: ALIYUN::RAM::Role
    Resources:
      AttachPolicyToRole:
        Type: ALIYUN::RAM::AttachPolicyToRole
        Properties:
          PolicyName: OSS-Administrator
          PolicyType: Custom
          RoleName:
            Ref: Role
    
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "Role": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::RAM::Role"
        }
      },
      "Resources": {
        "AttachPolicyToRole": {
          "Type": "ALIYUN::RAM::AttachPolicyToRole",
          "Properties": {
            "PolicyName": "OSS-Administrator",
            "PolicyType": "Custom",
            "RoleName": {
              "Ref": "Role"
            }
          }
        }
      }
    }