Adds tags to one or more ApsaraDB for MongoDB instances.

If you have a large number of instances, you can create and add multiple tags to classify and 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 a tag that has the same key is already bound to the instance, the new tag overwrites the existing tag.
  • You can add up to 20 tags to each instance.
  • You can bind tags to up to 50 instances each time you call the operation.

Debugging

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. You can call the DescribeDBInstanceAttribute operation to query the region ID of the instance.

ResourceType String Yes INSTANCE

The resource type. Set the value to INSTANCE.

ResourceGroupId String No rg-acfmyiu4ekp****

The ID of the resource group.

ResourceId.N String Yes dds-bp1fa5efaa93****

Instance IDs.

Note

N specifies the serial number of the instance. The following example shows how to calculate consumption intervals:

  • ResourceId.1 indicates the ID of the first instance.
  • ResourceId.2 indicates the ID of the second instance.
Tag.N.Key String Yes Development team

The keys of the tags.

Note

N specifies the serial number of the tag. The following example shows how to calculate consumption intervals:

  • Tag.1.Key specifies the key of the first tag.
  • Tag.2.Key specifies the key of the second tag.
Tag.N.Value String Yes MongoDB 4.0 environment

The values of the tags.

Note

N specifies the serial number of the tag. The following example shows how to calculate consumption intervals:

  • Tag.1.Value specifies the value of the first tag.
  • Tag.2.Value specifies the value of the second tag.

Response parameters

Parameter Type Example Description
RequestId String 0FDDC511-7252-4A4A-ADDA-5CB1BF63****

The ID of the request.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/?Action=TagResources
&RegionId=cn-hangzhou
&ResourceType=INSTANCE
&ResourceGroupId=rg-acfmyiu4ekp****
&ResourceId=["dds-bp1fa5efaa93****"]
&Tag=[{"Key":"Development team","Value":"MongoDB 4.0 environment"}]
&<Common request parameters>

Sample responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<TagResourcesResponse>
    <RequestId>0FDDC511-7252-4A4A-ADDA-5CB1BF63****</RequestId>
</TagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "0FDDC511-7252-4A4A-ADDA-5CB1BF63****"
}

Error codes

For a list of error codes, see Service error codes.