Creates one or more tags and associates the tags with one or more resources.

Note Up to 20 tags can be associated with an instance. Before a tag is associated with a resource, Alibaba Cloud verifies the number of existing tags of the specified resource and reports an error if the quota of tags is exceeded.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String Yes TagResources

The name of this action.

Value: TagResources

RegionId String Yes cn-hangzhou

The ID of the region to which the Server Load Balancer (SLB) instance belongs.

To query the region ID, call DescribeRegions.

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

The ID of the resource. Value range of N: 1 to 20.

ResourceType String Yes instance

The type of the resource. Valid values:

  • instance: SLB instance
  • certificate: certificate
  • acl: access control list
Tag.N.Key String No FinanceDept

The tag key of the resource. Value range of N: 1 to 20. If you specify this parameter, the value of this parameter cannot be a null string.

The value can be up to 64 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The tag value of the instance. Value range of N: 1 to 20. The value of this parameter can be a null string.

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

Response parameters

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

The ID of the request.

Examples

Request example


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

Response example

XML format

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

JSON format

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

Errors

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