You need to enable JavaScript to run this app.
导航

CreateImage

最近更新时间2024.03.22 16:45:43

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

调用 CreateImage 接口通过实例、快照或快照一致性组创建自定义镜像。

说明

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

调试

请求参数

名称类型是否必填示例值描述
ActionStringCreateImage要执行的操作,取值:CreateImage。
VersionString2020-04-01接口的版本,取值:2020-04-01。

InstanceId

String

i-3teco18f1w5a71******

实例ID。您可以调用DescribeInstances接口查询获取实例ID。

说明

本参数与SnapshotIdSnapshotGroupId参数,三选一必填。

NeedDetection

Boolean

true

是否进行镜像检测。取值:

  • true:默认值,进行检测。
  • false:不进行检测。

ImageName

String

image-1

镜像名称。

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

SnapshotGroupId

String

sg-120931dkslfkl****

快照一致性组ID,表示使用快照一致性组创建自定义镜像。您可以调用DescribeSnapshotGroups接口查询获取。

说明

本参数与SnapshotIdInstanceId参数,三选一必填。

SnapshotId

String

snap-31akybwsxi8rudc6****

系统盘快照ID,表示使用系统盘快照创建自定义镜像。您可以调用DescribeSnapshots接口查看获取。

说明

本参数与InstanceIdSnapshotGroupId参数,三选一必填。

CreateWholeImage

Boolean

false

是否创建整机镜像。取值:

  • false(默认):不创建整机镜像。
  • true:创建整机镜像。

说明

本功能正在邀测中,如需试用,请提交工单或联系客户经理申请。

Description

String

This is my first image

镜像描述。

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

ProjectName

String

default

资源所属项目。

注意

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

Tags.N.Key

String

image-tag-key-1

镜像标签的标签键。

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

说明

  • 命名规则如下:
    • 不能以volc:sys:的任意大小写组合开头。
    • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。
    • 长度限制在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.参数组合错误或缺失参数。
400InvalidPlatformForDetect.UnSupportedThe specified image platform cannot be used for detect.指定的镜像平台不支持检测。
400InvalidSnapshotIdOrSnapshotGroupIdForCreateImage.UnSupportedThe specified SnapshotId or SnapshotGroupId cannot be used for CreateImage.指定的快照或一致性组不支持创建自定义镜像。
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.指定的标签数量超过最大限制。
400InvalidInstanceTypeForCreateWholeImage.UnsupportedThe instance type for specified instance cannot be used for CreateWholeImage.指定的实例的计算规格不支持创建整机镜像。
400InvalidVolumeTypeForCreateWholeImage.UnSupportedThe specified VolumeType cannot be used for CreateWholeImage.指定的云盘类型不支持创建整机镜像。
400LimitExceeded.MaximumSnapshotGroupTotalSizeYou've reached the limit on the total size of snapshot group that you can create.指定的快照一致性组容量超过限制。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
404InvalidProject.NotFoundThe specified Project does not exist.指定的Project不存在。
404InvalidSnapshotGroupId.NotFoundThe specified SnapshotGroupId does not exist.指定的快照一致性组Id不存在。
404InvalidSnapshotId.NotFoundThe specified SnapshotId does not exist.指定的快照Id不存在。
409InvalidTagKey.ConflictThe specified TagKey already exists.指定的标签键已存在。
412OperationDenied.ResourceLockedThe specified operation is denied as your resource is locked for another operation.指定的操作被拒绝,因为您的资源已被其他操作锁定。
412OperationDenied.SnapshotServiceUnavailableThe specified operation is denied as Snapshot service is unavailable.指定的操作被拒绝,因为快照服务未开通。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。