ALIYUN::CMS::DynamicTagGroup类型用于云产品自动创建应用分组。
说明 
目前只支持云服务器ECS(Elastic Compute Service)、阿里云关系型数据库RDS(Relational Database Service)、负载均衡SLB(Server Load Balancer)。
语法
{
  "Type": "ALIYUN::CMS::DynamicTagGroup",
  "Properties": {
    "ContactGroupList": List,
    "MatchExpressFilterRelation": String,
    "EnableSubscribeEvent": Boolean,
    "TemplateIdList": List,
    "TagKey": String,
    "EnableInstallAgent": Boolean,
    "MatchExpress": List
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| ContactGroupList | List | 是 | 否 | 报警联系人。 | 无 | 
| TagKey | String | 是 | 否 | 标签键。 | 无 | 
| EnableInstallAgent | Boolean | 否 | 否 | 是否启用初始化安装监控插件。 | 取值: 
 说明  如果生成应用分组的ECS实例没有安装监控插件则会尝试自动安装。 | 
| EnableSubscribeEvent | Boolean | 否 | 否 | 是否启用事件订阅。 | 取值: 
 | 
| MatchExpress | List | 否 | 否 | 条件表达式。 | 最多支持配置三个条件表达式。 更多信息,请参见MatchExpress属性。 | 
| MatchExpressFilterRelation | String | 否 | 否 | 条件表达式之间的关系。 | 取值: 
 | 
| TemplateIdList | List | 否 | 否 | 报警模板ID。 | 无 | 
MatchExpress语法
"MatchExpress": [
  {
    "TagValue": String,
    "TagValueMatchFunction": String
  }
]MatchExpress属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| TagValue | String | 是 | 否 | 标签值。 | 无 | 
| TagValueMatchFunction | String | 是 | 否 | 标签值的匹配方法。 | 取值: 
 | 
返回值
Fn::GetAtt
- DynamicTagRuleId:智能标签规则ID。 
- TagKey:标签键。 
示例
重要 
下方代码存在脱敏内容,请替换为您实际的参数。
YAML格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  MatchExpressFilterRelation:
    Type: String
    Description: |-
      The relationship between the conditional expressions. Values are:
      and: the relationship between
      or: the relationship or the
      Description currently supports only one combination of conditions, the follow-up Ali cloud will support a variety of combinations of conditions.
    AllowedValues:
      - and
      - or
    Default: or
  EnableSubscribeEvent:
    Type: Boolean
    Description: |-
      Whether the event subscription is enabled. Values are
      :true: enable event subscription
      false: disable event subscription
    AllowedValues:
      - true
      - false
    Default: false
  ContactGroupList:
    Type: Json
    Description: Alarm contacts.
    Default:
      - ros-ut-group
Resources:
  DynamicTagGroup:
    Type: ALIYUN::CMS::DynamicTagGroup
    Properties:
      ContactGroupList:
        Ref: ContactGroupList
      MatchExpressFilterRelation:
        Ref: MatchExpressFilterRelation
      EnableSubscribeEvent:
        Ref: EnableSubscribeEvent
      TemplateIdList: Null
      TagKey: test1
      EnableInstallAgent: false
      MatchExpress:
        - TagValue: '1'
          TagValueMatchFunction: all
        - TagValue: '2'
          TagValueMatchFunction: equals
Outputs:
  DynamicTagRuleId:
    Value:
      Fn::GetAtt:
        - DynamicTagGroup
        - DynamicTagRuleId
  TagKey:
    Value:
      Fn::GetAtt:
        - DynamicTagGroup
        - TagKey
JSON格式
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "MatchExpressFilterRelation": {
      "Type": "String",
      "Description": "The relationship between the conditional expressions. Values are:\nand: the relationship between\nor: the relationship or the\nDescription currently supports only one combination of conditions, the follow-up Ali cloud will support a variety of combinations of conditions.",
      "AllowedValues": [
        "and",
        "or"
      ],
      "Default": "or"
    },
    "EnableSubscribeEvent": {
      "Type": "Boolean",
      "Description": "Whether the event subscription is enabled. Values are\n:true: enable event subscription\nfalse: disable event subscription",
      "AllowedValues": [
        true,
        false
      ],
      "Default": false
    },
    "ContactGroupList": {
      "Type": "Json",
      "Description": "Alarm contacts.",
      "Default": ["ros-ut-***"]
    }
  },
  "Resources": {
    "DynamicTagGroup": {
      "Type": "ALIYUN::CMS::DynamicTagGroup",
      "Properties": {
        "ContactGroupList": {
          "Ref": "ContactGroupList"
        },
        "MatchExpressFilterRelation": {
          "Ref": "MatchExpressFilterRelation"
        },
        "EnableSubscribeEvent": {
          "Ref": "EnableSubscribeEvent"
        },
        "TemplateIdList": null,
        "TagKey": "test1",
        "EnableInstallAgent": false,
        "MatchExpress": [
          {
            "TagValue": "1",
            "TagValueMatchFunction": "all"
          },
          {
            "TagValue": "2",
            "TagValueMatchFunction": "equals"
          }
        ]
      }
    }
  },
  "Outputs": {
    "DynamicTagRuleId": {
      "Value": {
        "Fn::GetAtt": [
          "DynamicTagGroup",
          "DynamicTagRuleId"
        ]
      }
    },
    "TagKey": {
      "Value": {
        "Fn::GetAtt": [
          "DynamicTagGroup",
          "TagKey"
        ]
      }
    }
  }
}该文章对您有帮助吗?