Creates an application group based on the tags of cloud resources.

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

This topic provides an example to show how to create an application group for resources whose tag key is ecs_instance. 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 tag keys of the cloud resources.

For more information about how to obtain tag keys, see DescribeTagKeyList.

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.

An alert contact group can contain one or more alert contacts. For information about how to create alert contacts and alert contact groups, see PutContact and PutContactGroup. For information about how to obtain alert contact groups, see DescribeContactGroupList.

EnableSubscribeEvent Boolean No true

Specifies whether the application group automatically subscribes to event notifications. If events whose severity level is critical or warning occur on resources in an application group, CloudMonitor sends alert notifications. Valid values:

  • true: The application group automatically subscribes to event notifications.
  • false (default value): The application group does not automatically subscribe to event notifications.
EnableInstallAgent Boolean No true

Specifies whether the CloudMonitor agent is automatically installed for the application group. CloudMonitor determines whether to automatically install the CloudMonitor agent for the hosts in an application group based on the value of this parameter. Valid values:

  • true: The CloudMonitor agent is automatically installed.
  • false (default value): The CloudMonitor agent is not automatically installed.
MatchExpressFilterRelation String No and

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

  • and (default value)
  • or
MatchExpress.N.TagValueMatchFunction String No contains

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

  • contains: includes
  • startWith: starts with a prefix
  • endWith: ends with a suffix
  • notContains: excludes
  • equals: equals
  • all: includes all
Note If you set the MatchExpress.N.TagValueMatchFunction parameter, you must also set the MatchExpress.N.TagValue parameter.
MatchExpress.N.TagValue String No instance

The tag values of the cloud resources. In this example, set the value of N to 1.

Note If you set the MatchExpress.N.TagValue parameter, you must also set the MatchExpress.N.TagValueMatchFunction parameter.
TemplateIdList.N RepeatList No 85****

The IDs of the alert templates.

For more information about how to query alert template IDs, see DescribeMetricRuleTemplateList.

TagRegionId String No cn-hangzhou

The ID of the region to which the tags belong.

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 value 200 indicates that the call was successful.
Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
RequestId String 84AC6F0B-7945-466A-AA44-99BB5A561F86

The ID of the request.

Message String The specified resource is not found.

The error message.

Id String 2534dc0a-e3e5-4ae1-a2fc-75ef166c****

The ID of the tag matching rule.

Examples

Sample requests

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

Sample success responses

XML format

<CreateDynamicTagGroupResponse>
	  <RequestId>84AC6F0B-7945-466A-AA44-99BB5A561F86</RequestId>
	  <Id>2534dc0a-e3e5-4ae1-a2fc-75ef166c****</Id>
	  <Code>200</Code>
	  <Success>true</Success>
</CreateDynamicTagGroupResponse>

JSON format

{
    "RequestId":"84AC6F0B-7945-466A-AA44-99BB5A561F86",
    "Id": "2534dc0a-e3e5-4ae1-a2fc-75ef166c****",
    "Code": "200",
    "Success":true
}

Error codes

HTTP status code 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.