Creates a tag rule based on which instances of cloud services can be automatically added to an application group.

This operation is available for Elastic Compute Service (ECS), ApsaraDB RDS, and Server Load Balancer (SLB).

This topic describes how to automatically add resources whose tag key is ecs_instance to an application group. In this example, the alert contact group of the application group is ECS_Group.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateDynamicTagGroup

The operation that you want to perform. Set the value to CreateDynamicTagGroup.

TagKey String Yes ecs_instance

The key of the tag for resources.

ContactGroupList.N RepeatList Yes ECS_Group

The alert contact group. Valid values of N: 1 to 100. The alert notifications of the application group are sent to the alert contacts that belong to the alert contact group.

Note An alert group includes one or more alert contacts. For more information about how to create alert contacts and alert contact groups, see PutContact and PutContactGroup.
EnableSubscribeEvent Boolean No true

Specifies whether to enable the subscribe event notification feature. Valid values:

  • true
  • false
Note After the subscribe event notification feature is enabled, alert notifications are sent when critical and warning events occur for the related resources of the application group.
EnableInstallAgent Boolean No true

Specifies whether to enable the initialize agent installation feature. Valid values:

  • true: to enable the feature.
  • false: to disable the feature. Default value: false.
Note After this feature is enabled, CloudMonitor automatically installs the CloudMonitor agent on instances that belong to the application group.
MatchExpressFilterRelation String No and

The relationship between conditional expressions for the tag values of resources. Valid values:

  • and. Default value: and.
  • or
MatchExpress.N.TagValueMatchFunction String No contains

The method that is used to match the tag value for resources. In this example, set the N parameter to 1. Valid values:

  • contains: includes.
  • startWith: starts with a prefix.
  • endWith: ends with a suffix.
  • notContains: excludes.
  • equals: equals.
  • all: includes all.
Note The MatchExpress.N.TagValueMatchFunction and MatchExpress.N.TagValue parameters are required.
MatchExpress.N.TagValue String No instance

The tag value of the resource. In this example, set the N parameter to 1.

Note The MatchExpress.N.TagValueMatchFunction and MatchExpress.N.TagValue parameters are required.
TemplateIdList.N RepeatList No 85****

The ID of the alert template. For more information about how to query alert template IDs, see DescribeMetricRuleTemplateList.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code.

Note The HTTP status code 200 indicates that the request succeeds.
Success Boolean true

Indicates whether the call succeeds. Valid values:

  • true: The call succeeds.
  • false: The call fails.
RequestId String 84AC6F0B-7945-466A-AA44-99BB5A561F86

The ID of the request.

Message String The specified resource is not found.

The error message.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateDynamicTagGroup
&TagKey=ecs_instance
&ContactGroupList.1=ECS_Group
&<Common request parameters>

Sample success responses

XML format

<CreateDynamicTagGroupResponse>
	  <Code>200</Code>
	  <RequestId>84AC6F0B-7945-466A-AA44-99BB5A561F86</RequestId>
	  <Success>true</Success>
</CreateDynamicTagGroupResponse>

JSON format

{
    "Code":"200",
    "RequestId":"84AC6F0B-7945-466A-AA44-99BB5A561F86",
    "Success":true
}

Errors codes

HttpCode Error code Error message Description
404 ResourceNotFound The specified resource is not found. The error message returned because the specified resource is not found.

For a list of error codes, visit the API Error Center.