Adds specified tags to one or more ApsaraDB for Redis instances.
Operation description
If you have a large number of instances, you can create multiple tags and add these tags to the instances. Then, you can filter 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 request.
You can also add tags to instances in the ApsaraDB for Redis console. For more information, see Create a tag.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
kvstore:TagResources | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the instance. | cn-hangzhou |
ResourceType | string | Yes | The resource type. Set the value to INSTANCE. | INSTANCE |
ResourceId | array | Yes | The ID of the instance. | |
string | Yes | The ID of the instance. You can specify multiple IDs. Note
This parameter indicates the ID of the Nth instance. For example, ResourceId.1 specifies the ID of the first instance and ResourceId.2 specifies the ID of the second instance.
| r-bp1zxszhcgatnx**** | |
Tag | array<object> | Yes | The tags of the instance. | |
object | Yes | The object. | ||
Key | string | Yes | The key of the tag associated with the instance. Note
| demokey |
Value | string | Yes | The value of the tag associated with the instance. 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.
| demovalue |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "4BD4E308-A3D8-4CD1-98B3-0ADAEE38****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | NumberExceed.Tags | The Tags parameter number is exceed, Valid is 20. | - |
400 | InvalidTagKey.Malformed | The specified parameter Tag.n.Key or TagKey.n is not valid. | - |
400 | InvalidTagValue.Malformed | The specified parameter Tag.n.Value is not valid. | - |
400 | InvalidParameter.ResourceId | The specified parameter ResourceId.n is not valid. | - |
400 | MissParameter.TagOrResourceId | The parameter Tag.n or ResourceId.n is needed. | The parameters Tag and ResourceId cannot all be empty. At least one of them is passed in. |
400 | InvalidParameter.Scope | The specified parameter Scope is not valid. | - |
400 | NumberExceed.ResourceIds | The ResourceIds parameter number is exceed. | - |
400 | NumberExceed.Tags | The Tags parameter number is exceed. | - |
400 | NumberExceed.CustomTags | The Custom Tags parameter number is exceed. Valid is 20. | - |
400 | Duplicate.TagKey | The specified parameter Tag.n.Key is duplicated. | - |
400 | InvalidParameter.ResourceType | The specified parameter ResourceType is not valid. | - |
400 | OperationDenied.QuotaExceed | The Tags parameter number is exceed. Valid is 20. | - |
404 | InvalidDbInstanceId.NotFound | Specified instance does not exist. | The specified instance does not exist |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-07-20 | API Description Update. The Error code has changed | View Change Details |