Adds specified tags to one or more ApsaraDB for Redis instances.

If you have a large number of instances, you can create multiple tags and add these tags to the instances. Then, you can filter these 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 added 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 add up to 20 tags to each instance.
  • You can add tags to up to 50 instances in each call.

You can also add tags to instances in the ApsaraDB for Redis console. For more information, see Create a tag.


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.

ResourceType String Yes INSTANCE

The resource type. Set the value to INSTANCE.

ResourceId.N String Yes r-bp1zxszhcgatnx****

The ID of instance N. You can specify multiple IDs.

Note N specifies the serial number of the instance. For example, ResourceId.1 specifies the ID of the first instance and ResourceId.2 specifies the ID of the second instance.
Tag.N.Key String Yes demokey

The key of tag N.

  • N specifies the serial number of the tag. For example, Tag.1.Key specifies the key of the first tag and Tag.2.Key specifies the key of the second tag.
  • If the key of the tag does not exist, the tag is automatically created.
Tag.N.Value String Yes demovalue

The value of tag N.

Note N specifies the serial number of the tag. For example, Tag.1.Value specifies the value of the first tag and Tag.2.Value specifies the value of the second tag.

Response parameters

Parameter Type Example Description
RequestId String 4BD4E308-A3D8-4CD1-98B3-0ADAEE38****

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK


JSON format

HTTP/1.1 200 OK

  "RequestId" : "4BD4E308-A3D8-4CD1-98B3-0ADAEE38****"

Error codes

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