Creates tags and adds the tags to specified resources.

Note You can add up to 20 tags to each resource. Before you add tags to a resource, Alibaba Cloud checks the number of existing tags of the resource. If the quota is reached, an error message is returned.

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 ID of the region where the Classic Load Balancer (CLB) instance is created.

You can call the DescribeRegions operation to query region IDs.

ResourceId.N RepeatList Yes lb-bp16qjewdsunr41m1****

The ID of Resource N. Valid values of N: 1 to 20.

ResourceType String Yes instance

The type of resource to which you want to add tags. Valid values:

  • instance: a CLB instance
  • certificate: a certificate
  • acl: a network access control list (ACL)
Tag.N.Key String No FinanceDept

The key of Tag N. Valid values of N: 1 to 20. The tag key cannot be an empty string.

It can contain 1 to 64 characters in length, and cannot start with acs: or aliyun. It cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The value of Tag N. Valid values of N: 1 to 20. The tag value can be an empty string.

It can contain 1 to 128 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

Response parameters

Parameter Type Example Description
RequestId String C46FF5A8-C5F0-4024-8262-B16B639225A0

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=TagResources
&RegionId=cn-hangzhou
&ResourceId.1=lb-bp16qjewdsunr41m1****
&ResourceType=instance
&Tag.1.Key=FinanceDept
&Tag.1.Value=FinanceJoshua
&<Common request parameters>

Sample success responses

XML format

<TagResourcesResponse>
  <RequestId>C46FF5A8-C5F0-4024-8262-B16B639225A0</RequestId>
</TagResourcesResponse>

JSON format

{
	"RequestId":"C46FF5A8-C5F0-4024-8262-B16B639225A0"
}

Error codes

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