All Products
Search
Document Center

Elastic Compute Service:Import custom images

Last Updated:May 31, 2024

When you deploy services in the cloud, you can import on-premises image files by using the Alibaba Cloud Elastic Compute Service (ECS) console or have ECS images automatically generated for your servers by using Server Migration Center (SMC). This topic describes the use scenarios and operation procedures of the preceding methods.

Prerequisites

Before you import an image in the ECS console, complete the following operations:

  • Make sure that both your Alibaba Cloud account and Resource Access Management (RAM) user have the permissions that are required to import custom images.

    • You can log on to the RAM console by using your Alibaba Cloud account. Then, attach the AliyunECSImageImportDefaultRole role to ECS to grant access permissions on Object Storage Service (OSS) resources to ECS.

    • If you use a RAM user, contact the owner of the corresponding Alibaba Cloud account to grant operation permissions on OSS buckets to the RAM user before you proceed. For more information, see the "Grant permissions for different scenarios" section of the Upload image files to OSS topic.

  • Obtain the URL of the image file that you want to import in the OSS console. For more information, see Use object URLs.

  • Familiarize yourself with the usage limits and requirements of images. For more information, see Instructions for importing images.

Scenarios

The following table describes the scenarios of the methods that are used to import custom images.

Method

Scenario

Import a custom image in the ECS console

You can import custom images by using the ECS console in the following scenarios:

  • Import on-premises image files to Alibaba Cloud.

  • Import image files from servers of third-party cloud service providers to Alibaba Cloud.

Import a custom image by using SMC

This method allows you to use SMC to migrate one or more servers such as servers in Internet data centers, virtual machines, or cloud servers from other cloud platforms to Alibaba Cloud. When your servers are migrated, SMC generates ECS images for the servers.

Import a custom image in the ECS console

Step 1: Import a custom image in the ECS console

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Images.

  3. In the upper-left corner of the top navigation bar, select a region.

    Important

    Make sure that you select the region of the OSS bucket where the image file is stored.

  4. In the upper-right corner of the Images page, click Import Image in the Import Image section.

    image.png

  5. In the Prepare Before Import step, check whether the preparations are completed and click Next.

  6. (Conditionally required) Grant ECS the permissions to access OSS resources.

    If you are importing an image for the first time and do not grant ECS access permissions on OSS resources, you can perform operations in the Import Image dialog box.

    1. In the Upload Image File to OSS section, click AliyunECSImageImportDefaultRole.

    2. On the Cloud Resource Access Authorization page, view the AliyunECSImageImportDefaultRole and AliyunECSImageExportDefaultRole roles and click Confirm Authorization Policy.

  7. In the Import Image dialog box, click Next.

  8. Click Confirm.

  9. In the Import Image File step, configure the parameters that are described in the following table.

    Parameter

    Required

    Description

    Current region

    Yes

    This parameter is automatically set to the current region. To change the region, close the Import Image dialog box and select a different region in the left part of the top navigation bar. Then, click Import Image to re-open the Import Image dialog box and continue to configure other parameters.

    Important

    Make sure that you select the region of the OSS bucket where the image file is stored.

    Image File URL

    Yes

    Enter the URL of the image file.

    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.

    OS Type

    Yes

    Select the operating system type of the image that you want to import from OSS.

    Valid values: windows and linux. If your image is a non-standard platform image, select linux.

    OS Version

    Yes

    Select the operating system version of the image that you want to import from OSS.

    Architecture

    Yes

    Select an architecture based on the operating system of the image that you want to import from OSS. Valid values:

    • 32-bit

    • 64-bit

    • Arm 64-bit

    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 Creation is selected, and the image check feature checks the custom image immediately after the image is created. After the image is checked, you view the check results in the Check Results column corresponding to the image on the Custom Images tab and resolve issues by using the repair feature of Image Builder or based on the solutions that are provided in the check results. For information about check items and solutions to image issues, see Overview.

    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 that you want to import from OSS. Valid values: BIOS and UEFI. For more information about boot modes, see Best practices for ECS instance boot modes.

    Image Format

    No

    Select the format of the image that you want to import from OSS. Valid values: Auto-detect, RAW, QCOW2, and VHD.

    • If you do not know the image format, you can select Auto-detect to allow the system to identify the image format.

    • If you want to select an image format, we recommend that you select QEMU Copy-On-Write version 2 (QCOW2) or Virtual Hard Disk (VHD) which generates a smaller transmission footprint.

    Note

    License Type

    No

    Select a license type to activate the source operating system after the image is imported. Valid values:

    • Auto (default): Alibaba Cloud checks the source operating system and allocates a license. If this value is selected, the system checks whether a license has been allocated by Alibaba Cloud for your specified operating system version, and then performs an operation based on the check result.

      • If a license has been allocated by Alibaba Cloud for the specified operating system version, the system allocates the license to the imported image.

      • If no license has been allocated by Alibaba Cloud for the specified operating system version, the system switches the license type to BYOL.

    • Alibaba Cloud License: the license allocated by Alibaba Cloud. If this value is selected, a license allocated by Alibaba Cloud is applied based on your selected operating system version.

    • BYOL: the license that comes with the source operating system. If this value is selected, make sure that your license key can be used in Alibaba Cloud.

      For information about Red Hat Cloud Access and Windows licenses, see Overview and Microsoft licenses and Software Assurance.

    Disk Configurations

    No

    Specify the system disk size and add image files 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 system disk size ranges from 1 GiB to 2,048 GiB and cannot be less than the size of the image file.

      Note

      The image file size is the size of the image file that you want to import to OSS. You can view the image file size in the OSS console.

    3. Click increasesData Disk and configure the parameters.

      • Image File URL: Enter the URL of a data disk image file. Obtain the URL of the data disk image file by using the same method as the system disk image file.

      • Mount Point: The parameter is set by the system.

      • Image Format: Select the format of the image file that you want to import from OSS. Valid values: Auto-detect, RAW, QCOW2, and VHD.

      • Disk SizeGiB: The data disk can range from 1 GiB to 2,048 GiB in size and cannot be smaller than the image file size.

        Note

        The image file size is the size of the image file that you want to import to 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 custom image. You can use tags to classify images for simple search operations and batch operations.

    Resource Group

    No

    Specify a resource group for the custom image to simplify management.

    Important

    If the scope of permissions that are granted to your RAM user is limited to a specific resource group when you use your Alibaba Cloud account to attach policies to your RAM user, select that resource group.

  10. Confirm that your configurations are correct and click OK.

    Then, the system creates a task to import the image.

(Optional) Step 2: View or cancel the image import task

  • View the image import task

    You can go to the Images or Task Logs page to view the progress of the image import task.

    Note

    The 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 an image, a snapshot is automatically generated. You can view the information about the snapshot on the Snapshots page in the ECS console. When the image import task is in progress, the state 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 is equal to the size of the imported image file, regardless of the system disk size that you specified when you imported the image. You are charged for the snapshot. For more information, see Snapshots.

    • After the image check feature is enabled and checks the custom image, you can view the check details in the Check Result column of the custom image list. If an at-risk item is detected, you can use the One-click Repair feature of Image Builder or manually fix the item based on the suggestions in the image check results. For more information about the check items and the recommended solutions, see the "Image check items" section in Overview.

  • Cancel the image import task

    Before the image import task is completed, you can cancel the task by using one of the following methods:

    • Method 1: On the Custom Images tab of the Images page, find the image that is being imported and click Cancel Import in the Actions column.

    • Method 2: On the Task Logs page, cancel the image import task.

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

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

Import a custom image by using SMC

To generate an ECS image for your server by using SMC, perform the following operations:

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Images.

  3. In the upper-left corner of the top navigation bar, select a region.

  4. In the upper-right corner of the Images page, choose Import Image > SMC.

    You are directed to the SMC console.

  5. In the SMC console, download the SMC client. Extract the SMC client, upload the SMC client to the source server, and then run the SMC client. Then, import the information about the source server to the SMC console.

  6. Create and start a migration job in the SMC console. Select ECS Image as the destination type.

    For more information, see Create a server migration job.

    After the migration job is completed, SMC generates a custom image for your source server. The image name starts with IMAGE_FROM_SMC. You can create an ECS instance from the image in the ECS console.