Adds tags to one or more ApsaraDB for Redis instances.

If you have a large number of instances, you can classify them by creating multiple tags and binding these tags to your instances. You can filter your 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 an instance.
  • You can bind tags to up to 50 instances in each call.

You can also bind 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 ID of the region where the instance is deployed.

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

The ID of the specified instance. You can specify multiple IDs.

Note N indicates the serial number of the instance. For example, ResourceId.1 indicates the ID of the first instance and ResourceId.2 indicates the ID of the second instance.
ResourceType String Yes INSTANCE

The type of resource. Set the value to INSTANCE.

Tag.N.Key String Yes demokey

The key of the tag.

  • N indicates the serial number of the tag. For example, Tag.1.Key indicates the key of the first tag. Tag.2.Key indicates 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 the tag.

Note N specifies the value of the nth tag. For example, Tag.1.Value indicates the value of the first tag. Tag.2.Value indicates 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

http(s)://[Endpoint]/? Action=TagResources
&<Common request parameters>

Sample success responses

XML format


JSON format

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

Error codes

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