You can import on-premises image files to Alibaba Cloud to generate custom images. Then, you can use these custom images to quickly create Elastic Compute Service (ECS) instances with specific operating system settings and provisioned applications. This improves deployment efficiency. This topic describes how to import a custom image.
You can also use Server Migration Center (SMC) to migrate servers from self-managed data centers, on-premises virtual machines (VMs), or third-party cloud service providers to Alibaba Cloud. Then, you can generate custom images from these servers and use the custom images to create ECS instances. For more information, see Migrate a server to an ECS instance.
Prerequisites
Before you import an image file to ECS in the ECS console, complete the following operations:
To avoid compatibility issues, make sure that the image file you want to import meets the import requirements. For more information, see Instructions for importing images.
ECS supports importing image files only in the RAW, Virtual Hard Disk (VHD), QEMU Copy-On-Write version 2 (QCOW2), and Virtual Machine Disk (VMDK) formats. If your image file is in a format other than these formats, convert the image file to one of these formats before importing it. For more information, see Convert the format of an image.
Make sure that you have the permissions to import custom images and grant ECS the permissions to access Object Storage Service (OSS) resources. ECS assumes the
AliyunECSImageImportDefaultRole
role to obtain these permissions.If you import an image for the first time, you can grant ECS the permissions in the ECS console - Images on the Prepare Before Import wizard page by following the on-screen instructions.
If you use an Alibaba Cloud account to import a custom image, you need to log on to the Resource Access Management (RAM) console to complete the authorization.
If you use a RAM user to import a custom image, you need to contact the Alibaba Cloud account owner to grant you the operation permissions on OSS buckets. For more information, see Grant a RAM user read and write permissions on an OSS bucket.
Video tutorial
The following video demonstrates how to import a custom image in the ECS console.
Billing
Importing a custom image incurs the following fees:
Before you import a custom image, you must upload the on-premises image file to OSS, which incurs OSS storage fees.
During the custom image import process, uploading and downloading image files in OSS incurs OSS traffic fees.
Importing a custom image involves accessing OSS API operations, which incurs OSS request fees.
When you import a custom image to ECS, a snapshot is automatically created, which incurs snapshot storage fees. The pay-as-you-go billing method is used by default. For more information, see Snapshots.
Procedure
Step 1: Upload an image file to an OSS bucket
Upload an on-premises image file to an OSS bucket and obtain the file URL. For more information, see Multiple ways to upload files to OSS.
If you want to incorporate data disk data in an image when you import the image, you must separately prepare image files for the system disk and data disks and upload the files to an OSS bucket. When you import the image to ECS, you can specify the image files of the system disk and data disks. This way, ECS instances created from the image will contain both system disk data and data disk data.
Step 2: Import a custom image in the ECS console
Go to ECS console - Images.
In the upper-left corner of the top navigation bar, select the resource group and region where the destination resources reside.
ImportantThe selected region must be the same as the region of the OSS bucket in which the image file is stored.
On the Images page, choose Import Image > Import Image in the upper-right corner.
On the Prepare Before Import wizard page, confirm that the preparations for importing the image are complete, click Next, and then click Continue.
In the Import Image File wizard page, configure the parameters described in the following table.
Parameter
Required
Description
Image File URL
Yes
Enter the URL of the image file that you obtained in Step 1. The image file must reside in the current region. To change the region, select a new region in the top navigation bar and re-open the Import Image dialog box.
Image Name
Yes
Enter a name for the new custom image. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), colons (:), and hyphens (-). It must start with a letter.
Operating System Type
Yes
Select the operating system type of the image file that you want to import. The operating system type must be the same as that of the image file.
Valid values: windows and linux. If the operating system of the image that you want to import is not supported by Alibaba Cloud, select linux.
Operating System Version
Yes
Select the operating system version of the image file that you want to import. The operating system version must be the same as that of the image file.
If the operating system of the image that you want to import is not supported by Alibaba Cloud, you can perform one of the following operations:
Select Customized Linux: Make sure that you have manually added the parsing script to ensure that the image is usable. For more information, see Customize Linux images.
Select Others Linux: ECS does not process the instances that are created from the imported image. After you create an ECS instance from the imported image, you must configure the IP addresses, routes, and password of the instance.
If the operating system of the image that you want to import is customized based on the Linux kernel, submit a ticket for custom configurations.
Architecture
Yes
Select an architecture based on the operating system of the image that you want to import. Valid values:
32-bit Operating System
64-bit Operating System
Arm 64-bit Operating System
Image Check
No
Optional. The image check feature checks whether imported custom images are valid and whether the images can be used to create full-featured ECS instances.
By default, Check After Import is selected. The image check feature checks the custom image immediately after the image is imported. After the image check is complete, you can view the detailed check result in the Check Result column corresponding to the image in the custom image list. If you want to repair an item, you can click Repair or manually repair the item based on the suggestions in the image details.
NoteOnly specific operating systems support the image check feature. For information about the operating systems that do not support the image check feature, see Operating system limits for image check.
Boot Mode
No
Select the boot mode of the image. Valid values: BIOS and UEFI.
The boot mode specifies how the system disk is started during the creation of an ECS instance. We recommend that you use the same boot mode as the boot mode of the image file. A boot mode inconsistency may cause the ECS instance created from the custom image to fail to start.
Image Format
No
Valid values: Auto-detect (default), RAW, QCOW2, VHD, and VMDK. We recommend that you select the same format as the image file that you want to import.
If you do not know the image format, select Auto-detect. The system automatically sets the image format to the image format of the image that you want to import.
NoteTo import an ISO file to ECS, the ISO file must be converted to an image format supported by ECS. For more information, see How do I convert ISO files to image formats that are supported by ECS?.
License Type
No
Select a license type to activate the operating system in the image after the image is imported. Valid values:
Auto (default): If the image that you want to import contains a free, open source operating system, such as Alibaba Cloud Linux, you can select Auto.
Alibaba Cloud License: Only a Windows Server operating system can use a license provided by Alibaba Cloud. You are charged image license fees for the instances created from an image that uses an Alibaba Cloud license. The image license is automatically activated. For more information, see Images.
BYOL: Use the license that comes with the operating system in the image. This option is available only for Windows Server, Red Hat Enterprise Linux (RHEL), and SUSE Linux Enterprise Server (SLES) operating systems. You are not charged image license fees for the instances created from a bring-your-own-license (BYOL) image. The image license is not activated.
NoteAlibaba Cloud provides the software license feature that lets you purchase software licenses for RHEL and SLES on specific ECS instances. To use the feature, you must be added to a whitelist. For more information, see Purchase a software license for an ECS instance (invitational preview).
Disk Configurations
No
Specify the system disk size and add images that contain data from data disks.
Select Configure Disk Attributes.
You need only to specify the system disk size. Other system disk parameters are set by default. The size of the system disk ranges from 1 GiB to 2,048 GiB. The disk size that you specify cannot be smaller than the size of the image file.
NoteThe image file size is the size of the image file that you want to import from OSS. You can view the image file size in the OSS console.
Click Add Data Disk and configure the parameters.
Image File URL: Enter the URL of a data disk image file obtained in Step 1. Obtain the URL of the data disk image file using the same method as for the system disk image file.
Mount Point: This parameter is set by the system.
Image Format: Select Auto-detect or select RAW, QCOW2, VHD, or VMDK. The format must be the same as the format of the image file.
Disk Size (GiB): The size of a disk ranges from 1 GiB to 2,048 GiB and must be greater than or equal to the size of the image file.
NoteThe image file size is the size of the image file that you want to import from OSS. You can view the image file size in the OSS console.
Image Description
No
Enter a description for the custom image.
Tag
No
Add tags to the new custom image. You can use tags to classify images for easy search and batch operations.
Resource Group
No
Specify a resource group for the custom image to simplify management.
ImportantIf you use an Alibaba Cloud account to attach policies to a RAM user and the permissions granted are limited to a specific resource group, select that resource group.
Confirm that your configurations are correct and click OK.
The system creates a task to import the custom image.
(Optional) Step 3: View or cancel the import task
View the image import task
You can go to the custom image list in the target region or go to the Task Management page to view the progress of the image import task.
NoteThe time required to import a custom image varies based on the image file size and the number of concurrent import tasks.
When you import an image, a snapshot is automatically generated. You can view information about the snapshot in the Snapshots list. When the image import task is in progress, the status of the snapshot is Failed. When the image import task is completed, the snapshot enters the Successful state and the image enters the Available state. The total size of the snapshot equals the size of the imported image file, regardless of the system disk size that you specified when you imported the image. The snapshot service is a paid service. For more information, see Snapshots.
If you enabled the image check feature, after the image check is completed, you can view the detailed check result in the Check Result column corresponding to the image in the custom image list. If you want to repair an item, you can click Repair or manually repair the item based on the suggestions in the image details. For information about the check items and the recommended solutions, see Check and repair custom images.
You may fail to import an image because unexpected errors occur when the image file is checked during the import process. These errors may affect your subsequent operations, such as instance creation. You can perform the following operations to troubleshoot the issues:
View the error codes of the issues on the Task Management page or by calling the DescribeTaskAttribute operation.
View the error code details and resolve the issues based on the corresponding solutions described in the following table.
Cancel an image import task
Before the image import task is completed, you can cancel the task using one of the following methods:
Method 1: On the Images page, find the image that is being imported and click Cancel Import in the Actions column.
Method 2: On the Task Management page, cancel the image import task.
In the navigation pane on the left, choose
.Find the image import task that you want to cancel and click Cancel in the Actions column.