You can call this operation to bind tags to one or more ApsaraDB for MongoDB instances.

You can create multiple tags and bind them to a large number of instances to classify and filter instances by tag.

  • A tag is a key-value pair. Keys in one account and region are different from each other. Different keys can be followed by the same value.
  • If the tag you entered does not exist, this tag is automatically created and bound to the target instance.
  • If a tag that has the same key is already bound to the instance, the new tag will overwrite the existing tag.
  • You can bind up to 20 tags to an instance.
  • You can bind tags to up to 50 instances when you perform 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 No 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.

ResourceId.N RepeatList Yes dds-bpxxxxxxxx

The ID of the instance.

Note

The ID of the SLB instance specified by the rule. For example,

  • ResourceId.1 the ID of the first instance.
  • ResourceId.2 the ID of the second instance.
ResourceType String Yes INSTANCE

The type of the resource. Set the value to INSTANCE.

Tag.N.Key String No Development team

The key of the tag.

Note

N indicates the sequence of the key for a tag. For example,

  • Tag.1.Key specifies the key of the first tag.
  • Tag.2.Key the key of the second tag.
Tag.N.Value String No Environment 4.0

The value of the tag.

Note

N indicates the sequence of the tag. For example,

  • Tag.1.Value the value of the first input tag.
  • Tag.2.Value the value of the second tag is passed in.

Response parameters

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

The ID of the request.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/? Action=TagResources
&RegionId=cn-hangzhou
&ResourceType=INSTANCE
&ResourceId.1=dds-bpxxxxxxxx
&ResourceId.2=dds-bpxxxxxxxx
&Tag.1.Key=Development team
&Tag1.Value=Environment 4.0
&Tag.2.Key=Service Group
&Tag2.Value=Log service
&<Common request parameters>

Sample success responses

XML format

<RequestId>0FDDC511-7252-4A4A-ADDA-5CB1BF63873D</RequestId>

JSON format

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

Error codes

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