You can call this operation to bind the existing or newly created tags to an instance.

This operation must meet the following requirements:

  • Each tag is composed 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 case-insensitive.
  • The maximum length of TagKey is 64 characters, and the maximum length of TagValue is 128 characters.
  • Each instance can be bound to a maximum of 10 tags. Each of tags bound to the same instance must have a unique TagKey. If you bind a new tag to the instance which has an existing tag, the new tag overwrites the existing tag.

Debugging

You can use API Explorer to perform debugging. API Explorer allows you to perform various API operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

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-hangzhou

The region ID. The maximum length of the region ID is 50 characters. You can call the DescribeRegions operation to view IDs of the available regions.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

Note Up to 30 instance IDs can be entered in a single request. Separate multiple instance IDs with commas (,).
AccessKeyId String No LTAIfCxxxxxxx

The AccessKey ID issued by Alibaba Cloud for users to access services.

Tags String No {“key1”:”value1”,“key2”:””}

The list of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered 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 TagKeys of the first set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 2.key String No key2

The TagKeys of the second set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 3.key String No key3

The TagKeys of the third set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 4.key String No key4

The TagKeys of the fourth set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 5.key String No key5

The TagKeys of the fifth set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 1.value String No value1

The TagValues of the first set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 2.value String No value2

The TagValues of the second set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 3.value String No value3

The TagValues of the third set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 4.value String No value4

The TagValues of the fourth set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

Tag. 5.value String No value5

The TagValues of the fifth set of tags to be bound. Each tag includes a TagKey and a TagValue. Up to five key-value pairs can be entered in a single request. The TagKey is required, and the TagValue is optional.

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

Successful response examples

XML format

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

JSON format

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

Error codes

View error codes