After you create a custom image, you can export the image file in the Elastic Compute Service (ECS) console to an Object Storage Service (OSS) bucket and then download the image file from the bucket to your computer to analyze and back up the image. This topic describes how to export a custom image and the items that you must take note of when you export the image.
Prerequisites
An OSS bucket is created in the region where the custom image that you want to export resides. For more information, see Create buckets.
An Alibaba Cloud account and a Resource Access Management (RAM) user are created and meet the requirements described in the following table for exporting custom images. For more information, see the Permissions section of this topic.
Usage notes
Limits
Item | Description |
Image format and operating system | Due to copyright restrictions, you cannot export Windows Server custom images and custom images that are based on Alibaba Cloud Marketplace images. |
Number and capacity of data disks |
|
Encrypted image | You cannot export encrypted images.
|
Considerations
Consideration | Description |
Export fee | Exported image files are stored in OSS buckets. You are charged for the storage of the files in the buckets and data transfers that occur when you download the files from the buckets. For information about OSS billing, see Billing overview. |
Export duration | The amount of time that is required to export a custom image varies based on the size of the image files and the number of concurrent export tasks in the queue. |
Exported image file | If an exported custom image contains data disk snapshots, multiple image files are generated and stored in the same OSS bucket. Note Files whose names contain system are system disk snapshots. Files whose names contain data are data disk snapshots. The identifiers of data disk snapshots are the mount points of the source data disks, such as xvdb and xvdc. |
Other |
|
Permissions
Access on OSS resources
Log on to the RAM console by using an Alibaba Cloud account and grant ECS the permissions to access OSS resources by assigning the
AliyunECSImageExportDefaultRole
role to ECS.Operation permissions on OSS buckets
If you use a RAM user, ask the Alibaba Cloud account owner to grant operation permissions on OSS buckets to the RAM user before you export 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 the Create a custom policy on the JSON tab section of the "Create custom policies" topic.
Policy that grants read-only permissions on OSS buckets
If you want to use an Alibaba Cloud account to create OSS buckets and use a RAM user to export custom images, you need to grant read-only permissions on OSS buckets to the RAM user. Sample 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 a RAM user to create OSS buckets and export custom images, you need to grant read and write permissions on OSS buckets to the RAM user. Sample 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" } ] }
Attach the policy to the RAM user. For more information, see Grant permissions to RAM users. For information about how to grant read and write permissions on an OSS bucket to a RAM user, see Tutorial: Use RAM policies to control access to OSS.
Procedure
Log on to the ECS console.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select a region.
ImportantMake sure that the OSS bucket in which you want to store the exported image files resides in the selected region.
(Optional) Grant ECS the permissions to access OSS resources.
The first time you export images, log on to the RAM console and grant ECS the permissions to access OSS resources by assigning the
AliyunECSImageExportDefaultRole
role to ECS. If ECS already has the permissions to access OSS resources, this step is automatically skipped.On the Custom Images tab, find the image that you want to export. In the Actions column, choose the More icon > Export Image.
On the Cloud Resource Access Authorization page, click Authorize.
View the
AliyunECSImageImportDefaultRole
andAliyunECSImageExportDefaultRole
roles and click Confirm Authorization Policy.
On the Custom Images tab, find the image that you want to export. In the Actions column, choose the More icon > Export Image.
In the Make Preparations step, check that the image meets the image export requirements and click Next.
Click Continue.
In the Export Image File step, configure the following parameters:
Image Format: optional. Select a format in which to export the custom image. Valid values: RAW, VHD, QCOW2, VDI, and VMDK.
NoteThe Image Format parameter is available only for the following regions: India (Mumbai), Japan (Tokyo), Australia (Sydney), Indonesia (Jakarta), Germany (Frankfurt), UAE (Dubai), US (Virginia), UK (London), Singapore, US (Silicon Valley), and Malaysia (Kuala Lumpur).
By default, custom images are exported in the RAW format in regions where the Image Format parameter is unavailable.
OSS Bucket(OSS Bucket): Select an OSS bucket in the same region as the custom image.
Image File Name Prefix: Enter a prefix for the names of the exported image files. For example, if you enter Demo in this field, the name of each exported image file in the specified OSS bucket is Demo-[Automatically generated object name].
Confirm that the information is correct and click OK.
During the image export process, you can view the progress of the export task or cancel the task.
You can go to the Tasks page or log on to the OSS console to view the progress of the export task.
NoteThe amount of time required to export a custom image varies based on the size of the image files and the number of concurrent export tasks in the queue.
Before the export task is completed, you can go to the Tasks page, find the task in the specified region, and then cancel the task.
What to do next
Download the custom image to your computer. For more information, see Download objects.
If you selected the RAW format when you exported the image, the default name extension of the exported image file is .raw.tar.gz and the name extension of the decompressed image files is .raw. If your computer runs Mac OS X, we recommend that you use GNU Tar to decompress the image file.