All Products
Search
Document Center

Elastic Compute Service:Export a custom image

Last Updated:Sep 07, 2023

After you create a custom image, you can export the image in the Elastic Compute Service (ECS) console to an Object Storage Service (OSS) bucket and then download the image from the bucket to your computer for analysis and backup purposes. 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 meet the requirements for exporting custom images. For more information, see Permissions.

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

  • You can export images that contain snapshots of up to four 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 the data on the disk to multiple data disks that are less than 2,048 GiB in size, create a custom image from the smaller data disks, and then export the custom image.

Considerations

Item

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 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 files

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

  • To use an exported image to create identical Linux instances, make sure that the file system information recorded in the /etc/fstab directory is consistent with the exported data disk snapshot information.

  • If you create a custom image based on a disk that does not contain data and export the image, the decompressed image file also does not contain data.

  • An exported image may not start normally on other platforms. You can attach disks contained in the image to obtain data.

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:

    1. 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 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"
                }
            ]
        }
    2. 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 a specific OSS bucket to a RAM user, see Tutorial: Use RAM policies to control access to OSS.

Procedure

  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.

    Important

    Make sure that the OSS bucket in which you want to store the exported image files resides in the selected region.

  4. (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.

    1. On the Custom Images tab, find the image that you want to export. In the Actions column, click Export Image.

    2. On the Cloud Resource Access Authorization page, click Authorize.

    3. View the AliyunECSImageImportDefaultRole and AliyunECSImageExportDefaultRole roles and click Confirm Authorization Policy.

  5. On the Custom Images tab, find the image that you want to export. In the Actions column, click Export Image.

  6. In the Make Preparations step, check that the image meets the image export requirements and click Next.

  7. Click Continue.

  8. 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.

      Note
      • The 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].

  9. 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.

      Note

      The 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.

Note

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.