View a markdown version of this page

Utilizzare PurchaseHostReservation con una CLI - Amazon Elastic Compute Cloud

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Utilizzare PurchaseHostReservation con una CLI

I seguenti esempi di codice mostrano come usarePurchaseHostReservation.

CLI
AWS CLI

Come acquistare una prenotazione dell’host dedicato

Questo esempio acquista l’offerta di prenotazione dell’host dedicato per l’host dedicato specificato nell’account.

Comando:

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

Output:

{ "TotalHourlyPrice": "1.499", "Purchase": [ { "HourlyPrice": "1.499", "InstanceFamily": "m4", "PaymentOption": "NoUpfront", "HostIdSet": [ "h-013abcd2a00cbd123" ], "HostReservationId": "hr-0d418a3a4ffc669ae", "UpfrontPrice": "0.000", "Duration": 31536000 } ], "TotalUpfrontPrice": "0.000" }
PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio acquista l’offerta di prenotazione hro-0c1f23456789d0ab con configurazioni che corrispondono a quelle dell’host dedicato h-01e23f4cd567890f1

New-EC2HostReservation -OfferingId hro-0c1f23456789d0ab HostIdSet h-01e23f4cd567890f1

Output:

ClientToken : CurrencyCode : Purchase : {hr-0123f4b5d67bedc89} TotalHourlyPrice : 1.307 TotalUpfrontPrice : 0.000
Strumenti per V5 PowerShell

Esempio 1: questo esempio acquista l’offerta di prenotazione hro-0c1f23456789d0ab con configurazioni che corrispondono a quelle dell’host dedicato h-01e23f4cd567890f1

New-EC2HostReservation -OfferingId hro-0c1f23456789d0ab HostIdSet h-01e23f4cd567890f1

Output:

ClientToken : CurrencyCode : Purchase : {hr-0123f4b5d67bedc89} TotalHourlyPrice : 1.307 TotalUpfrontPrice : 0.000

Per un elenco completo delle guide per sviluppatori AWS SDK e degli esempi di codice, consulta. Crea EC2 risorse Amazon utilizzando un AWS SDK Questo argomento include anche informazioni su come iniziare e dettagli sulle versioni precedenti dell’SDK.