Membuat gambar kustom. Anda dapat menggunakan gambar kustom yang dibuat untuk membuat Instance ECS (RunInstances) atau mengganti cloud disk sistem instans (ReplaceSystemDisk).
Deskripsi operasi
Sebelum memulai
-
Ini adalah operasi asinkron. Setelah permintaan untuk membuat gambar kustom dikirim, ID gambar akan dikembalikan. Namun, pembuatan gambar tidak langsung selesai. Panggil DescribeImage untuk mengkueri informasi gambar. Ketika status dalam tanggapan adalah
Available, gambar telah dibuat dan siap digunakan. Untuk informasi lebih lanjut, lihat Ikhtisar gambar kustom. -
Saat Anda mengkueri informasi Instance ECS, jika tanggapan berisi {"OperationLocks": {"LockReason" : "security"}}, Anda tidak dapat membuat gambar kustom.
-
Konfigurasikan parameter deteksi gambar
DetectionStrategysaat membuat gambar untuk membantu sistem mengoptimalkan gambar Anda. Untuk informasi lebih lanjut, lihat Ikhtisar deteksi gambar.
Berikut ini menjelaskan tiga metode untuk membuat gambar kustom dengan memanggil operasi ini. Prioritas parameter permintaan adalah: InstanceId > DiskDeviceMapping > SnapshotId. Jika permintaan Anda berisi dua atau lebih parameter ini, gambar akan dibuat berdasarkan parameter dengan prioritas tertinggi.
-
Membuat gambar kustom dari instans: Tentukan ID instans (
InstanceId).Instans harus dalam status Running (
Running) atau Stopped (Stopped).Setelah operasi dipanggil, snapshot baru akan dibuat untuk setiap disk instans.
Penting Karena instans yang berjalan mungkin memiliki data cache yang belum ditulis ke disk, data gambar kustom yang dibuat mungkin tidak konsisten dengan data instans. Hentikan instans (StopInstances) sebelum membuat gambar. -
Membuat gambar kustom dari snapshot (snapshot yang ditentukan tidak boleh dibuat pada atau sebelum 15 Juli 2013.)
Membuat gambar kustom dari snapshot disk sistem: Tentukan hanya ID snapshot disk sistem instans (
SnapshotId).- Membuat gambar kustom dari snapshot disk sistem dan disk data: Buat asosiasi data di antara beberapa disk (
DiskDeviceMapping).Hanya satu snapshot disk sistem yang dapat ditentukan.
Anda dapat menentukan beberapa snapshot disk data, hingga maksimum 16. Jika
DiskDeviceMapping.N.SnapshotIdtidak ditentukan, disk data kosong dengan kapasitas default akan dibuat.
Ketika instans dilepas, disk sistem dipertahankan sebagai disk data pay-as-you-go. Snapshot yang dibuat dari disk ini tidak mendukung pembuatan gambar kustom. Buat gambar kustom sebelum melepas instans sesuai kebutuhan.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:CreateImage |
create |
*Image
Instance
Snapshot
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
ID wilayah gambar. Anda dapat memanggil DescribeRegions untuk mengkueri daftar wilayah terbaru. |
cn-hangzhou |
| SnapshotId |
string |
No |
ID snapshot yang digunakan untuk membuat gambar kustom. Catatan
Jika Anda ingin membuat gambar kustom hanya dari snapshot disk sistem instans, Anda dapat menggunakan parameter ini atau parameter |
s-bp17441ohwkdca0**** |
| InstanceId |
string |
No |
ID instans. Parameter ini wajib diisi saat Anda membuat gambar kustom dari instans. |
i-bp1g6zv0ce8oghu7**** |
| ImageName |
string |
No |
Nama gambar. Nama harus terdiri dari 2 hingga 128 karakter. Harus diawali dengan huruf atau karakter Tionghoa dan tidak boleh diawali dengan http:// atau https://. Dapat berisi angka, titik dua (:), garis bawah (_), atau tanda hubung (-). |
TestCentOS |
| ImageFamily |
string |
No |
Nama keluarga gambar. Nama harus terdiri dari 2 hingga 128 karakter. Harus diawali dengan huruf atau karakter Tionghoa dan tidak boleh diawali dengan aliyun atau acs:. Tidak boleh mengandung http:// atau https://. Dapat berisi angka, titik dua (:), garis bawah (_), atau tanda hubung (-). |
hangzhou-daily-update |
| ImageVersion |
string |
No |
Versi gambar. Catatan
Jika Anda menentukan ID instans ( |
2017011017 |
| Description |
string |
No |
Deskripsi gambar. Deskripsi harus terdiri dari 2 hingga 256 karakter dan tidak boleh diawali dengan http:// atau https://. |
ImageTestDescription |
| Platform |
string |
No |
Distribusi sistem operasi. Setelah snapshot disk data ditentukan sebagai disk sistem gambar, gunakan parameter ini untuk menentukan distribusi sistem operasi disk sistem. Nilai valid:
Nilai default: Others Linux. |
CentOS |
| BootMode |
string |
No |
Mode boot gambar. Nilai valid:
Penting
Untuk mencegah instans gagal memulai karena mode boot yang tidak didukung, pastikan Anda memahami mode boot yang didukung oleh gambar target sebelum menentukan parameter ini. Untuk informasi lebih lanjut tentang mode boot gambar, lihat Mode boot gambar. Valid values:
|
BIOS |
| Architecture |
string |
No |
Arsitektur sistem. Setelah snapshot disk data ditentukan sebagai disk sistem gambar, gunakan parameter ini untuk menentukan arsitektur sistem disk sistem. Nilai valid:
Nilai default: x86_64. |
x86_64 |
| ClientToken |
string |
No |
Token klien yang digunakan untuk memastikan idempotensi permintaan. Anda dapat menggunakan klien untuk menghasilkan token, tetapi pastikan token tersebut unik di antara permintaan yang berbeda. ClientToken hanya dapat berisi karakter ASCII dan tidak boleh melebihi 64 karakter. Untuk informasi lebih lanjut, lihat Cara memastikan idempotensi. |
123e4567-e89b-12d3-a456-426655440000 |
| ResourceGroupId |
string |
No |
ID kelompok sumber daya tempat gambar kustom berada. Jika parameter ini tidak diatur, gambar yang dibuat akan termasuk dalam kelompok sumber daya default. Catatan
Jika Anda memanggil operasi ini sebagai Pengguna RAM dan |
rg-bp67acfmxazb4p**** |
| DiskDeviceMapping |
array<object> |
No |
Informasi disk dan snapshot yang digunakan untuk membuat gambar kustom. Gunakan parameter ini untuk menentukan snapshot saat Anda ingin membuat gambar kustom dari snapshot disk sistem dan disk data. |
|
|
object |
No |
Disk dan snapshot yang digunakan untuk membuat gambar kustom. |
||
| SnapshotId |
string |
No |
ID snapshot. |
s-bp17441ohwkdca0**** |
| Size |
integer |
No |
Ukuran disk, dalam GiB. Nilai valid dan nilai default DiskDeviceMapping.N.Size bergantung pada DiskDeviceMapping.N.SnapshotId:
|
2000 |
| Device |
string |
No |
Nama perangkat dalam gambar kustom. Nilai valid:
|
/dev/xvdb |
| DiskType |
string |
No |
Tipe disk dalam gambar baru. Anda dapat menggunakan parameter ini untuk menentukan snapshot disk data sebagai disk sistem gambar. Jika parameter ini tidak ditentukan, tipe disk akan default ke tipe disk yang sesuai dengan snapshot. Nilai valid:
|
system |
| Tag |
array<object> |
No |
Tag. |
|
|
object |
No |
Tag. |
||
| key |
string |
No |
Kunci tag gambar. Catatan
Untuk kompatibilitas yang lebih baik, gunakan Tag.N.Key. |
null |
| Key |
string |
No |
Kunci tag gambar. Nilai valid N: 1 hingga 20. Kunci tag tidak boleh berupa string kosong. Panjangnya dapat mencapai 128 karakter dan tidak boleh diawali dengan |
KeyTest |
| Value |
string |
No |
Nilai tag gambar. Nilai valid N: 1 hingga 20. Nilai tag dapat berupa string kosong. Panjangnya dapat mencapai 128 karakter dan tidak boleh diawali dengan |
ValueTest |
| value |
string |
No |
Nilai tag gambar. Catatan
Untuk kompatibilitas yang lebih baik, gunakan Tag.N.Value. |
null |
| DetectionStrategy |
string |
No |
Strategi deteksi gambar. Jika parameter ini tidak ditentukan, deteksi tidak akan dipicu. Hanya mode deteksi Standar yang didukung. Catatan
Sebagian besar versi Linux dan Windows didukung. Untuk informasi lebih lanjut tentang item deteksi gambar dan batasan sistem operasi, lihat Ikhtisar deteksi gambar dan Batasan sistem operasi untuk deteksi gambar. |
Standard |
| Features |
object |
No |
Properti fitur gambar. |
|
| ImdsSupport |
string |
No |
Mode akses metadata gambar. Nilai valid:
Nilai default: Saat membuat gambar dari snapshot, defaultnya adalah v1. Saat membuat gambar dari instans, defaultnya adalah nilai ImdsSupport dari gambar yang digunakan saat instans dibuat. |
v2 |
| DryRun |
boolean |
No |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| ImageId |
string |
ID gambar. |
m-bp146shijn7hujku**** |
| RequestId |
string |
ID permintaan. |
C8B26B44-0189-443E-9816-******* |
Contoh
Respons sukses
JSONformat
{
"ImageId": "m-bp146shijn7hujku****",
"RequestId": "C8B26B44-0189-443E-9816-*******"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidImageName.Malformed | The specified Image name is wrongly formed. | |
| 400 | InvalidImageName.Duplicated | The specified image name is already in use. | |
| 400 | InvalidDescription.Malformed | The specified description is wrongly formed. | |
| 400 | InvalidImageVersion.Malformed | The specified ImageVersion is wrongly formed. | |
| 400 | IncorrectInstanceStatus | The current status of the instance does not support this operation. | |
| 400 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | |
| 400 | InvalidDevice.Malformed | The specified parameter DiskDeviceMapping.n.Device is not valid. | |
| 400 | MissingParameter | The input parameter SnapshotId or InstanceId or DiskDeviceMapping that is mandatory for processing this request is not supplied. | |
| 400 | InvalidSize.ValueNotSupported | The specified parameter DiskDeviceMapping.n.Size beyond the permitted range. | |
| 400 | InvalidDevice.InUse | The specified parameter DiskDeviceMapping.n.Device has been occupied. | |
| 400 | OperationDenied | The specified parameter DiskDeviceMapping.n.SnapshotId does not contain system disk snapshot. | |
| 400 | InvalidDiskCategory.CreateImage | The specified diskCategory is not allowed to create image. | |
| 400 | InvalidArchitecture.Malformed | The specified Architecture is wrongly formed. | |
| 400 | InvalidPlatform.Malformed | The specified Platform is wrongly formed. | |
| 400 | InvalidParameter.AllEmpty | %s | |
| 400 | InvalidParameter.DiskType | The specified disk type which has kms key can't convert to system disk. | |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | |
| 400 | InvalidInstance.NotFoundSystemDisk | The specified instance does not have system disk. | |
| 400 | InvalidImageFamily.Malformed | The format of the specified image family is invalid. | |
| 400 | ImageQuotaExceed.ImageFamily | The specified image family exceeds the maximum number of images for one image family. | |
| 400 | ImageFamilyQuotaExceed | The number of image families exceeds the limit in the region. | |
| 400 | InvalidDiskType.ValueNotSupported | The specified disk type is not supported. | |
| 400 | IdempotenceParamNotMatch | Request uses a client token in a previous request but is not identical to that request. | |
| 400 | InvalidBootMode.NotSupport | The specified parameter BootMode is not supported for current image architecture. | |
| 400 | InvalidParameter.FeaturesImdsSupport | The specified parameter Features.ImdsSupport is not supported. | |
| 400 | InvalidOperation.DiskCategoryUnsupported | The current category of the disk does not support this operation. | |
| 400 | AccountForbidden.CreateOrder | Order cannot be created due to abnormal account. | |
| 400 | InvalidBootMode.Malformed | The specified parameter BootMode is invalid. Valid options are BIOS, UEFI, and UEFI-Preferred. | |
| 400 | InvalidDetectionStrategy.Malformed | The specified value for parameter DetectionStrategy is not supported. Please refer to the documentation for accepted values. | |
| 400 | InvalidParameter.SecureBootSupport | The specified parameter SecureBootOptions.SecureBootSupport is not valid. | |
| 500 | InternalError | The process of creating snapshot has failed due to some unknown error. | |
| 403 | IncorrectDiskStatus.NeverAttached | The specified disk has never been attached to instance. | |
| 403 | InvalidSnapshotId.NotReady | The current status of the DiskDeviceMapping.n.SnapshotId or SnapshotId does not support this operation. | |
| 403 | InvalidSnapshot.TooOld | This operation is denied because the specified snapshot by DiskDeviceMapping.n.SnapshotId or SnapshotId is created before 2013-07-15. | |
| 403 | OperationDenied | The specified snapshot is not allowed to create image. | |
| 403 | QuotaExceed.Image | The Image Quota exceeds. | |
| 403 | InvalidParamter.Conflict | The specified same token is trying to make requests with different parameters. | |
| 403 | InvalidAccountStatus.NotEnoughBalance | Your account does not have enough balance. | |
| 403 | InvalidAccountStatus.SnapshotServiceUnavailable | Snapshot service has not been opened yet. | |
| 403 | UserNotInTheWhiteList | The user is not in the white list of create image by data disk snapshot. | |
| 403 | IncorrectDiskStatus.Invalid | Device status is invalid, please restart instance and try again. | |
| 403 | OperationDenied.InvalidSnapshotCategory | %s | |
| 403 | QuotaExceed.Snapshot | The snapshot quota exceeds. | |
| 403 | IncorrectDiskStatus.Transferring | The specified device is transferring, you can retry after the process is finished. | |
| 403 | IncorrectDiskStatus | The current disk status does not support this operation. | |
| 403 | InvalidSystemSnapshot.Missing | %s | |
| 403 | IncorrectDiskStatus.CreatingSnapshot | A previous snapshot creation is in process. | |
| 403 | InvalidParameter.KMSKeyId.CMKUnauthorized | The CMK needs to be added ECS tag. | |
| 403 | InvalidParameter.KMSKeyId.CMKNotEnabled | The CMK needs to be enabled. | |
| 403 | InvalidParameter.KMSKeyId.KMSUnauthorized | ECS service have no right to access your KMS. | |
| 403 | QuotaExceed.Tags | %s | |
| 403 | InvalidSnapshotCategory.NotSupportImageCreation | The specified snapshot category does not support create image. | |
| 403 | TooManySnapshot.Unfinished | There are too many snapshots being created, please wait for them to be created done. | |
| 403 | HibernationConfigured.InstanceOperationForbidden | The operation is not permitted due to limit of the hibernation configured instance. | |
| 403 | SnapshotNotReady | The specified snapshot is not ready. | |
| 403 | IncorrectInstanceStatus.NeedRestart | The instance needs to be restarted after adding a disk in a shutdown status. | |
| 403 | QuotaExceed.ConcurrentSnapshotQuota | The number of snapshots being created for the disk %s has exceeded the concurrent quota (%s). Please wait for the previous snapshots to complete before trying again. | |
| 403 | InvalidOperation.SnapshotStorageLocationUnsupported | Snapshots with storage location in CloudBox do not support the current operation. | |
| 403 | AccountEnterpriseStatusInvalid | Your enterprise registration is marked as revoked/deregistered in the National Enterprise Credit Information Publicity System. Account transaction features (purchase/renewal/recharge) are disabled. Please update real-name certification via Account Center. Restrictions will auto-remove after verification. | |
| 403 | InvalidOperation.DefaultFreeSnapshotNotSupport | The specified snapshot is a default free snapshot and does not support this operation. | |
| 404 | InvalidSnapshotId.NotFound | The specified SnapshotId does not exist. | |
| 404 | InvalidInstanceId.NotFound | The specified instance %s does not exist. | |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.