You need to enable JavaScript to run this app.
文档中心
云服务器

云服务器

复制全文
下载 pdf
标签
TagResources - 创建标签 (新版)
复制全文
下载 pdf
TagResources - 创建标签 (新版)
调用 TagResources 接口为一个或多个资源添加用户标签。​
使用说明​
注意​
  • 当前页面为新版标签接口,强烈推荐新用户使用,了解更多。​
  • 现有旧版标签接口功能依然保持,未来可能停止维护,如您仍需使用旧版接口请参考:​
注意事项​
  • 单个资源最多可以添加50个标签,单次调用该接口最多支持添加20个标签。​
  • 为同一个资源重复添加相同标签键的标签,则新标签值会自动覆盖原标签值。​
  • “删除中”的资源不允许添加标签。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:TagResources​
要执行的操作,取值:TagResources。​
​
Version string 必选 示例值:2020-04-01​
API的版本,取值:2020-04-01。​
​
ResourceIds.N string[] 必选 示例值:i-l8u0p77yseabkpak****​
资源ID。​
  • 参数 - N:表示资源的序号,取值范围:1~50。​
  • 多个资源之间用&分隔。​
​
ResourceType string 必选 示例值:instance​
资源类型,取值:​
  • instance:实例​
  • image:镜像​
  • reservedinstance:预留实例券​
  • scheduledinstance:弹性预约实例​
  • keypair:密钥对​
​
Tags.N.Key string[] 必选 示例值:k1​
为资源添加的用户标签的标签键。​
  • 参数 - N:表示标签键的序号,取值范围:1~20。​
  • 多个标签键之间用&分隔。​
命名规则如下:​
  • 不能以任何大小写形式的volc:或sys:开头。​
volc:或sys:开头为系统预留标签键禁止创建。​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 长度限制在1~128个字符之间。​
​
Tags.N.Value string[] 可选 示例值:v1​
为资源添加的用户标签的标签值。​
  • 参数 - N:表示标签值的序号,取值范围:1~20。​
  • 多个标签值之间用&分隔。​
命名规则如下:​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 允许为空,长度限制在0~256个字符之间。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
RequestId string 示例值:20230810120154605002C8D8D494A3****​
请求ID。​
​
​
​
请求示例​
​
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​
​
​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "202610191733070460942250942BC625",​
"Action": "TagResources",​
"Version": "2020-04-01",​
"Service": "ecs",​
"Region": "cn-beijing"​
},​
"Result": {​
"RequestId": "20230810120154605002C8D8D494A3****"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
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.​
幂等参数不一致。​
400​
InvalidClientToken.Malformed​
The specified ClientToken is malformed.​
指定的ClientToken不合法。​
400​
InvalidResourceStatus​
The status of the specified resource does not support this request.​
当前资源的状态不支持此操作。​
400​
InvalidTagKey.Malformed​
The specified TagKey is malformed.​
指定的标签的键不合法。​
400​
InvalidTagValue.Malformed​
The specified TagValue is malformed.​
指定的标签的值不合法。​
400​
LimitExceeded.MaximumResourceIds​
You've reached the limit on the number of ResourceIds that you can set.​
指定的资源ID数量超过限制。​
400​
LimitExceeded.MaximumTags​
You've reached the limit on the number of tags that you can create.​
指定的标签数量超过最大限制。​
400​
QuotaExceeded.MaximumSystemTags​
You've reached the limit on the number of System Tags that you can create.​
已达到单个资源可创建系统标签上限。​
400​
QuotaExceeded.MaximumTags​
You've reached the limit on the number of Tags that you can create.​
已达到单个资源可创建标签上限。​
404​
InvalidResourceId.NotFound​
The specified ResourceId does not exist.​
指定资源不存在。​
404​
InvalidResourceType.NotFound​
The specified ResourceType does not exist.​
指定的资源类型不存在。​
404​
InvalidTag.NotFound​
The specified tag does not exist.​
指定的键值不存在。​
409​
InvalidTagKey.Conflict​
The specified TagKey already exists.​
指定的标签键已存在。​
412​
IdempotentProcessing​
The request uses the same client token as a previous one that is still in process.​
先前的幂等请求仍在处理中,请稍后重试。​
412​
OperationDenied.ResourceLocked​
The specified operation is denied as your resource is locked for another operation.​
指定的操作被拒绝,因为您的资源已被其他操作锁定。​
500​
InternalError​
An internal error has occurred.​
内部错误,请重试。如果多次尝试失败,请提交工单。​
​
​
最近更新时间:2026.10.19 19:19:40
这个页面对您有帮助吗?
有用
有用
无用
无用