All Products
Search
Document Center

Elastic Compute Service:Import a custom image

Last Updated:Jul 21, 2025

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.

Note

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.

    Comparison of QCOW2, VHD, and RAW formats

    Image format

    Description

    Characteristics

    QCOW2

    A VM image format based on Quick Emulator (QEMU), which uses a file to represent a disk and supports the dynamic disk space allocation.

    • Occupies smaller storage space.

    • Supports Copy-On-Write (CoW). An image file reflects only underlying disk changes.

    • Supports multiple snapshots in an image file.

    • Supports zlib compression and Advanced Encryption Standard (AES) encryption.

    VHD

    A virtual disk file format launched by Microsoft. You can compress the file systems used to boot an ECS instance into a VHD file and store the file in a file system on the on-premises physical host. This format is suitable for a variety of scenarios.

    • Simple maintenance: You can perform partition, format, compress, and delete operations without affecting physical partitions.

    • Easy backup: You only need to back up a VHD file or use a backup tool to back up the physical partition on which the VHD file is stored.

    • Easy migration: To use a VHD file on multiple computers, you only need to detach the file from the current computer and copy and attach it to a different computer.

    • Direct system deployment: You can use ImageX to release a captured image to a VHD virtual disk or use a Windows Deployment Services (WDS) server to deploy the system to a VHD virtual disk.

    RAW

    A file that allows direct read/write for ECS instances. RAW does not support dynamic space extension. It provides the best I/O performance.

    • Simple addressing and high access efficiency.

    • You can use a format conversion tool to easily convert RAW to other image formats.

    • You can easily attach a RAW image to an on-premises physical host. The image can transmit data with the host without the need to start a VM.

  • 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.

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.

Note

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

  1. Go to ECS console - Images.

  2. In the upper-left corner of the top navigation bar, select the resource group and region where the destination resources reside.

    地域

    Important

    The selected region must be the same as the region of the OSS bucket in which the image file is stored.

    Description of Finance Cloud regions

    A Finance Cloud region has different names in ECS and OSS.

    • The China East 2 Finance region (cn-shanghai-finance-1) in ECS corresponds to the oss-cn-shanghai-finance-1-pub region in OSS.

    • The China South 1 Finance region (cn-shenzhen-finance-1) in ECS corresponds to the oss-cn-szfinance region in OSS.

    • The China North 2 Finance region (cn-beijing-finance-1) in ECS corresponds to the oss-cn-beijing-finance-1 region in OSS.

  3. On the Images page, choose Import Image > Import Image in the upper-right corner.

    image.png

  4. On the Prepare Before Import wizard page, confirm that the preparations for importing the image are complete, click Next, and then click Continue.

  5. 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.

    Note

    Only 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.

    Note

    To 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.

    Note

    Alibaba 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.

    1. Select Configure Disk Attributes.

    2. 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.

      Note

      The 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.

    3. 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.

        Note

        The 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.

    Important

    If 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.

  6. 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.

    Note

    The 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:

      1. View the error codes of the issues on the Task Management page or by calling the DescribeTaskAttribute operation.

      2. View the error code details and resolve the issues based on the corresponding solutions described in the following table.

        Error code details

        Error code

        Cause

        Cause identification

        Recommended solution

        UNKNOWN_IMAGE_FORMAT

        The image format is not supported.

        Run the qemu-img check command to view the image format.

        Convert the image format to RAW or VHD.

        Note

        We recommend that you use the qemu-img tool for image format conversion and use the default parameter values during conversion. For more information, see Convert the format of an image.

        IMAGE_SIZE_EXCEEDS_LIMIT

        The image file is overlarge.

        Run the qemu-img info command to view the size of the image file.

        • Reduce the size of the image file.

        • Convert the image format to RAW or VHD.

          Note

          We recommend that you use the qemu-img tool for image format conversion and use the default parameter values during conversion. For more information, see Convert the format of an image.

        INVALID_IMAGE_SIZE

        The correct image size cannot be obtained.

        Call the GetObject operation to check whether information about the image file can be returned from OSS.

        Reupload the image file to an OSS bucket.

        IMAGE_FILE_NOT_FOUND

        The source of the image file cannot be found.

        Call the GetObject operation to check whether information about the image file can be returned from OSS.

        • Do not delete the image file from OSS before the import task is completed.

        • Do not use special characters in the name of an image file that is stored as an OSS object. For more information, see Object naming conventions.

        • Reupload the image file to an OSS bucket.

        INVALID_IMAGE_FORMAT

        The image format is invalid.

        The format declared in the header file is not supported.

        Check the image format. Convert the image format to RAW or VHD.

        Note

        We recommend that you use the qemu-img tool for image format conversion and use the default parameter values during conversion. For more information, see Convert the format of an image.

  • 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.

      1. In the navigation pane on the left, choose Maintenance & Monitoring > Tasks.

      2. Find the image import task that you want to cancel and click Cancel in the Actions column.