All Products
Search
Document Center

Elastic Compute Service:Export a custom image

Last Updated:Jan 15, 2024

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.

  • Data in encrypted images is encrypted. The data is unusable after it is exported or re-imported.

  • Image encryption is irreversible. You cannot decrypt the encrypted images to export the 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

  • 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 contains no data.

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

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:

    1. 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"
                }
            ]
        }
    2. 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

  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. On the Custom Images tab, find the image that you want to export. In the Actions column, click Export Image.

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

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

    1. In the Export Image File to OSS section, click AliyunECSImageImportDefaultRole.

    2. On the Cloud Resource Access Authorization page, view the AliyunECSImageImportDefaultRole and AliyunECSImageExportDefaultRole roles, and click Confirm Authorization Policy.

  7. In the Export Image dialog box, click Next.

  8. Click Continue.

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

      Important
      • 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].

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

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

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.