To import an image to Alibaba Cloud Elastic Compute Service (ECS), you must first upload the image to an Object Storage Service (OSS) bucket. This topic describes how to import the Red Hat Enterprise Linux (RHEL) image to Alibaba Cloud ECS.

Prerequisites

Background information

OSS is a secure, cost-effective, and highly durable service that enables you to store large amounts of data in Alibaba Cloud. For more information, see What is OSS?.

Procedure

  1. Step 1: Create a bucket in the OSS console
  2. Step 2: Upload the image to the OSS bucket
  3. Step 3: (Optional) Authorize ECS to access OSS resources
  4. Step 4: Import the image in the ECS console

Step 1: Create a bucket in the OSS console

  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets.
  3. On the Buckets page, click Create Bucket.
  4. In the Create Bucket panel, configure the following parameters. Then, click OK.
    • Bucket Name: Enter a valid name for the bucket. In this example, enter importrhel.
    • Region: Select a region in which you want to create the importrhel bucket from the drop-down list.
      Note Make sure that the region of the bucket from which to import the image is selected.
    • Storage Class: Select the default storage class. In this example, select Standard.
    • Access Control List (ACL): Select the default ACL. In this example, select Private.
    For information about how to configure other parameters, see Create buckets.

Step 2: Upload the image to the OSS bucket

If the image file is greater than 5 GiB in size, you must upload the image by calling an API operation or using ossutil. In this example, the image file is less than 5 GiB in size. You can upload it to an OSS bucket by using the OSS console.
  1. Log on to the OSS console.
  2. In the left-side navigation pane, click Buckets.
  3. In the bucket list of the Buckets page, click a bucket name in the Bucket Name column. In this example, click importrhel.
  4. On the Files page, click Create Folder.
  5. In the Create Folder panel, enter a valid directory name. In this example, enter rhel/. Then, click OK.
  6. Click the directory name. Then, click Upload.
  7. On the Upload page, configure the following parameters:
    • Upload To: Click Current.
    • File ACL: Click Inherited from Bucket.
    • Files to Upload: Click Select Files to select a local file or click Select Folders to select a directory. You can also drag the required local file or directory to the Files to Upload section.
    For information about how to configure other parameters, see Simple upload.
  8. Click Upload.
    You can view the upload progress of the file in the Task List panel. When Uploaded is displayed in the Status column corresponding to the file, the image file is uploaded and is displayed in the rhel/ directory.
  9. Click the image name. In the View Details panel, click Copy File URL below the URL field.
    Note
    • The file URL is required when you import the image.
    • If File ACL is set to Private, the URL contains the Expires and Signature information.

Step 3: (Optional) Authorize ECS to access OSS resources

The first time that you import a custom image, you must log on to the RAM console with your Alibaba Cloud account and grant access on OSS resources to ECS by attaching the AliyunECSImageImportDefaultRole role to ECS. If ECS already has access on OSS resources, this step is automatically skipped.

  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 bucket from which to import the image is selected.
  4. In the upper-right corner of the Images page, click Import Image.
  5. In the Cloud Resource Access Authorization dialog box, click Authorize.
    Authorize
  6. On the Cloud Resource Access Authorization page, AliyunECSImageImportDefaultRole and AliyunECSExportDefaultRole are displayed. Click Confirm Authorization Policy.

Step 4: Import the image in the ECS console

After you upload the image to the OSS bucket, you can perform the following operations to import the image to ECS in the ECS console. You can also call the ImportImage operation to import the image to ECS. For information about the operation, see ImportImage.

  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 in which to import the image.
    Note Make sure that the region of the bucket from which to import the image is selected.
  4. 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 following parameters:
      • OSS Object Address: Paste the file URL that you copied in Step 2.
      • Image Name: Enter a valid name for the image. You can use this name to search for the image when you create an ECS instance.
      • Operating System/Platform: Select Linux from the first drop-down list and select RedHat from the second drop-down list.
      • Architecture: Select x86_64.
      • System Disk Size (GiB): Enter the size of the system disk. The system disk size can range from 5 GiB to 500 GiB and cannot be smaller than the image file size.
      • Image Format: Select VHD.
      • License Type: Select BYOL.
      For information about how to configure other parameters, see Import custom images.
    3. Confirm that your configurations are correct and then click OK. The system creates a task to import the custom image.
  5. Optional:View the task progress in the image list of the specified region.
    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.
    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.

    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.

What to do next

Step 5: Create an ECS instance from the RHEL image