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

云服务器

复制全文
下载 pdf
镜像
CreateImage - 创建镜像
复制全文
下载 pdf
CreateImage - 创建镜像
调用 CreateImage 接口,通过实例创建自定义镜像。​
注意事项​
  • 使用本功能的前提条件及注意事项,可查看操作说明。​
  • 实例所在地域下自定义镜像数量不超过50个。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:CreateImage​
要执行的操作,取值:CreateImage。​
​
Version string 必选 示例值:2020-04-01​
API的版本,取值:2020-04-01。​
​
CreateWholeImage boolean 可选 示例值:false​
是否创建整机镜像。取值:​
  • false:默认值,不创建整机镜像。​
  • true:创建整机镜像。​
​
Description string 可选 示例值:This is my first image​
镜像描述。​
  • 必须以字母、汉字开头。​
  • 只能包含中文、字母、数字、下划线“_”、中划线“-”、等号“=”、英文逗号“,”、英文句号“.”、中文逗号“,”、中文句号“。”和空格。​
  • 长度限制为0~255个字符。​
  • 不填默认为空。​
​
ImageName string 必选 示例值:image-1​
镜像名称。​
  • 必须以字母、汉字开头。​
  • 只能包含中文、字母、数字、下划线“_”、中划线“-”、英文句号“.”。​
  • 长度限制为1 ~ 128个字符。​
​
InstanceId string 可选 示例值:i-3teco18f1w5a71******​
实例ID。您可以调用DescribeInstances接口查询获取实例ID。​
说明​
本参数与SnapshotId、SnapshotGroupId参数,三选一必填。​
​
NeedDetection boolean 可选 示例值:true​
是否进行镜像检测。取值:​
  • true:默认值,进行检测。​
  • false:不进行检测。​
说明​
镜像检测功能正在邀测中,如需试用,请联系客户经理申请。​
​
ProjectName string 可选 示例值:default​
资源所属项目。​
注意​
调用接口账号若仅拥有部分项目权限,本参数必填。授权账号操作项目详情,可查看管理项目权限。​
​
SnapshotGroupId string 可选 示例值:sg-120931dkslfkl****​
快照一致性组ID,表示使用快照一致性组创建自定义镜像。您可以调用DescribeSnapshotGroups接口查询获取。​
说明​
本参数与SnapshotId、InstanceId参数,三选一必填。​
​
SnapshotId string 可选 示例值:snap-120931dkslfkl****​
系统盘快照ID,表示使用系统盘快照创建自定义镜像。您可以调用DescribeSnapshots接口查看获取。​
说明​
本参数与InstanceId、SnapshotGroupId参数,三选一必填。​
​
Tags.N.Key string[] 可选 示例值:Tags.1.Key=image-tag-key-1&Tags.2.Key=image-tag-key-2​
镜像标签的标签键。​
  • 参数 - N:表示标签键的序号,取值范围:1~20。​
  • 多个标签键之间用&分隔。​
说明​
  • 命名规则如下:​
  • 不能以volc:、sys:的任意大小写组合开头。​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 长度限制在1~128个字符之间。​
  • 同一资源的标签键不允许重复。​
​
Tags.N.Value string[] 可选 示例值:Tags.1.Value=image-tag-value-1&Tags.2.Value=image-tag-value-2​
镜像标签的标签值。​
  • 参数 - N:表示标签值的序号,取值范围:1~20。​
  • 多个标签值之间用&分隔。​
说明​
  • 命名规则如下:​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 允许为空,长度限制在0~256个字符之间。​
  • 如果传入该参数,则必须先传入Tags.N.Key。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
ImageId string 示例值:image-3teco18f1w5a71******​
镜像ID。​
​
​
​
请求示例​
​
GET /?Action=CreateImage&Version=2020-04-01&InstanceId=i-3teco18f1w5a71******&ImageName=image-1 HTTP/1.1​
Host: ecs.cn-beijing.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******"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
400​
InvalidArgument​
The specified argument is invalid.​
指定的参数不合法。​
400​
InvalidDescription.Malformed​
The specified Description is malformed.​
指定的描述不合法。​
400​
InvalidImageName.Malformed​
The specified ImageName is malformed.​
指定的镜像名称不合法。​
400​
InvalidInstanceStatus​
The status of the specified instance does not support this request.​
当前实例的状态不支持此操作。​
400​
InvalidInstanceVolumeStatusForCreateImage.Unsupported​
The specified instance volume status cannot be used for CreateImage.​
指定的实例云盘状态不支持创建自定义镜像。​
400​
InvalidParameterCombination​
Indicates an incorrect combination of parameters, or a missing parameter.​
参数组合错误或缺失参数。​
400​
InvalidPlatformForDetect.UnSupported​
The specified image platform cannot be used for detect.​
指定的镜像平台不支持检测。​
400​
InvalidSnapshotIdOrSnapshotGroupIdForCreateImage.UnSupported​
The specified SnapshotId or SnapshotGroupId cannot be used for CreateImage.​
指定的快照或一致性组不支持创建自定义镜像。​
400​
InvalidSnapshotStatus​
The status of the specified snapshot does not support this request.​
指定的快照状态不支持此操作。​
400​
InvalidTagKey.Malformed​
The specified TagKey is malformed.​
指定的标签的键不合法。​
400​
InvalidTagValue.Malformed​
The specified TagValue is malformed.​
指定的标签的值不合法。​
400​
InvalidVolumeTypeForCreateImage.Unsupported​
The specified instance volume type cannot be used for CreateImage.​
指定的实例云盘类型不支持创建自定义镜像。​
400​
LimitExceeded.MaximumImageCount​
You've reached the limit on the number of image that you can create.​
可创建的自定义镜像个数超过限制。​
400​
LimitExceeded.MaximumSnapshotCount​
You've reached the limit on the number of snapshot that you can create.​
指定的云盘快照数量超过限制。​
400​
LimitExceeded.MaximumSnapshotGroupTotalSize​
You've reached the limit on the total size of snapshot group that you can create.​
指定的快照一致性组容量超过限制。​
400​
LimitExceeded.MaximumSystemVolumeSize​
The specified system volume size exceeds the limit.​
指定的系统盘大小(GiB)超出限制。​
400​
LimitExceeded.MaximumTags​
You've reached the limit on the number of tags that you can create.​
指定的标签数量超过最大限制。​
400​
MissingParameter.ImageName​
The required parameter ImageName is not supplied.​
镜像名称不能为空。​
404​
InvalidInstance.NotFound​
The specified instance does not exist.​
指定的实例不存在。​
404​
InvalidProject.NotFound​
The specified Project does not exist.​
指定的Project不存在。​
404​
InvalidSnapshotGroupId.NotFound​
The specified SnapshotGroupId does not exist.​
指定的快照一致性组Id不存在。​
404​
InvalidSnapshotId.NotFound​
The specified SnapshotId does not exist.​
指定的快照Id不存在。​
409​
InvalidTagKey.Conflict​
The specified TagKey already exists.​
指定的标签键已存在。​
412​
OperationDenied.ResourceLocked​
The specified operation is denied as your resource is locked for another operation.​
指定的操作被拒绝,因为您的资源已被其他操作锁定。​
412​
OperationDenied.SnapshotServiceUnavailable​
The specified operation is denied as Snapshot service is unavailable.​
指定的操作被拒绝,因为快照服务未开通。​
500​
InternalError​
An internal error has occurred.​
内部错误,请重试。如果多次尝试失败,请提交工单。​
​
​
最近更新时间:2026.05.20 10:28:55
这个页面对您有帮助吗?
有用
有用
无用
无用