ImportImage
Description
call the ImportImage to import 1 copy of your local image file to the cloud server ECS and appear in the corresponding region as a custom image. You can use the imported image to create an ECS instance (RunInstances) or change the system disk (ReplaceSystemDisk) of the instance.
Request Method
POST
Request Path
/apsara/route/Ecs/ImportImage
Request Parameters Common Parameters
Name | Location | Type | Required | Sample value | Description |
---|---|---|---|---|---|
Description | BODY | string | No | TestDescription | description information of the image. 2 to 256 English or Chinese characters in length and cannot start with http:// or https. default value: empty. |
DiskDeviceMapping.N.OSSObject | BODY | string | No | CentOS_5.4_32.raw | the file name (key) of the OSS Object where the image file is located. |
Architecture | BODY | string | No | x86_64 | system architecture. Value range: i386 x86_64 (default) |
Platform | BODY | string | No | Aliyun | operating system release. Value range: CentOS Ubuntu SUSE OpenSUSE Debian CoreOS Aliyun Windows Server 2003 Windows Server 2008 Windows Server 2012 Others Linux (default) Customized Linux |
DiskDeviceMapping.N.DiskImageSize | BODY | integer | No | 80 | image size. You must ensure that system disk space ≥ file system space. Value range: when N = 1, that is, the system disk: 5~500GiB when N = 2~17, that is, data disk: 5~1000GiB when importing an image, the system automatically detects the size of the image, subject to the detection result. |
DiskDeviceMapping.N.DiskImSize | BODY | integer | No | 80 | custom image size. Description This parameter is about to be deprecated. To improve compatibility, please try to use the DiskDeviceMapping.N.DiskImageSize parameter. |
DiskDeviceMapping.N.Device | BODY | string | No | null | specify the device name of DiskDeviceMapping.N.Device in the custom image. Description This parameter is about to be stopped. In order to improve code compatibility, it is recommended that you try not to use this parameter. |
version | BODY | string | No | 2016-01-01 | version of api |
LicenseType | BODY | string | No | Auto | After the image is imported, the license type used by the operating system is activated. Value range: Auto (default): Alibaba Cloud detects the source operating system and assigns a license. In automatic mode, the system preferentially searches for the Platform whether there is a license for Aliyun official channel and assigns it to the imported image. If there is no such license, it will switch to BYOL(Bring Your Own License) mode. Aliyun: according to your Platform, use the alibaba cloud official channel license. BYOL: The license that comes with the source operating system. When using BYOL, you must ensure that your license key supports the use of Alibaba Cloud. |
ImageName | BODY | string | No | ImageTestName | 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. |
RoleName | BODY | string | No | AliyunECSImageImportDefaultRole | the name of the RAM role used when importing the image. |
regionId | BODY | string | Yes | No sample value for this parameter. | region id |
OSType | BODY | string | No | linux | operating system platform type. Value range: windows linux (default) |
RegionId | BODY | string | Yes | cn-qingdao-env17-d01 | the region ID from the definition mirror. you can call the DescribeRegions to view the latest alibaba cloud region list. |
DiskDeviceMapping.N.Format | BODY | string | No | qcow2 | image format. Value range: RAW VHD qcow2 Default value: None, indicating that Alibaba Cloud automatically detects the image format, subject to the detected format. |
DiskDeviceMapping.N.OSSBucket | BODY | string | No | ecsimageos | OSS Bucket where the image file is located. description before importing the image to the OSS bucket for the first time, please refer to the interface description section to add a RAM authorization policy, otherwise, an error NoSetRoletoECSServiceAcount will be reported. |
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
}
}