You can import on-premises image files to Alibaba Cloud to generate custom images. Then, you can use the custom images to quickly create Elastic Compute Service (ECS) instances that have 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 the referenced document.
Prerequisites
Before you import an image file to ECS in the ECS console, complete the following operations:
-
Make sure that the image file meets the import requirements to avoid compatibility issues. For more information, see the referenced document.
-
Only images in the RAW, VHD, and QCOW2 formats can be imported to ECS. If your image file is in a format other than the preceding formats, convert the image file to one of the preceding formats before you import the image file. For more information, see the referenced document.
-
Make sure that you have the permissions to import custom images.
-
Use an Alibaba Cloud account to access Resource Access Management (RAM) and follow the instructions on the page to complete the authorization. Grant ECS the permissions to access OSS resources. ECS uses the
AliyunECSImageImportDefaultRole
role to import images by default. -
If you use a RAM user, contact the owner of the corresponding Alibaba Cloud account to grant the RAM user the permissions to access OSS buckets.
-
Video tutorial
The following video shows how to import a custom image in the ECS console.
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 the referenced document (you do not need to perform Step 4: Download files).
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
Log on to the ECS console.
In the left-side navigation pane, choose .
-
In the upper-left corner of the top navigation bar, select a region.
ImportantThe selected region must be the same as the region of the OSS bucket in which the image file is stored.
-
In the upper-right corner of the Images page, select Import Image > Import Image.
-
On the Preparations wizard page, confirm whether the preparations for importing the image are complete, and then click Next.
-
(Conditionally required) Grant ECS the permissions to access OSS resources.
If you are importing an image for the first time and have not granted ECS the permissions to access OSS resources, you can perform the operation in the Import Image dialog box.
-
In the Upload An On-premises Image File To An OSS Bucket section, click AliyunECSImageImportDefaultRole.
-
On the Cloud Resource Access Authorization page, view the
AliyunECSImageImportDefaultRole
role, and click Agree To Authorize.NoteAfter the operation is complete, the system automatically creates the
AliyunECSImageImportDefaultRole
role and grants the permissions.
-
-
Return to the Import Image dialog box and click Next again.
-
Click Continue To Import.
-
On the Import Image File wizard page, complete the following configurations.
Parameter
Required
Description
Current Region
Yes
This parameter is automatically set to the current region. To change the region, select a new region in the top navigation bar and reopen the Import Image dialog box.
Image File URL
Yes
Enter the image file URL that you obtained in Step 1.
Image Name
Yes
Enter a name for the 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:
Select Customized Linux: Make sure that you manually add parsing scripts to ensure that the image is available. For more information, see the referenced document.
Select Others Linux: ECS does not perform any operations on the created instance. After you create an ECS instance from the imported image, you must configure the IP addresses, routes, and password of the instance.
If your operating system is customized based on the Linux kernel, submit a ticket to contact us.
System Architecture
Yes
Select an architecture based on the operating system of the image that you want to import. Valid values:
32-bit OS
64-bit OS
Arm 64-bit OS
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.
The Perform Check After Creation option is selected by default. The image check feature is automatically performed after the image is imported. After the check is complete, you can view the check details in the Check Results column in the custom image list. If issues are detected, you can use the One-click Repair feature or manually fix the issues based on the repair suggestions in the image details.
NoteCurrently, the image check feature is supported only for some operating systems. For more information about unsupported operating systems, see the referenced document.
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, and VHD. We recommend that you select the same image format as the image file.
If you are not sure about the image format, select Auto-detect. The system automatically sets the image format to the same format as the on-premises image file.
NoteTo import an ISO file to ECS, make sure that the ISO file is converted to an image format supported by ECS. For more information, see the referenced document.
License Type
No
The license type that is required to activate the original operating system after the image is imported. Valid values:
Auto-detect (default): If you import an open-source operating system, you can select Auto-detect as the license type.
Alibaba Cloud Official License: Use the Alibaba Cloud official license for the operating system. You are charged for image license fees for the instances created from the image. The license of the image is automatically activated.
Bring Your Own License: Use the license of the original operating system. You are not charged for image license fees for the instances created from the image. The license of the image is not activated.
If you use the Windows Server operating system, the license type that you select when you import a custom image determines the fees and activation status:
If you select Bring Your Own License, Alibaba Cloud does not activate the image or charge you.
If you select Alibaba Cloud Official License, Alibaba Cloud automatically activates the image and charges you. For more information, see the referenced document.
If you use the Red Hat Enterprise Linux or SUSE Linux Enterprise Server operating system, you cannot directly purchase an Alibaba Cloud Official License when you import a custom image. Alibaba Cloud provides the feature to purchase software licenses such as Red Hat Enterprise Linux and SUSE Linux Enterprise Server for specified ECS instances. However, this feature requires a whitelist. For more information, see the referenced document.
Disk Configuration
No
Specify the system disk size and add images that contain data from data disks.
Select Configure Disk Properties.
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 specify the parameters.
Image File URL: Enter the data disk image file URL that you obtained in Step 1. The method to obtain the data disk image file URL is the same as the method to obtain the system disk image file URL.
Mount Target: This parameter is automatically assigned by the system. You do not need to specify this parameter.
Image Format: Valid values: Auto-detect, RAW, QCOW2, and VHD. We recommend that you select the same image format as the image file.
Disk Size (gib): The size of the 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.
Image Description
No
Enter a description for the custom image.
Tags
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 specify specified resource group permissions when you attach a permissions policy to a RAM user, make sure that you select the same resource group in this section.
-
After you confirm that the information is correct, click Confirm Import.
The system creates a task to import the image.
(Optional) Step 3: View or cancel the import task
-
View the import task
You can view the progress of the import task in the custom image list in the destination region or on the Task Management page.
NoteThe amount of time required to import a custom image varies based on the image file size and the number of concurrent import tasks.
-
When you import a custom image, the system automatically creates a snapshot. You can view the snapshot information in the Snapshot List. Before the image import task is complete, the snapshot status is displayed as Failed. After the task is complete, the snapshot status is automatically updated to Succeeded and the image status is automatically updated to Available. The snapshot size is equal to the size of the imported image file, regardless of the system disk size that you set when you import the image. Currently, snapshot size is charged. For more information, see the referenced document.
-
If the image check feature is enabled, after the image check is complete, you can view the check details in the Check Results column in the custom image list. If issues are detected, you can use the One-click Repair feature or manually fix the issues based on the repair suggestions in the image details. For more information about the check items and repair suggestions, see the referenced document.
-
You may fail to import an image because unexpected errors occur when the image file is checked during the image import process. The errors may affect your subsequent operations such as instance creation. You can perform the following operations to troubleshoot the issues:
-
View the error code details in the Task Management page or call the DescribeTaskAttribute API operation.
-
View the error code details and resolve the issues based on the corresponding solutions described in the following table.
-
-
-
Cancel the import task
Before the image import task is completed, you can cancel the task by using one of the following methods:
-
Method 1: In the image list, click Cancel Import.
-
Method 2: Cancel the image import task on the Task Management page.
-
In the left-side navigation pane, select
. -
Findthe task to import the custom image and click Cancel Task in the Actions column.
-
-