Binds tags to one or more data migration, data synchronization, or change tracking instances.

If you have a large number of instances, you can create multiple tags and bind these tags to the instances. Then, you can filter the instances by tag.

  • A tag consists of a key and a value. Each key must be unique in a region for an Alibaba Cloud account. Different keys can be mapped to the same value.
  • If the tag that you specify does not exist, this tag is automatically created and bound to the specified instance.
  • If the key of the specified tag is the same as that of an existing tag, the specified tag overwrites the existing tag.
  • You can bind up to 20 tags to each instance.
  • You can bind tags to up to 50 instances in each call.

Debugging

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

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesTagResources

The operation that you want to perform. Set this parameter to TagResources.

RegionIdStringYescn-hangzhou

The ID of the region where the data migration, data synchronization, or change tracking instance resides. For more information, see List of supported regions.

ResourceId.NRepeatListYesdtsntk10k6r12v****

The ID of the data migration, data synchronization, or change tracking instance. You can call the DescribeDtsJobs operation to query the instance ID.

Note N specifies the serial number of the instance. For example, ResourceId.0 specifies the ID of the first instance and ResourceId.1 specifies the ID of the second instance.
ResourceTypeStringYesALIYUN::DTS::INSTANCE

The resource type. Valid value: ALIYUN::DTS::INSTANCE.

Tag.N.KeyStringYestestkey1

The tag key.

Note
  • N specifies the serial number of the tag. For example, Tag.0.Key specifies the key of the first tag and Tag.1.Key specifies the key of the second tag.
  • This parameter cannot be an empty string.
Tag.N.ValueStringYestestvalue1

The tag value.

Note
  • N specifies the serial number of the tag. For example, Tag.0.Value specifies the value of the first tag and Tag.1.Value specifies the value of the second tag.
  • This parameter can be an empty string.

Response parameters

ParameterTypeExampleDescription
ErrCodeStringInternalError

The error code returned if the call failed.

ErrMessageStringThe request processing has failed due to some unknown error.

The error message returned if the call failed.

RequestIdString755D7B84-6813-42B0-BC9D-2699CFEA****

The ID of the request.

SuccessBooleantrue

Indicates whether the call was successful.

Examples

Sample requests

http(s)://dts.aliyuncs.com/?Action=TagResources
&RegionId=cn-hangzhou    
&ResourceId.1=dtsntk10k6r12v****
&ResourceType=ALIYUN::DTS::INSTANCE
&Tag.1.Key=testkey1
&Tag.1.Value=testvalue1
&<Common request parameters>

Sample success responses

XML format

<TagResourcesResponse>
      <RequestId>755D7B84-6813-42B0-BC9D-2699CFEA****</RequestId>
      <Success>true</Success>
</TagResourcesResponse>

JSON format

{
    "RequestId": "755D7B84-6813-42B0-BC9D-2699CFEA****",
    "Success": true
}

Error codes

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