When you deploy services in the cloud, you can manually import image files of your own servers to Alibaba Cloud Elastic Compute Service (ECS) or have ECS images automatically generated for your servers. This topic describes the use scenarios and instructions of both methods.
Prerequisites
- Activate Object Storage Service (OSS) by using your Alibaba Cloud account. For more information, see Activate OSS.
- Make sure that both your Alibaba Cloud account and Resource Access Management (RAM) user have permissions required to import custom images. For more information, see Permissions required to import custom images.
- Read and understand 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.
Permissions required to import custom images
- Access on OSS resources
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. - Operation permissions on OSS bucketsIf 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 import custom images. To grant operation permissions on OSS buckets to the RAM user, the Alibaba Cloud account must perform the following steps:
- Create a custom policy. For more information, see Create a custom policy on the JSON tab.
- Policy that grants read-only permissions on OSS buckets
If you want to use the Alibaba Cloud account to perform Step 1: Create a bucket in the OSS console and upload an image file to the bucket and use the RAM user to perform Step 3: Import the custom image in the ECS console, create a policy that grants read-only permissions on OSS buckets. Example policy:
{ "Version": "1", "Statement": [ { "Action": [ "oss:GetObject", "oss:GetBucketLocation", "oss:GetBucketInfo" ], "Resource": "*", "Effect": "Allow" } ] }
- Policy that grants read and write permissions on OSS buckets
If you want to use the RAM user to perform Step 1: Create a bucket in the OSS console and upload an image file to the bucket and Step 3: Import the custom image in the ECS console, create a policy that grants read and write permissions on OSS buckets. Example policy:
{ "Version": "1", "Statement": [ { "Action": [ "oss:GetObject", "oss:GetBucketLocation", "oss:GetBucketInfo" "oss:GetObject", "oss:PutObject", "oss:DeleteObject", "oss:GetBucketLocation", "oss:AbortMultipartUpload", "oss:ListMultipartUploads", "oss:ListParts", "oss:GetBucketInfo", "oss:GetBucketUserQos" ], "Resource": "*", "Effect": "Allow" } ] }
- Policy that grants read-only permissions on OSS buckets
- Attach the policy to the RAM user. For more information, see Grant permissions to a RAM user. You can also grant read and write permissions on specific OSS buckets to your RAM
user. For more information, see Tutorial: Use RAM policies to control access to OSS.
Important In the preceding steps, make sure that the scope of permissions granted to the RAM user is account-wide instead of limited to a specific resource group. If the scope of permissions granted is limited to a specific resource group, make sure that the image to be imported belongs to the specified resource group.
- Create a custom policy. For more information, see Create a custom policy on the JSON tab.
Use scenarios
Feature | Use scenario | References |
---|---|---|
Auto-import | Auto-import allows you to use Server Migration Center (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. | Auto-import |
Manual import | The required operating system is unavailable in Alibaba Cloud. Examples:
Manual import allows you to select a license type to activate the source operating system and reduce your image costs in 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 SMC to migrate your server and generate an ECS image.
Manual import
Perform the following operations to manually import an image file from your computer to ECS:
Step 1: Create a bucket in the OSS console and upload an image file to the bucket
Step 2: (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 on OSS resources, this step is automatically
skipped.
Step 3: Import the image in the ECS console
Step 4: (Optional) View or cancel the image import task
- View the image import task
You can access the custom image list of the specified region 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 on the Task Logs page.
- In the left-side navigation pane, choose .
- Find the image import task that you want to cancel and click Cancel in the Actions column.