You can call the AddTagsToResource operation to bind existing or new tags to an ApsaraDB RDS instance.

This operation has the following limits:

  • Each tag consists of a TagKey and a TagValue. The TagKey is required, and the TagValue is optional.
  • The values of TagKey and TagValue cannot start with aliyun.
  • The values of TagKey and TagValue are not case-sensitive.
  • The maximum length of a TagKey is 64 characters, and the maximum length of a TagValue is 128 characters.
  • Each instance can be bound to a maximum of 10 tags. Each tag that is bound to the same instance must have a unique TagKey. If you bind a new tag to the instance and the TagKey of the new tag is the same as that of an existing tag, the new tag overwrites the existing tag.

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 AddTagsToResource

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

RegionId String Yes cn-hagnzhou

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

Note You can enter up to 30 instance IDs in a single request. If you enter more than one instance ID, you must separate the instance IDs with commas (,).
AccessKeyId String No LTAIfCxxxxxxx

The AccessKey ID provided to you by Alibaba Cloud.

Tags String No {"key1":"value1","key2":""}

The tags that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. Format: {"key1":"value1","key2":"value2"...}.

Note The TagKey is required, and the TagValue is optional.
Tag.1.key String No key1

The TagKey of the first tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.2.key String No key2

The TagKey of the second tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.3.key String No key3

The TagKey of the third tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.4.key String No key4

The TagKey of the fourth tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.5.key String No key5

The TagKey of the fifth tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.1.value String No value1

The TagValue of the first tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.2.value String No value2

The TagValue of the second tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.3.value String No value3

The TagValue of the third tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.4.value String No value4

The TagValue of the fourth tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

Tag.5.value String No value5

The TagValue of the fifth tag that you want to bind. Each tag consists of a TagKey and a TagValue. You can specify up to five tags in a single request. The TagKey is required, and the TagValue is optional.

ClientToken String No ETnLKlblzczshOTUbOCzxxxxxxx

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

proxyId String No API

The ID of the proxy pattern.

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=AddTagsToResource
&RegionId=cn-hagnzhou
&DBInstanceId=rm-uf6wjk5xxxxxxx
&Tags=%7B%22test%22%3A%221%22%7D
&<Common request parameters>

Sample success responses

XML format

<AddTagsToResourceResponse>
	  <requestId>224DB9F7-3100-4899-AB9C-C938BCCB43E7</requestId></AddTagsToResourceResponse>

JSON format

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

Error codes

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