When you deploy services to the cloud, you can manually import image files of your servers. You can also use Elastic Compute Service (ECS) images that are automatically generated by Alibaba Cloud for your servers. This topic describes the use scenarios and operation procedures of the two methods.

Prerequisites

The following requirements are met:

Background information

The following table lists the scenarios in which you can use different features to import custom images.
Feature Scenario References
Auto-import 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. Auto-import
Manual import The required operating system is unavailable in Alibaba Cloud. Examples:
  • The specified operating system type does not exist in Alibaba Cloud.
  • The specified operating system version has been discontinued in Alibaba Cloud.
  • The specified operating system is a custom operating system.

The manual import feature allows you to select a license type to activate the source operating system. This can reduce your image costs on the cloud. For more information about license types, see the table that describes parameters for image import in the following section.

Manual import

Auto-import

Perform the following operations to use Server Migration Center (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. Complete the operations as instructed.
    For more information, see Migration process. After your server is migrated, SMC generates a custom image for your server. The image name starts with IMAGE_FROM_SMC.

Manual import

Perform the following operations to manually import an on-premises image to Alibaba Cloud ECS:

  1. Use a third-party OSS client or call an API operation to upload the custom image that you prepared from your computer to OSS.
    For information about how to upload an image file larger than 5 GiB in size, see Multipart upload and resumable upload.
  2. Log on to the ECS console.
  3. In the left-side navigation pane, choose Instances & Images > Images.
  4. In the top navigation bar, select a region.
  5. Authorize ECS to access your OSS resources.
    1. In the upper-right corner of the Images page, click Import Image.
    2. In the Import Image dialog box, click Verify in Step 3, as shown in the following figure.
    3. On the Cloud Resource Access Authorization page, AliyunECSImageImportDefaultRole and AliyunECSExportDefaultRole are displayed. Click Confirm Authorization Policy.
  6. Import the custom image.
    1. In the upper-right corner of the Images page, click Import Image again.
    2. In the Import Image dialog box, configure the parameters described in the following table.
      Parameter Required Description
      Region of Image Yes This parameter is automatically set to the current region. To change the region, close the Import Image dialog box and select another region in the left part of the top navigation bar. Then, you can click Import Image to re-open the Import Image dialog box and continue to configure other parameters.
      OSS Object Address Yes Paste the URL of the image object that you obtained from the OSS console. For more information, see Share objects. Take note of the following items:
      • You must use the same Alibaba Cloud account to obtain the URL of the image object and import the image.
      • The URL of the image object must be the public URL generated when you share the object in OSS. Internal URLs provided by OSS cannot be used to import images. If you use an internal URL to import an image, an error occurs. For information about the internal endpoint of OSS, see Obtain through the internal endpoint of OSS.
      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/Platform Yes
      • Operating System:

        Select the operating system type of your image. Valid values: Windows and Linux.

        If your image is a non-standard platform image, select Linux.

      • Platform:
        The valid values of Platform vary based on the Operating System value that you selected. Select the operating system platform of your image.
        • Valid values when Operating System is set to Windows: Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows Server 2016, and Windows Server 2019.
        • Valid values when Operating System is set to Linux: CentOS, SUSE, openSUSE, Ubuntu, Debian, FreeBSD, CoreOS, Aliyun, Red Hat, Customized Linux, and Others Linux. (Submit a ticket to check whether your Others Linux images can be imported.)
        • If the operating system of your image is a custom distribution based on the Linux kernel, Submit a ticket.
      System Disk Size (GiB) No Specify a system disk size. Unit: GiB. Valid values: 5 to 500.
      System Architecture Yes Select x86_64 for 64-bit operating systems or i386 for 32-bit operating systems.
      Image Format No 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 detect and set 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 The ISO format is not supported and must be converted to the RAW, VHD, or QCOW2 format. You can also use Packer to create and import an on-premises image. For more information, see Create and import an on-premises image by using Packer and Alicloud Image Builder parameters used to implement DevOps.
      License Type No Select a license type to activate the source operating system after the image is imported. Default value: Auto. Valid values:
      • 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.
      • Aliyun: the license allocated by Alibaba Cloud. If this value is selected, a license allocated by Alibaba Cloud is applied based on the Platform value that you selected.
      • Auto: Alibaba Cloud automatically checks the source operating system and allocates a license. If this value is selected, the system automatically checks whether a license allocated by Alibaba Cloud exists for your specified operating system platform, and then performs an operation based on the check result.
        • If a license allocated by Alibaba Cloud exists for the specified operating system platform, the system allocates the license to the imported image.
        • If no license allocated by Alibaba Cloud exists for the specified operating system platform, the system switches the license type to BYOL.
      Description No Enter a description for the custom image.
      Add Data Disk Image No Select this option if you want to import an image that contains data of data disks. Supported data disk capacity ranges from 5 GiB to 1,000 GiB.
      Resource Group No Specify a resource group for the custom image for easy management.
      Tag No Add tags to images to classify the images for easy search and batch operations.
    3. Click OK. The system then creates a task to import the custom image.
  7. Optional:View the task progress in the image list of the destination region. Before the task is completed, you can find the imported custom image or cancel the task on the Task Logs page in the ECS console.

    The amount of time it takes to import a custom image is determined based on the image size and the number of concurrent ongoing import tasks.

    When you import an image, a snapshot is automatically generated. You can view the information of the snapshot on the Snapshots page in the ECS console. While the image import task is in progress, the state of the snapshot is displayed as Failed. When the image import task is completed, the snapshot enters the Successful state and the image enters the Available state. The snapshot size is equal to the size of the imported image, regardless of the system disk size that you set when you import the image. Snapshots are billed based on the storage space they occupy. For more information, see Snapshots.

What to do next

Create an instance by using a custom image