All Products
Search
Document Center

Elastic Compute Service:ExportImage

Last Updated:Jun 12, 2026

Mengekspor custom image ke bucket Object Storage Service (OSS) di region yang sama dengan custom image.

Deskripsi operasi

Sebelum Anda mengekspor image:

  • Pastikan Anda memahami prasyarat dan pertimbangannya. Untuk informasi lebih lanjut, lihat Mengekspor custom image.

  • Parameter ImageFormat, yang menentukan format image yang diekspor, hanya tersedia di beberapa region, termasuk Jepang (Tokyo), Indonesia (Jakarta), Jerman (Frankfurt), UEA (Dubai), AS (Virginia), Inggris (London), Singapura, Malaysia (Kuala Lumpur), dan AS (Silicon Valley). Di region yang tidak mendukung pengaturan format image, image diekspor dalam format RAW secara default.

  • Anda harus menggunakan RAM untuk memberikan izin kepada Elastic Compute Service (ECS) untuk menulis data ke OSS. Prosedur:

    • Buat role bernama AliyunECSImageExportDefaultRole (nama role lain tidak valid) dan lampirkan kebijakan role berikut ke role tersebut:

         {
           "Statement": [
             {
               "Action": "sts:AssumeRole",
               "Effect": "Allow",
               "Principal": {
                 "Service": [
                   "ecs.aliyuncs.com"
                 ]
               }
             }
           ],
           "Version": "1"
         }
      

    • Lampirkan kebijakan sistem default AliyunECSImageExportRolePolicy ke role AliyunECSImageExportDefaultRole. Kebijakan ini adalah kebijakan default yang disediakan oleh ECS untuk mengekspor image. Untuk informasi lebih lanjut, lihat Otorisasi Akses Resource Cloud. Anda juga dapat membuat kebijakan kustom yang berisi izin berikut:

           {
             "Version": "1",
             "Statement": [
               {
                 "Action": [
                   "oss:GetObject",
                   "oss:PutObject",
                   "oss:DeleteObject",
                   "oss:GetBucketLocation",
                   "oss:GetBucketInfo",
                   "oss:AbortMultipartUpload",
                   "oss:ListMultipartUploads",
                   "oss:ListParts"
                 ],
                 "Resource": "*",
                 "Effect": "Allow"
               }
             ]
           }
      

Setelah Anda mengekspor image:

Custom image disimpan di bucket OSS yang ditentukan dan dapat diunduh. Untuk informasi lebih lanjut, lihat Mengunduh berkas custom image.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ExportImage

update

*Image

acs:ecs:{#regionId}:{#accountId}:image/{#imageId}

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

RegionId

string

Yes

ID region dari custom image. Anda dapat memanggil operasi DescribeRegions untuk mengkueri daftar region Alibaba Cloud terbaru.

cn-hangzhou

ImageId

string

Yes

ID dari custom image.

m-bp67acfmxazb4p****

OSSBucket

string

Yes

Bucket OSS untuk menyimpan image yang diekspor.

testexportImage

OSSPrefix

string

No

Prefiks dari OSS object Anda. Prefiks dapat berisi angka dan huruf serta harus memiliki panjang 1 hingga 30 karakter.

EcsExport

ImageFormat

string

No

Format dari image yang diekspor. Nilai yang valid:

  • raw

  • vhd

  • qcow2

  • vmdk

  • vdi

Nilai default: raw.

raw

RoleName

string

No

Nama role Resource Access Management (RAM) yang digunakan untuk mengekspor image.

AliyunECSImageExportDefaultRole

DryRun

boolean

No

Elemen respons

Element

Type

Description

Example

object

RequestId

string

ID permintaan.

C8B26B44-0189-443E-9816-D951F596****

TaskId

string

ID dari task ekspor image.

tsk-bp67acfmxazb4p****

RegionId

string

ID region.

cn-hangzhou

Contoh

Respons sukses

JSONformat

{
  "RequestId": "C8B26B44-0189-443E-9816-D951F596****",
  "TaskId": "tsk-bp67acfmxazb4p****",
  "RegionId": "cn-hangzhou"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 MissingParameter An input parameter "RegionId" that is mandatory for processing the request is not supplied.
400 InvalidImageName.Malformed The specified Image name is wrongly formed.
400 InvalidOSSPrefix.Malformed The specified OSSPrefix format is wrongly formed.
400 InvalidRegionId.NotFound The specified RegionId does not exist.
400 InvalidRegion.NotSupport The specified region does not support image import or export.
400 IncorrectImageStatus The specified Image is not available.
400 InvalidImageFormat.Malformed The specified Image Format is wrongly formed.
400 InvalidOSSBucket.NotFound The specified OSS bucket does not exist in this region.
400 OperationDenied The specified image contains the snapshot of the data disk,does not support this operation.
400 InvalidImage.DiskAmountOrSize %s
400 ImageNotSupported The specified Image contains encrypted snapshots, do not support export.
400 InvalidOSSObject.NeedRestore The specified OSS object is a archive object, need restore first.
400 InvalidOSSBucket.NotMatched The specified OSS bucket is incorrect, %s.
400 InvalidImageFormat.RegionNotSupported The specified image format is not supported in current region.
400 InvalidOSSBucket.ArchiveOssBucketNotSupported Exporting an image to an OSS bucket with Archive, Cold Archive, or Deep Cold Archive storage class is not supported.
403 ImageNotSupported The specified image from the image market, do not support export image.
403 ImageIsExporting The specified Image is being exported. You can use the DescribeTasks API to check the status of existing tasks.
403 ExportImageFailed Exporting image is failed, Please contact the administrator.
403 UserNotInTheWhiteList The user is not in the white list of exporting image.
403 NoSetRoletoECSServiceAcount ECS service account Have no right to access your OSS.please attach a role of access your oss to ECS service account.
403 InvalidOSS.NotAuthorized The specified OSS bucket or object is not allowed to access.
403 ConcurrentQuotaExceed.ExportImage %s
403 WeeklyQuotaExceed.ExportImage %s
403 InvalidImageLicense.NotSupported %s
403 InvalidImageCategory.NotSupported The specified image category is not supported.
403 InvalidOSSBucket.EncryptUnsupported Accessing objects from encrypted OSS bucket is not supported.
404 InvalidImageId.NotFound The specified ImageId does not exist.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.