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 | Limits |
Image format and operating system | Due to copyright restrictions, you cannot export Windows Server custom images or custom images that are derived from Alibaba Cloud Marketplace images. |
Number and capacity of data disks | The capacity of each data disk cannot exceed 2,048 GiB. Note If the capacity of a data disk exceeds 2,048 GiB, distribute data on the disk to multiple data disks that are less than 2,048 GiB in size, create a custom image by using the smaller data disks, and then export the custom image. |
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 permissions 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 a RAM role. 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.
On the Custom Images tab, find the image that you want to export. In the Actions column, click Export Image.
In the Make Preparations step, check that the image meets the image export requirements and click Next.
(Conditionally required) Grant ECS the permissions to access OSS resources.
If you export an image for the first time and have not granted ECS the access permissions on OSS resources, you can directly access the Export Image dialog box for operation.
In the Export Image File to OSS section, click AliyunECSImageImportDefaultRole.
On the Cloud Resource Access Authorization page, view the
AliyunECSImageImportDefaultRole
andAliyunECSImageExportDefaultRole
roles, and click Confirm Authorization Policy.
In the Export Image dialog box, click Next.
Click Continue.
In the Export Image File step, configure the following parameters:
(Optional) Select a format in which to export the custom image. Valid values: RAW, VHD, QCOW2, VDI, and VMDK.
ImportantThe 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].
After you confirm the information, click OK to export the custom image.
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 task is completed, you can find the custom image export task in the corresponding region on the Tasks page and cancel the export task.
What to do next
Download the exported image file 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.