Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan CancelCapacityReservation dengan CLI
Contoh kode berikut menunjukkan cara menggunakanCancelCapacityReservation.
- CLI
-
- AWS CLI
-
Untuk membatalkan reservasi kapasitas
cancel-capacity-reservationContoh berikut membatalkan reservasi kapasitas yang ditentukan.aws ec2 cancel-capacity-reservation \ --capacity-reservation-idcr-1234abcd56EXAMPLEOutput:
{ "Return": true }Untuk informasi selengkapnya, lihat Membatalkan Reservasi Kapasitas di Panduan EC2 Pengguna Amazon.
-
Untuk detail API, lihat CancelCapacityReservation
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell V4
-
Contoh 1: Contoh ini membatalkan reservasi kapasitas cr-0c1f2345db6f7cdba
Remove-EC2CapacityReservation -CapacityReservationId cr-0c1f2345db6f7cdbaOutput:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2CapacityReservation (CancelCapacityReservation)" on target "cr-0c1f2345db6f7cdba". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y True-
Untuk detail API, lihat CancelCapacityReservationdi Referensi Alat AWS untuk PowerShell Cmdlet (V4).
-
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini membatalkan reservasi kapasitas cr-0c1f2345db6f7cdba
Remove-EC2CapacityReservation -CapacityReservationId cr-0c1f2345db6f7cdbaOutput:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2CapacityReservation (CancelCapacityReservation)" on target "cr-0c1f2345db6f7cdba". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y True-
Untuk detail API, lihat CancelCapacityReservationdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-