CreateImage
Description
call CreateImage to create a custom image. You can use the created custom image to create an ECS instance (RunInstances) or change the system disk (ReplaceSystemDisk) of the instance.
Request Method
POST
Request Path
/apsara/route/Ecs/CreateImage
Request Parameters Common Parameters
| Name | Location | Type | Required | Sample value | Description |
|---|---|---|---|---|---|
| Description | BODY | string | No | ImageTestDescription | description information of the image. 2 to 256 English or Chinese characters in length and cannot start with http:// or https. default value: empty. |
| Tag.N.key | BODY | string | No | null | the tag key of the mirror. Description To improve compatibility, we recommend that you use the Tag.N.Key parameter as much as possible. |
| Tag.N.Key | BODY | string | No | KeyTest | the tag key of the mirror. The value range of n is 1~20. Once the value is passed in, an empty string is not allowed. it can be up to 128 characters in length. it cannot start with aliyun or acs: and cannot contain http:// or https://. |
| Platform | BODY | string | No | CentOS | After specifying the system disk for mirroring the snapshot of the data disk, you need to determine the operating system release of the system disk through the Platform. Value range: CentOS Ubuntu SUSE OpenSUSE RedHat Debian CoreOS Aliyun Linux Windows Server 2012 Windows 7 Customized Linux Others Linux (default) |
| Architecture | BODY | string | No | x86_64 | After specifying the system disk for mirroring the data disk snapshot, the system architecture of the system disk needs to be determined by Architecture. Value range: i386 x86_64 (default) |
| ResourceGroupId | BODY | string | No | rg-bp67acfmxazb4p**** | the ID of the enterprise resource group where the custom image is located. |
| InstanceId | BODY | string | No | i-bp1g6zv0ce8oghu7**** | instance ID. |
| DiskDeviceMapping.N.Device | BODY | string | No | /dev/vdb | specify the device name of DiskDeviceMapping.N in the custom image. Value range: other cloud disks (such as SSD cloud disks, efficient cloud disks, and ESSD cloud disks):/dev/vda ~/dev/vdz ordinary cloud disk:/dev/xvda ~/dev/xvdz |
| version | BODY | string | No | 2016-01-01 | version of api |
| DiskDeviceMapping.N.SnapshotId | BODY | string | No | s-bp17441ohwkdca0**** | creates a custom image based on the specified snapshot. |
| SnapshotId | BODY | string | No | s-bp17441ohwkdca0**** | creates a custom image based on the specified snapshot. |
| ImageName | BODY | string | No | TestCentOS | image name. The length is 2~128 English or Chinese characters. It must start with a letter or Chinese, and cannot start with http:// or https. It can contain numbers, colons (:), underscores (_), or hyphens (-). default value: empty. |
| DiskDeviceMapping.N.Size | BODY | integer | No | 2000 | DiskDeviceMapping.N The size of the cloud disk, in GiB. The value and default value of DiskDeviceMapping.N.Size are related to the DiskDeviceMapping.N.SnapshotId: If no SnapshotId is specified, the Size value and default value are: ordinary cloud disk: 5~2000GiB, the default is 5 other cloud disks: 20~32768GiB, default is 20 if SnapshotId is specified, the value of Size must be greater than or equal to the size of the SnapshotId, which defaults to the size of the SnapshotId. |
| DiskDeviceMapping.N.DiskType | BODY | string | No | system | specify the cloud disk type of DiskDeviceMapping. n. in the new image. You can use this parameter to use a data disk snapshot as the system disk of the mirror. If you do not specify this parameter, the default type is the cloud disk type corresponding to the snapshot. Value range: system: system disk data: data disk |
| Tag.N.value | BODY | string | No | null | the tag value of the mirror. description to improve compatibility, it is recommended that you try to use the Tag.N.Value parameter. |
| regionId | BODY | string | Yes | No sample value for this parameter. | region id |
| Tag.N.Value | BODY | string | No | ValueTest | the tag value of the mirror. The value range of n is 1~20. Once the value is passed in, an empty string is allowed. it can be up to 128 characters and cannot start with acs: and cannot contain http:// or https://. |
| RegionId | BODY | string | Yes | cn-qingdao-env17-d01 | the region ID where the image is located. You can call the DescribeRegions to view the latest Alibaba Cloud region list. |
| ClientToken | BODY | string | No | 123e4567-e89b-12d3-a456-426655440000 | Ensure request idempotence. Generate a parameter value from your client to ensure that the parameter value is unique between different requests. ClientToken only supports ASCII characters and cannot exceed 64 characters. For more details, please refer to the section on how to ensure idempotence in the cloud server ECS development guide. |
Return data
| Name | Type | Sample value | Description |
|---|---|---|---|
| RequestID | string | 1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC | Request id |
Example
Successful Response example
{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}
Failed Response example
{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}
}