Skip to main content

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

NameLocationTypeRequiredSample valueDescription
DescriptionBODYstringNoImageTestDescriptiondescription 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.keyBODYstringNonullthe 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.KeyBODYstringNoKeyTestthe 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://.
PlatformBODYstringNoCentOSAfter 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)
ArchitectureBODYstringNox86_64After 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)
ResourceGroupIdBODYstringNorg-bp67acfmxazb4p****the ID of the enterprise resource group where the custom image is located.
InstanceIdBODYstringNoi-bp1g6zv0ce8oghu7****instance ID.
DiskDeviceMapping.N.DeviceBODYstringNo/dev/vdbspecify 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
versionBODYstringNo2016-01-01version of api
DiskDeviceMapping.N.SnapshotIdBODYstringNos-bp17441ohwkdca0****creates a custom image based on the specified snapshot.
SnapshotIdBODYstringNos-bp17441ohwkdca0****creates a custom image based on the specified snapshot.
ImageNameBODYstringNoTestCentOSimage 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.SizeBODYintegerNo2000DiskDeviceMapping.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.DiskTypeBODYstringNosystemspecify 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.valueBODYstringNonullthe tag value of the mirror. description to improve compatibility, it is recommended that you try to use the Tag.N.Value parameter.
regionIdBODYstringYesNo sample value for this parameter.region id
Tag.N.ValueBODYstringNoValueTestthe 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://.
RegionIdBODYstringYescn-qingdao-env17-d01the region ID where the image is located. You can call the DescribeRegions to view the latest Alibaba Cloud region list.
ClientTokenBODYstringNo123e4567-e89b-12d3-a456-426655440000Ensure 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

NameTypeSample valueDescription
RequestIDstring1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DCRequest id

Example

Successful Response example

{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}