绑定标签
描述
Tag 容许被创建在 ECS 的实例、磁盘、快照、镜像、安全组上。
每个资源最多可以绑定 10 个 Tag。
如果要绑定 Tag 的 Key 在指定的资源上已经存在,则覆盖 Value。
Tag.n.Key 与 Tag.n.Value 必须一一匹配。
请求参数
名称 | 类型 | 是否必须 | 描述 | Action String 是 操作接口名,AddTags。 Regio
nId String 是 资源所属地域。 ResourceId String 是 要创建 Tag 的资源 ID。 ResourceType String 是 资源类型: image instance snapshot disk securitygroup 所有值均为小写。 Tag.n.Key String 是 标签 key,n 从 1 开始,最大为 5。
最多支持 64 个字符
不支持 aliyun 开头
不支持 http:// 和 https:// 开头
不允许为空字符串。 Tag.n.Value String 是 标签 value,n 从 1 开始,最大为 5。
最多支持 128 个字符
不支持 aliyun 开头
不支持 http:// 和 https:// 开头
允许为空字符串。
返回参数
名称 | 类型 | 描述 | RequestId String 请求 ID
错误码
错误代码 | 描述 | Http状态码 | 语义 | MissingParameter The input parameter "ResourceId" that is mandatory for processing this request is not supplied. 400 ResourceId 参数未指定 InvalidResourceId.NotFound The specified ResourceId is not found in our records 404 指定的 ResourceId 不存在 MissingParameter The input parameter "RegionId" that is mandatory for processing this request is not supplied. 400 Regio
nId 参数未指定 InvalidRegionId.NotFound The Regio
nId provided does not exist in our records. 404 指定的 Regio
nId 不存在 MissingParameter The input parameter "ResourceType" that is mandatory for processing this request is not supplied. 400 ResourceType 参数未指定 InvalidResourceType.NotFound The ResourceType provided does not exist in our records. 404 指定的 ResourceType 不存在 MissingParameter.TagKey The input parameter "Tag.n.Key" that is mandatory for processing this request is not supplied. 400 Tag.n.Key 参数未指定 InvalidTagKey.Malformed The specified Tag.n.Key is not valid 400 指定的 Tag.n.Key 不合法 MissingParameter.TagValue The input parameter "Tag.n.Value" that is mandatory for processing this request is not supplied. 400 Tag.n.Value 参数未指定 InvalidTagValue.Malformed The specified Tag.n.Value is not valid 400 指定的 Tag.n.Value 不合法 OperationDenied.QuotaExceed The quota of tags on resource is beyond permitted range 400 资源上的用户 Tag 已经超过 10 个 InvalidTag.Mismatch The specified Tag.n.Key and Tag.n.Value are not match 400 Tag.n.Key 和 Tag.n.Value 没有一一对应 InvalidTagCount The specified tags are beyond the permitted range 400 指定的 Tag 数超过了 5 个 InvalidResourceId.NotSupported The specified ResourceId does not support tagging 403 指定的资源 ID 不支持打 Tag
示例
请求示例
https://ecs.aliyuncs.com/?Action=AddTags
&ResourceId=s-946ntx4wr
&ResourceType=snapshot
&RegionId=cn-shenzhen
&Tag.1.Key=test
&Tag.1.Value=api
&<公共请求参数>
返回示例
