Gunakan GetHostReservationPurchasePreview dengan AWS SDK atau CLI - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan GetHostReservationPurchasePreview dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanGetHostReservationPurchasePreview.

CLI
AWS CLI

Untuk mendapatkan pratinjau pembelian untuk Reservasi Tuan Rumah Khusus

Contoh ini memberikan pratinjau biaya untuk Reservasi Host Khusus yang ditentukan untuk Host Khusus yang ditentukan di akun Anda.

Perintah:

aws ec2 get-host-reservation-purchase-preview --offering-id hro-03f707bf363b6b324 --host-id-set h-013abcd2a00cbd123

Output:

{ "TotalHourlyPrice": "1.499", "Purchase": [ { "HourlyPrice": "1.499", "InstanceFamily": "m4", "PaymentOption": "NoUpfront", "HostIdSet": [ "h-013abcd2a00cbd123" ], "UpfrontPrice": "0.000", "Duration": 31536000 } ], "TotalUpfrontPrice": "0.000" }
PowerShell
Alat untuk PowerShell

Contoh 1: Contoh ini menampilkan pratinjau pembelian reservasi dengan konfigurasi yang cocok dengan Host Khusus Anda h-01e23f4cd567890f1

Get-EC2HostReservationPurchasePreview -OfferingId hro-0c1f23456789d0ab -HostIdSet h-01e23f4cd567890f1

Output:

CurrencyCode Purchase TotalHourlyPrice TotalUpfrontPrice ------------ -------- ---------------- ----------------- {} 1.307 0.000