You can import an on-premises image file to Alibaba Cloud to generate a custom image and use the custom image to create Elastic Compute Service (ECS) instances or replace the operating systems (system disks) of existing ECS instances. This meets various business requirements and caters to different application scenarios. This topic describes how to import a Linux image or a Windows image.
Import a Linux image
The following figure shows the procedure on how to import a Linux image.
Read Alibaba Cloud Marketplace Linux image requirements to understand the requirements for importing Linux images.
Prepare a valid on-premises image file.
Install VirtualBox on the server from which to create an image and use VirtualBox to create a virtual machine and install an operating system. For more information, see Create a virtual machine and install an operating system.
Install the required plug-ins on the virtual machine.
Install cloud-init to allow ECS instances that run the image to complete their initialization configurations. For more information, see Install cloud-init.
Install virtio drivers to allow ECS instances created from the image to start as expected. For more information, see Install the virtio driver.
(Optional) If the operating system contained in the image is not supported by Alibaba Cloud and cloud-init cannot be installed, select Customized Linux when you import the custom image. For more information, see Customize Linux images.
Install and use an image compliance tool to check whether the image meets the import requirements and repair issues in the image. For more information, see Check and repair an image.
Obtain the Linux image file.
For more information, see Obtain a Linux image file.
Check whether the image file is in a format supported by ECS. ECS instances support only image files in RAW, Virtual Hard Disk (VHD), and QEMU Copy-On-Write version 2 (QCOW2) formats. If the image file that you want to import is in another format, you must convert the image file to a supported format first. For information about how to convert the format of an image file, see Convert the format of an image.
Upload the image file that you obtained to an Object Storage Service (OSS) bucket and import the image file to ECS. For more information, see Import custom images.
Create an instance from the custom image that you imported. For more information, see Use a custom image to create one or more instances.
Import a Windows image
The following figure shows the procedure on how to import a Windows image.
Read Alibaba Cloud Marketplace Windows image requirements to understand the requirements for importing Windows images.
Prepare a valid on-premises image file.
Install VirtualBox on the server from which to create an image and use VirtualBox to create a virtual machine and install an operating system. For more information, see Create a virtual machine and install an operating system.
Install the required plug-ins on the virtual machine.
Install Vminit to allow ECS instances that run the image to complete their initialization configurations. For more information, see Install Vminit.
Install virtio drivers to allow ECS instances created from the image to start as expected. For more information, see Install the virtio driver.
Obtain the Windows image file.
For more information, see Obtain a Windows image file.
Check whether the image file is in a format supported by ECS. ECS instances support only image files in RAW, Virtual Hard Disk (VHD), and QEMU Copy-On-Write version 2 (QCOW2) formats. If the image file that you want to import is in another format, you must convert the image file to a supported format first. For information about how to convert the format of an image file, see Convert the format of an image.
Upload the image file that you obtained to an Object Storage Service (OSS) bucket and import the image file to ECS. For more information, see Import custom images.
Create an instance from the custom image that you imported. For more information, see Use a custom image to create one or more instances.