When you deploy services in the cloud, you can import on-premises image files in 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, you must 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.
    • 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 Grant permissions for different scenarios.
  • The URL of the image file is obtained in the OSS console. For more information, see Share objects.
  • Make sure that you read and understand 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.
MethodScenario
Import a custom image in the ECS consoleYou 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 SMCThis 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

Video tutorial

The following video shows how to import a custom image in the ECS console.

To import an image file from your on-premises machine to ECS, perform the following steps:

Step 1: (Optional) Grant access permissions on OSS resources to ECS

The first time you import custom images, log on to the RAM console by using your Alibaba Cloud account. Then, attach the AliyunECSImageImportDefaultRole role to ECS to grant access permissions on OSS resources to ECS. If ECS has access permissions on OSS resources, skip this step.

Step 2: 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.
    Import Image
  5. In the Prepare Before Import step, check whether the image meets the required conditions and click Next.
  6. In the message that appears, click Confirm.
  7. In the Import Image File step, configure the parameters that are described in the following table.
    ParameterRequiredDescription
    Current RegionYesThis 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 URLYesEnter the URL of the image file.
    Image NameYesEnter 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.
    OS TypeYesSelect 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 VersionYesSelect the operating system version of the image that you want to import from OSS.
    ArchitectureYesSelect the operating system of the image that you want to import from OSS. Valid values:
    • 32-bit
    • 64-bit
    • ARM 64-bit
    Image CheckNoThe image check feature checks whether imported custom images are valid and whether the images can be used to create full-featured ECS instances.
    If you select Check After Import, the image is checked immediately after the image is imported to ECS. After the image is checked, you can click Details in the Status column that corresponds to the image in the custom image list to view the check results of the image and resolve issues based on the corresponding solutions that are provided in the results. For information about check items and solutions to image issues, see Image check items.
    Note Only specific operating systems support the image check feature. For information about operating systems that do not support the feature, see Operating system limits for image check.
    Boot ModeNoSelect the boot mode of the image that you want to import from OSS. Valid values: BIOS and UEFI.
    Image FormatNoSelect 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 QCOW2 or VHD that generates a smaller transmission footprint.
    Note
    License TypeNoSelect a license type to activate the source operating system after the image is imported. Default value: Auto. Valid values:
    • Auto: 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 ConfigurationsNoSpecify 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 system disk can range from 5 to 2,048 GiB in size and cannot be smaller than 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 increaseData Disk and configure the parameters.
      • Image File URL: Enter the URL of the data disk image file. Obtain the URL of the data disk image file by using the same method as the system disk.
      • Mount Point: The parameter is set by the system.
      • Image Format: Select the format of the image that you want to import from OSS. Valid values: Auto-detect, RAW, QCOW2, and VHD.
      • Disk SizeGiB: The data disk can range from 5 to 2,048 GiB in size and cannot be smaller than 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.
    Image DescriptionNoEnter a description for the new custom image.
    TagNoAdd tags to the new custom image. You can use tags to classify images for simple search operations and batch operations.
    Resource GroupNoSpecify a resource group for the new 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, select that resource group.
  8. Confirm that your configurations are correct and click OK.
    Then, the system creates a task to import the image.

Step 3: (Optional) 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 period of time that is required to import a custom image varies based on the image file size and the number of ongoing 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 snapshots is displayed as Failed. When the image import task is completed, the snapshots enter the Successful state and the image enters the Available state. The total size of the snapshots is equal to the size of the imported image file, regardless of the system disk size that you specified when you imported the image. Snapshots are billed based on the amount of storage space that is occupied. For more information, see Snapshots.

  • 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 top navigation bar, select a region.
  4. In the upper-right corner of the Images page, click Online SMC Migration.
    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 task in the SMC console. Select ECS Image as the destination type.
    For more information, see Step 2: Create and start a migration task.
    After the migration task is completed, SMC generates a custom image for your source server. The image name starts with IMAGE_FROM_SMC. You can use the image to create ECS instances in the ECS console.

What to do next

You can use the imported custom image to create instances that have the same operating system, applications, and data. For more information, see Use a custom image to create one or more instances.