Before you import an image to Elastic Compute Service (ECS), you must upload the image to an Object Storage Service (OSS) bucket. This topic describes how to import a Red Hat Enterprise Linux (RHEL) image to Alibaba Cloud ECS.
Prerequisites
OSS is activated by using your Alibaba Cloud account. For more information, see Activate OSS.
Your Alibaba Cloud account and Resource Access Management (RAM) user are granted the permissions to import images. For more information, see Import custom images.
You are familiar with the usage limits and requirements of images. For more information, see Instructions for importing images, Customize Linux images, and Convert the format of an image.
Background information
Alibaba Cloud OSS is a secure, cost-effective, and high-durability storage service that allows you to store large amounts of data in the cloud. For more information, see What is OSS?
Procedure
Step 1: Create a bucket in the OSS console
Log on to the OSS console.
In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
In the Create Bucket panel, configure the following parameters and click OK:
Bucket Name: Enter a valid name for the bucket. In this example, enter importrhel.
Region: Select a region from the drop-down list.
NoteThe region of the bucket must be the same as the region where you want to import the image.
Storage Class: Select the default storage class. In this example, select Standard.
ACL: Select the default access control list (ACL) for the bucket. In this example, select Private.
For information about how to configure other parameters, see Create a bucket.
Step 2: Upload the image to the OSS bucket
If the image is greater than 5 GiB in size, upload the image by calling an API operation or by using ossutil.
For information about the API operation, see Multipart upload.
For information about ossutil, see Overview.
In this example, the image is smaller than 5 GiB in size. You can upload the image to an OSS bucket in the OSS console.
Log on to the OSS console.
Create a directory in the bucket to which you want to upload the image.
In the left-side navigation pane, click Buckets. In the bucket list, click a bucket name in the Bucket Name column. In this example, click importrhel.
Go to the Objects page and click Create Directory.
In the Create Directory panel, enter a valid directory name and click OK. In this example, enter rhel/.
Upload the image.
Click the directory name. Then, click Upload Object.
On the Upload Object page, configure the following parameters:
Upload To: Select Current Directory.
Object ACL: Select Inherited from Bucket.
Files to Upload: Click Select Files to select an on-premises file or click Select Folders to select an on-premises folder. You can also drag the on-premises file or folder to the Files to Upload section.
For information about how to configure other parameters, see Simple upload.
Click Upload Object.
You can view the upload progress of the image file in the Task List panel. If Uploaded is displayed in the Status column corresponding to the image file, the image file is uploaded and displayed in the rhel/ directory.
Click the image name. In the View Details panel, find the URL parameter and click Copy Object URL to the right to copy the object URL of the uploaded image file.
NoteThe object URL is required when you import the image.
If you set the Object ACL parameter to Private, the object URL contains the Expires and Signature information.
Step 3: Authorize ECS to access OSS resources
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.
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.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select the region in which you want to import the image.
NoteThe region of the bucket in which you uploaded the image must be the same as the region where you want to import the image.
Import the image.
On the Images page, choose Import Image > Import Image in the upper-right corner.
In the Prepare Before Import step, check whether the required preparations are complete and click Next.
In the message that appears, click Confirm.
In the Import Image File step, configure the parameters. For more information, see Import custom images.
Verify that the configurations are correct and click OK. The system creates a task to import the image.