Adds tags to an instance.
Operation description
Supported database engines
- MySQL
- PostgreSQL
- SQL Server
- MariaDB
Usage notes
- Each tag consists of a tag key and a tag value. The tag key is required, and the tag value is optional.
- The tag key and tag value cannot start with aliyun.
- The tag key and tag value are not case-sensitive.
- The maximum length of a tag key is 64 characters, and the maximum length of a tag value is 128 characters.
- A maximum of 10 tags can be added to each instance. Each tag that is added to the same instance must have a unique tag key. If you add a new tag to the instance and the key of the new tag is the same as that of an existing tag, the new tag overwrites the existing 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 |
---|---|---|---|---|
rds:AddTagsToResource | create | *DBInstance acs:rds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the generated token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. | ETnLKlblzczshOTUbOCzxxxxxxx |
proxyId | string | No | The ID of the proxy mode. | API |
RegionId | string | Yes | The region ID. You can call the DescribeRegions operation to query the most recent region list. | cn-hagnzhou |
DBInstanceId | string | Yes | The instance ID. 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 (,).
| rm-uf6wjk5xxxxxxx |
Tags | string | No | The tags that you want to add. Each tag consists of a tag key and a tag value. You can specify a maximum of five tags in the following format for each request: {"key1":"value1","key2":"value2"...}. Note
The tag key is required and the tag value is optional.
| {“key1”:”value1”,“key2”:””} |
Tag.1.key | string | No | The tag key of the first tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | key1 |
Tag.2.key | string | No | The tag key of the second tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | key2 |
Tag.3.key | string | No | The tag key of the third tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | key3 |
Tag.4.key | string | No | The tag key of the fourth tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | key4 |
Tag.5.key | string | No | The tag key of the fifth tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | key5 |
Tag.1.value | string | No | The tag value of the first tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | value1 |
Tag.2.value | string | No | The tag value of the second tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | value2 |
Tag.3.value | string | No | The tag value of the third tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | value3 |
Tag.4.value | string | No | The tag value of the fourth tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | value4 |
Tag.5.value | string | No | The tag value of the fifth tag that you want to add. Each tag consists of a tag key and a tag value. You can specify up to five tags in a single request. You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. | value5 |
ResourceGroupId | string | No | The resource group ID. | rg-acfmy***** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "224DB9F7-3100-4899-AB9C-C938BCCB43E7"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | Forbidden | User not authorized to operate on the specified resource, or this API does not support RAM. | The RAM user account does not have the required permissions. Grant the account the required permissions. |
401 | InvalidTagKey.Malformed | Malformed tag key. | The format of tag key is invalid. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-10-20 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-07-25 | The Error code has changed | View Change Details |
2022-06-23 | API Description Update. The Error code has changed | View Change Details |