All Products
Search
Document Center

ApsaraDB RDS:AddTagsToResource

Last Updated:Sep 13, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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.
OperationAccess levelResource typeCondition keyAssociated operation
rds:AddTagsToResourcecreate
  • DBInstance
    acs:rds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
  • rds:ResourceTag
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

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
proxyIdstringNo

The ID of the proxy mode.

API
RegionIdstringYes

The region ID. You can call the DescribeRegions operation to query the most recent region list.

cn-hagnzhou
DBInstanceIdstringYes

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
TagsstringNo

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.keystringNo

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.keystringNo

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.keystringNo

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.keystringNo

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.keystringNo

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.valuestringNo

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.valuestringNo

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.valuestringNo

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.valuestringNo

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.valuestringNo

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
ResourceGroupIdstringNo

The resource group ID.

rg-acfmy*****

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

224DB9F7-3100-4899-AB9C-C938BCCB43E7

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400ForbiddenUser 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.
401InvalidTagKey.MalformedMalformed tag key.The format of tag key is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-20The Error code has changed. The request parameters of the API has changedView Change Details
2023-07-25The Error code has changedView Change Details
2022-06-23API Description Update. The Error code has changedView Change Details