You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Tags
TagResources - Creates tags (new version)
Copy page
Download PDF
TagResources - Creates tags (new version)
Call the TagResources operation to associate user tags with one or multiple resources.​
Usage notes​
Warning​
  • This page describes the tag-targeted operation of the new version, which is strongly recommended for new users. Learn more.​
  • Tag-targeted operations of the earlier version may no longer be maintained in the future. If you still need to use them, refer to:​
Usage notes​
  • One resource can be associated with up to 50 tags, and up to 20 tags can be associated per interface call.​
  • For the same resource, if you add a tag with an existing tag key, the new tag value automatically overrides the original one.​
  • Tags cannot be associated with resources in the "Deleting" status.​
Debugging​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
Only the request parameters specific to this operation and some common parameters are listed below. For more information, refer to Common parameters.​
Action string required Sample value: TagResources​
The action that you want to perform. Value: TagResources.​
​
Version string required Sample value: 2020-04-01​
The version of the API. Valid value: 2020-04-01.​
​
ResourceIds.N string[] required Sample value: i-l8u0p77yseabkpak****​
The resource ID.​
  • Argument - N: indicates the serial number of the resource. Valid range: 1-50.​
  • Separate resources with ampersands (&).​
​
ResourceType string required Sample value: instance​
The resource type. Valid values:​
  • instance: instance​
  • image: image​
  • reservedinstance: Reserved Instances (RI)​
  • scheduledinstance: Elastic Scheduled Instances (ESI)​
  • keypair: key pair​
​
Tags.N.Key string[] required Sample value: k1​
The tag key of the tag associated with the resource.​
  • Argument - N: specifies the serial number of the tag key. Valid range: 1–20.​
  • Separate multiple tag keys with &.​
Naming rules:​
  • Cannot start with volc: or sys: in any case form.​
Tags that start with volc: or sys: are reserved for the system. You cannot create tags starting with them.​
  • Only language characters, digits, spaces, and English symbols of "_", ".", ":", "/", "=", "+", "-", and "@" are allowed.​
  • It must be 1 to 128 characters in length.​
​
Tags.N.Value string[] Optional Sample value: v1​
The tag value of the tag associated with the resource.​
  • Argument - N: specifies the serial number of the tag value. Valid range: 1–20.​
  • Separate multiple tag values with ampersands (&).​
Naming rules:​
  • Only language characters, digits, spaces, and English symbols of "_", ".", ":", "/", "=", "+", "-", and "@" are allowed.​
  • It must be 0 to 256 characters in length.​
​
​
​
Response parameters​
Only the response parameters specific to this operation are listed below. For more information, refer to the response structure.​
RequestId string Sample value: 20230810120154605002C8D8D494A3****​
The request ID.​
​
​
​
Sample request​
​
GET /?Action=TagResources&Version=2020-04-01&ResourceIds.1=i-l8u0p77yseabkpak****&ResourceType=instance HTTP/1.1​
Host: ecs.cn-beijing.volcengineapi.com​
X-Date: 20261019T111501Z​
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20261019/cn-beijing/ecs/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f​
​
Sample response​
​
{​
"ResponseMetadata": {​
"RequestId": "202610191733070460942250942BC625",​
"Action": "TagResources",​
"Version": "2020-04-01",​
"Service": "ecs",​
"Region": "cn-beijing"​
},​
"Result": {​
"RequestId": "20230810120154605002C8D8D494A3****"​
}​
}​
​
Error codes​
The table below lists the business-related error codes of the operation. For more information, refer to Common error codes.​
​
Status code​
Error code​
Error message​
Description​
400​
IdempotentParameterMismatch​
The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical.​
The idempotent parameters are inconsistent.​
400​
InvalidClientToken.Malformed​
The specified ClientToken is malformed.​
The specified ClientToken is invalid.​
400​
InvalidResourceStatus​
The status of the specified resource does not support this request.​
The current status of the resource does not support this operation.​
400​
InvalidTagKey.Malformed​
The specified TagKey is malformed.​
The specified tag key is invalid.​
400​
InvalidTagValue.Malformed​
The specified TagValue is malformed.​
The specified tag value is invalid.​
400​
LimitExceeded.MaximumResourceIds​
You've reached the limit on the number of ResourceIds that you can set.​
The specified number of resource IDs exceeds the limit.​
400​
LimitExceeded.MaximumTags​
You've reached the limit on the number of tags that you can create.​
The specified tag number exceeds the maximum limit.​
400​
QuotaExceeded.MaximumSystemTags​
You've reached the limit on the number of System Tags that you can create.​
The upper limit of system tags that you can create for one resource is reached.​
400​
QuotaExceeded.MaximumTags​
You've reached the limit on the number of Tags that you can create.​
The upper limit of tags that you can create for one resource is reached.​
404​
InvalidResourceId.NotFound​
The specified ResourceId does not exist.​
The specified resource does not exist.​
404​
InvalidResourceType.NotFound​
The specified ResourceType does not exist.​
The specified resource type does not exist.​
404​
InvalidTag.NotFound​
The specified tag does not exist.​
The specified key value does not exist.​
409​
InvalidTagKey.Conflict​
The specified TagKey already exists.​
The specified tag key already exists.​
412​
IdempotentProcessing​
The request uses the same client token as a previous one that is still in process.​
The previous idempotent request is still in process. Please try again later.​
412​
OperationDenied.ResourceLocked​
The specified operation is denied as your resource is locked for another operation.​
The specified action was rejected because your resource has been locked by other actions.​
500​
InternalError​
An internal error has occurred.​
An internal error occurred. Try again. If multiple attempts fail, submit a ticket.​
​
​
Last updated: 2026.10.19 19:41:18