Skip to main content

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

NameLocationTypeRequiredSample valueDescription
DescriptionBODYstringNoTestDescriptiondescription 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.OSSObjectBODYstringNoCentOS_5.4_32.rawthe file name (key) of the OSS Object where the image file is located.
ArchitectureBODYstringNox86_64system architecture. Value range: i386 x86_64 (default)
PlatformBODYstringNoAliyunoperating 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.DiskImageSizeBODYintegerNo80image 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.DiskImSizeBODYintegerNo80custom image size. Description This parameter is about to be deprecated. To improve compatibility, please try to use the DiskDeviceMapping.N.DiskImageSize parameter.
DiskDeviceMapping.N.DeviceBODYstringNonullspecify 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.
versionBODYstringNo2016-01-01version of api
LicenseTypeBODYstringNoAutoAfter 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.
ImageNameBODYstringNoImageTestNameimage 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.
RoleNameBODYstringNoAliyunECSImageImportDefaultRolethe name of the RAM role used when importing the image.
regionIdBODYstringYesNo sample value for this parameter.region id
OSTypeBODYstringNolinuxoperating system platform type. Value range: windows linux (default)
RegionIdBODYstringYescn-qingdao-env17-d01the region ID from the definition mirror. you can call the DescribeRegions to view the latest alibaba cloud region list.
DiskDeviceMapping.N.FormatBODYstringNoqcow2image 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.OSSBucketBODYstringNoecsimageosOSS 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

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
}

}