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 these two methods.

Prerequisites

You must complete the following operations before you import an image by using the ECS console:
  • Make sure that both your Alibaba Cloud account and Resource Access Management (RAM) user have permissions required to import custom images.
    • Use your Alibaba Cloud account to log on to the RAM console and grant access on Object Storage Service (OSS) resources to ECS by attaching the AliyunECSImageImportDefaultRole role to ECS.
    • If you are using a RAM user, ask 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.
  • Read and understand the usage limits and requirements of images. For more information, see Instructions for importing images.

Use scenarios

The following table describes the use scenarios of the methods that are used to import custom images.
MethodUse scenario
Import custom images by using 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 custom images by using SMCThis method allows you to use SMC to migrate one or more servers such as servers in Internet data centers (IDCs), 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 custom images by using the ECS console

Perform the following operations to import an image file from your computer to ECS:

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

The first time that you import custom images, you must use your Alibaba Cloud account to log on to the RAM console and grant access on OSS resources to ECS by attaching the AliyunECSImageImportDefaultRole role to ECS. If ECS already has access to OSS resources, skip this step.

Step 2: Import an 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 left part of the top navigation bar, select a region.
    Important Make sure that the region of the OSS bucket where the image file is stored is selected.
  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. Click Confirm.
  7. On 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 the region of the OSS bucket where the image file is stored is selected.
    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 TypeYesConfigure OS Type based on 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 VersionYesConfigure OS Version based on the operating system version of the image that you want to import from OSS.
    ArchitectureYesConfigure 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
    Boot ModeNoConfigure Boot Mode based on the boot mode of the image that you want to import from OSS. Valid values: BIOS and UEFI.
    Image FormatNoValid values: Auto-detect, RAW, QCOW2, and VHD. Select the format of the image that you want to import from OSS.
    • If you do not know the image format, you can select Auto-detect to allow the system to determine the image format.
    • If you want to select an image format, we recommend that you select the QCOW2 or VHD format, which has 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 contains data from data disks.
    1. Select Configure Disk Attributes.
    2. You only need to specify the system disk size. Other system disk parameters are set by default. The system disk can range from 5 to 500 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: Valid values: Auto-detect, RAW, QCOW2, and VHD. Select the format of the image that you want to import from OSS.
      • Disk SizeGiB: The data disk can range from 5 to 2,000 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.
    TagNoSpecify tags to add to the new custom image. You can use tags to classify images for easy search and batch operations.
    Resource GroupNoSpecify a resource group for the new custom image to simplify management.
    Important If the scope of permissions 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.
    The system then 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 amount of time it takes to import a custom image depends on the image file size and the number of concurrent ongoing import tasks.

    When you import an image, snapshots are automatically generated. You can view the information of the snapshots on the Snapshots page in the ECS console. While 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 set when you import the image. Snapshots are billed based on the amount of storage space they occupy. 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 Image 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 custom images by using SMC

Perform the following operations to use SMC to generate an ECS image for your server.

  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 redirected to the SMC console.
  5. In the SMC console, download the SMC client. Decompress the SMC client, upload the SMC client to the source server, and then run the SMC client. Then, import the information of 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.