You can call this operation to create and bind tags to a specified ApsaraDB for RDS instance.

You can create and bind multiple tags for a large number of instances to classify and filter instances by tag.

  • A tag is a key-value pair. Keys in one account and region are different from each other. Different keys can be followed by the same value.
  • If the tag you entered does not exist, this tag is automatically created and bound to the target instance.
  • If a tag that has the same key is already bound to the instance, the new tag will overwrite the existing tag.
  • You can bind up to 20 tags to an instance.
  • You can bind tags to up to 50 instances when you perform the operation.

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 TagResources

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

RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

ResourceType String Yes INSTANCE

The type of the resource. Set the value to INSTANCE.

ResourceId.N RepeatList Yes rm-uf6wjk5xxxxxxx

The ID of Instance N. You can bind tags to N instances at a time. Valid values of N: 1 to 50.

Tag.N.Key String No testkey1

The key of Tag N. You can create N keys at a time. Valid values of N: 1 to 20. It cannot be an empty string.

Tag.N.Value String No testvalue1

The key value of Tag N. You can create N values at a time. Valid values of N: 1 to 20. It can be an empty string.

AccessKeyId String No LTAIfCxxxxxxx

The AccessKey ID provided to you by Alibaba Cloud.

Response parameters

Parameter Type Example Description
RequestId String 224DB9F7-3100-4899-AB9C-C938BCCB43E7

The ID of the request.

Examples

Sample requests


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

Sample success responses

XML format

<TagResourcesResponse>
  <RequestId>224DB9F7-3100-4899-AB9C-C938BCCB43E7</RequestId>
</TagResourcesResponse>

JSON format

{
	"RequestId":"224DB9F7-3100-4899-AB9C-C938BCCB43E7"
}

Error codes

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