You need to enable JavaScript to run this app.
最新活动
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们
导航

CreateImage

最近更新时间2023.07.12 14:11:16

首次发布时间2022.09.02 08:59:36

调用 CreateImage 接口通过实例创建自定义镜像。

  • 基于性能型SSD云盘的实例创建自定义镜像,必须先停止实例,方可调用本接口。
  • 基于极速型SSD云盘的实例创建自定义镜像,无需停止实例,可直接调用本接口。
  • 实例所在地域下自定义镜像数量不超过50个。

请求参数

名称类型是否必填示例值描述
ActionStringCreateImage要执行的操作,取值:CreateImage。
VersionString2020-04-01接口的版本,取值:2020-04-01。
InstanceIdStringi-3teco18f1w5a71******实例ID。您可以调用DescribeInstances接口查询获取实例ID。

ImageName

String

image-1

镜像名称。

  • 必须以字母、汉字开头。
  • 只能包含中文、字母、数字、下划线“_”、中划线“-”、英文句号“.”。
  • 长度限制为1 ~ 128个字符。

Description

String

This is my first image

镜像描述。

  • 必须以字母、汉字开头。
  • 只能包含中文、字母、数字、下划线“_”、中划线“-”、等号“=”、英文逗号“,”、英文句号“.”、中文逗号“,”、中文句号“。”和空格。
  • 长度限制为0~255个字符。
  • 不填默认为空。

ProjectName

String

default

资源所属项目。

注意

调用接口账号若仅拥有部分项目权限,本参数必填。授权账号操作项目详情,可查看管理项目权限

Tags.N.Key

String

image-tag-key-1

镜像标签的标签键。

  • 参数 - N:表示标签键的序号,取值范围:1~20。
  • 多个标签键之间用&分隔。

说明

  • 命名规则如下:
    • 不能以volc:的任意大小写组合开头。
    • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。
    • 长度限制在1~128个字符之间。
  • 同一资源的标签键不允许重复。

Tags.N.Value

String

image-tag-value-1

镜像标签的标签值。

  • 参数 - N:表示标签值的序号,取值范围:1~20。
  • 多个标签值之间用&分隔。

说明

  • 命名规则如下:
    • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。
    • 允许为空,长度限制在0~256个字符之间。
  • 如果传入该参数,则必须先传入Tags.N.Key

返回数据

名称类型示例值描述
ImageIdStringimage-3teco18f1w5a71******镜像ID。

请求示例

GET /?Action=CreateImage&Version=2020-04-01&InstanceId=i-3teco18f1w5a71******&ImageName=image-1 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
ServiceName: ecs

返回示例

{
    "ResponseMetadata":{
        "RequestId":"2021110417394001022514606307*****",
        "Action":"CreateImage",
        "Version":"2020-04-01",
        "Service":"ecs",
        "Region":"cn-beijing"
    },
    "Result": {
        "ImageId": "image-3teco18f1w5a71******"
    }
}

错误码

HttpCode错误码错误信息描述
400InvalidInstanceStatusThe status of the specified instance does not support this request.当前实例的状态不支持此操作。
400MissingParameter.ImageNameThe required parameter ImageName is not supplied.镜像名称不能为空。
400InvalidImageName.MalformedThe specified ImageName is malformed.指定的镜像名称不合法。
400InvalidDescription.MalformedThe specified Description is malformed.指定的镜像描述不合法。
400InvalidInstanceVolumeStatusForCreateImage.UnsupportedThe specified instance volume status cannot be used for CreateImage.指定的实例云盘状态不支持创建自定义镜像。
400InvalidParameterCombinationIndicates an incorrect combination of parameters, or a missing parameter.参数组合错误或缺失。
400LimitExceeded.MaximumSystemVolumeSizeYou've reached the limit on the number of system volume size that you can create.指定的系统盘大小(GiB)超出限制。
400LimitExceeded.MaximumImageCountYou've reached the limit on the number of image that you can create.可拥有的自定义镜像个数超过限制。
400InvalidTagKey.MalformedThe specified TagKey is malformed.指定的标签的键不合法。
400InvalidTagValue.MalformedThe specified TagValue is malformed.指定的标签的值不合法。
400LimitExceeded.MaximumTagsYou've reached the limit on the number of tags that you can create.指定的标签数量超过最大限制。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
404InvalidProject.NotFoundThe specified Project does not exist.指定的Project不存在。
409InvalidTagKey.ConflictThe specified TagKey already exists.指定的标签键已存在。
412OperationDenied.ResourceLockedThe specified operation is denied as your resource is locked for another operation.指定的操作被拒绝,因为您的资源已被其他操作锁定。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。