All Products
Search
Document Center

Elastic Compute Service:CreateCapacityReservation

Last Updated:Jun 12, 2026

Membuat layanan reservasi kapasitas dengan menentukan tipe instans, jumlah total, metode pengaktifan, dan zona instans yang akan direservasi.

Deskripsi operasi

Deskripsi

Layanan reservasi kapasitas memungkinkan Anda menentukan zona, tipe instans, dan atribut lainnya untuk mereservasi Sumber daya yang sesuai dengan atribut tersebut dalam bentuk private pool. Untuk informasi lebih lanjut, lihat Ikhtisar reservasi kapasitas langsung.

  • Saat ini, hanya mode pengaktifan langsung yang didukung. Setelah Anda membeli layanan reservasi kapasitas langsung, tipe instans akan ditagih berdasarkan metode penagihan pay-as-you-go, terlepas dari apakah instans pay-as-you-go benar-benar dibuat, hingga Anda secara manual merilis reservasi kapasitas langsung atau sistem secara otomatis merilisnya saat kedaluwarsa.
    • Anda dapat menentukan opsi kapasitas private pool saat membuat instans dengan memanggil CreateInstance atau RunInstances, atau Anda dapat mengubah opsi kapasitas private pool instans dengan memanggil ModifyInstanceAttachmentAttributes. Setelah instans berhasil mencocokkan kapasitas private pool, biaya untuk tipe instans, disk, bandwidth publik, dan Sumber daya terkait lainnya akan ditagih berdasarkan konfigurasi instans Anda.

    • Jika tidak ada instans pay-as-you-go yang benar-benar dibuat, hanya biaya untuk tipe instans yang akan ditagih.

  • Tagihan untuk instans yang cocok dan kapasitas yang tidak terpakai dari reservasi kapasitas langsung dapat di-Offset oleh savings plans atau Instans terjadwal Wilayah, tetapi tidak dapat di-Offset oleh Instans terjadwal zona. Kami menyarankan Anda untuk membeli Instans terjadwal atau savings plans terlebih dahulu, lalu menggunakan layanan reservasi kapasitas langsung di bawah cakupan Instans terjadwal atau savings plans untuk mendapatkan jaminan kepastian Sumber daya secara gratis.

Catatan

API ini hanya mendukung pembuatan reservasi kapasitas langsung. Anda dapat membuat reservasi kapasitas langsung atau reservasi kapasitas terjadwal di Konsol ECS. Untuk informasi lebih lanjut, lihat Layanan reservasi Sumber daya.

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:CreateCapacityReservation

create

*CapacityReservation

acs:ecs:{#regionId}:{#accountId}:capacityreservation/*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

RegionId

string

Yes

ID wilayah layanan reservasi kapasitas. Anda dapat memanggil DescribeRegions untuk mengkueri daftar wilayah Alibaba Cloud terbaru.

cn-hangzhou

ResourceGroupId

string

No

ID kelompok sumber daya perusahaan tempat layanan reservasi kapasitas berada.

rg-bp67acfmxazb4p****

Tag

array<object>

No

Daftar pasangan tag yang terikat pada layanan reservasi kapasitas.

object

No

Pasangan tag.

Key

string

No

Kunci tag layanan reservasi kapasitas. Nilai valid N: 1 hingga 20. Setelah nilai ini ditentukan, nilai tidak boleh berupa string kosong. Panjangnya dapat mencapai 128 karakter. Tidak boleh diawali dengan aliyun atau acs:, dan tidak boleh mengandung http:// atau https://.

TestKey

Value

string

No

Nilai tag layanan reservasi kapasitas. Nilai valid N: 1 hingga 20. Setelah nilai ini ditentukan, nilai dapat berupa string kosong. Panjangnya dapat mencapai 128 karakter. Tidak boleh diawali dengan acs:, dan tidak boleh mengandung http:// atau https://.

TestValue

ClientToken

string

No

Token klien yang digunakan untuk memastikan idempotensi permintaan. Anda dapat menggunakan klien untuk menghasilkan nilai, tetapi Anda harus memastikan bahwa nilai tersebut unik di antara permintaan yang berbeda. Nilai ClientToken hanya dapat berisi karakter ASCII dan panjangnya tidak boleh melebihi 64 karakter. Untuk informasi lebih lanjut, lihat Cara memastikan idempotensi.

0c593ea1-3bea-11e9-b96b-88e9fe637760

PrivatePoolOptions.Name

string

No

The name of the capacity reservation service. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

crpTestName

Description

string

No

Deskripsi layanan reservasi kapasitas. Panjang deskripsi harus 2 hingga 256 karakter dan tidak boleh diawali dengan http:// atau https://.

Nilai default: kosong.

This is description.

PrivatePoolOptions.MatchCriteria

string

No

The type of the private pool generated after the capacity reservation service takes effect. Valid values:

  • Open: open mode. When you start an instance, the private pool capacity of the open type is automatically matched. If no matching private pool capacity is available, the resources in the public pool are used to start the instance.

  • Target: targeted mode. The specified private pool capacity is used to start the instance. If the private pool capacity is unavailable, the instance fails to start.

Default value: Open.

Open

InstanceAmount

integer

Yes

Jumlah total instans yang akan direservasi dalam satu tipe instans.

2

InstanceType

string

Yes

Tipe instans. Saat ini, Anda hanya dapat mengatur layanan reservasi kapasitas untuk satu tipe instans. Anda dapat memanggil DescribeInstanceTypes untuk mengkueri tipe instans yang disediakan oleh Elastic Compute Service (ECS).

ecs.g6.xlarge

StartTime

string

No

Mode pengaktifan layanan reservasi kapasitas. Saat ini, hanya mode pengaktifan langsung yang didukung saat Anda memanggil API.

Catatan

Jika Anda tidak menentukan parameter ini, layanan reservasi kapasitas akan berlaku secara langsung.

2021-10-30T05:32:00Z

EndTime

string

No

Waktu kedaluwarsa layanan reservasi kapasitas. Tentukan waktu dalam standar ISO 8601 UTC. Waktu harus dalam format yyyy-MM-ddTHH:mm:ssZ. Untuk informasi lebih lanjut, lihat ISO 8601.

2021-10-30T06:32:00Z

EndTimeType

string

No

Mode rilis layanan reservasi kapasitas. Nilai valid:

  • Limited: Layanan reservasi kapasitas dirilis pada waktu yang ditentukan. Parameter EndTime harus ditentukan.

  • Tanpa Batas: Layanan reservasi kapasitas dirilis secara manual. Tidak ada batas waktu yang diterapkan.

Unlimited

Platform

string

No

Tipe sistem operasi image yang digunakan oleh instans. Parameter ini sesuai dengan parameter Platform dari Instans terjadwal Wilayah. Jika tipe sistem operasi layanan reservasi kapasitas dan Instans terjadwal Wilayah cocok, Instans terjadwal Wilayah dapat digunakan untuk meng-Offset Tagihan kapasitas yang tidak terpakai dalam layanan reservasi kapasitas. Nilai valid:

  • Windows: Sistem operasi Server Windows.

  • Linux: Sistem operasi Linux dan mirip Unix.

Nilai default: Linux.

Catatan

Parameter ini belum tersedia.

Linux

ZoneId

array

Yes

ZoneId

array

Yes

ID zona layanan reservasi kapasitas di wilayah. Saat ini, Anda hanya dapat membuat layanan reservasi kapasitas di satu zona.

cn-hangzhou-h

string

No

ID zona layanan reservasi kapasitas di wilayah.

cn-hangzhou-h

Elemen respons

Element

Type

Description

Example

object

PrivatePoolOptionsId

string

ID layanan reservasi kapasitas.

crp-bp67acfmxazb4****

RequestId

string

ID permintaan.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Contoh

Respons sukses

JSONformat

{
  "PrivatePoolOptionsId": "crp-bp67acfmxazb4****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 InvalidParameter.RegionId The specified RegionId is invalid.
400 NoStock The stock in the availability zone is insufficient.
400 MissingParameter The input parameter StartTime is missing.
400 OperationDenied The specified instanceType or zone is not available or not authorized.
400 MissingParameter.RegionId The specified RegionId should not be null.
400 InvalidStartTime.NotSupported The specified StartTime should be within 180 calendar days from the current date, and you must specify a precision to hour.
400 InvalidStartTime.MalFormed The specified StartTime is out of the permitted range.
400 Invalid.PrivatePoolOptionsName.MalFormed The specified PrivatePoolOptions.Name is not valid.
400 Invalid.ZoneId The specified ZoneId is not valid.
400 Invalid.InstanceType The specified InstanceType is not valid.
400 DedicatedHostNotSupported DedicatedHost is not supported for PrivatePool.
400 SpotNotSupported Spot is not supported for PrivatePool.
400 ClassicNetworkNotSupported Classic network is not supported for PrivatePool.
400 Invalid.InstanceId Instance does not exist.
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation.
400 MissingParameter.PrivatePoolOptions.Id The specified PrivatePoolOptions.Id should not be null.
400 Invalid.PrivatePoolOptions.Id The PrivatePool does not exist.
400 Invalid.InstanceChargeType The InstanceChargeType does not match the PrivatePool.
400 Invalid.PrivatePoolOptions.status The PrivatePool has been used up.
400 InvalidPlatform.ValueNotSupported The Platform does not match the PrivatePool.
400 InvalidAliUid The PrivatePool does not belong to the user of the Instance.
400 MissingParameter.PackageType The specified parameter "PackageType" can not be empty.
400 MissingParameter.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" can not be empty.
400 MissingParameter.InstanceCpuCoreCount The specified parameter "InstanceCpuCoreCount" can not be empty.
400 MissingParameter.InstanceAmount The specified parameter "InstanceAmount" can not be empty.
400 MissingParameter.InstanceCpuCoreCountOrInstanceAmount The specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time.
400 Invalid.TooManyPrivatePoolOptions.Ids Too many PrivatePoolOptions.Ids in this request.
400 Invalid.TooManyZoneIds Too many ZoneIds in the request.
400 Invalid.TooManyInstanceTypes Too many InstanceTypes in the request.
400 Invalid.TooManyUnpaidPrivatePool Too many PrivatePools create but still unpaid.
400 Invalid.InstanceCpuCoreCountOrInstanceAmount Both InstanceCpuCoreCount and InstanceAmount are provided.
400 Invalid.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" exist invalid element Id.
400 Invalid.PackageType The specified parameter "PackageType" is invalid.
400 Invalid.PrivatePool.Purchase The PrivatePool has already paid.
400 Invalid.AssuranceTimes.NotSupported The value of AssuranceTimes is not supported.
400 RepeatStartPrivatePool PrivatePool has already been started.
400 Invalid.TimeSlot The param time slot is invalid.
400 Invalid.EndTime The specified parameter "EndTime" is not valid.
400 StartTime.NotNeed The specified parameter "StartTime" should leave empty.
400 AccountForbidden.ProductCreationLimited The commodity must be officially operated by Aliyun and in pay-as-you-go billing method.
400 RegionUnauthorized There is no authority to create private pool in the specified region.
400 PriceNotFound The price of your queried resource is not available now, please try other resources.
500 InternalError The request processing has failed due to some unknown error, exception or failure.
403 Zone.NotOpen The specified zone is not granted to you to buy resources yet.
403 InvalidResourceType.NotSupported %s
403 OperationDenied.NoStock The resource is out of stock in the specified zone. Please try other types, or choose other regions and zones.
403 InvalidInstanceType.NotSupported The specified InstanceType is invalid.
403 Invalid.ZoneIds At least one of the specified ZoneIds are invalid.
403 Zone.NotOnSale The specified zone is not available for purchase.
404 InvalidZoneId.NotFound The specified zoneId 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.