View a markdown version of this page

Utilizzare ReleaseHosts 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 ReleaseHosts con una CLI

I seguenti esempi di codice mostrano come usareReleaseHosts.

CLI
AWS CLI

Come rilasciare un host dedicato dall’account

Come rilasciare un host dedicato dall’account. Le istanze presenti sull’host devono essere arrestate o terminate prima che l’host possa essere rilasciato.

Comando:

aws ec2 release-hosts --host-id=h-0029d6e3cacf1b3da

Output:

{ "Successful": [ "h-0029d6e3cacf1b3da" ], "Unsuccessful": [] }
  • Per i dettagli sull'API, vedi ReleaseHosts in AWS CLI Command Reference.

PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio rilascia l’ID host specificato h-0badafd1dcb2f3456

Remove-EC2Host -HostId h-0badafd1dcb2f3456

Output:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2Host (ReleaseHosts)" on target "h-0badafd1dcb2f3456". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Successful Unsuccessful ---------- ------------ {h-0badafd1dcb2f3456} {}
  • Per i dettagli sull'API, vedere ReleaseHosts in AWS Strumenti per PowerShell Cmdlet Reference (V4).

Strumenti per V5 PowerShell

Esempio 1: questo esempio rilascia l’ID host specificato h-0badafd1dcb2f3456

Remove-EC2Host -HostId h-0badafd1dcb2f3456

Output:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2Host (ReleaseHosts)" on target "h-0badafd1dcb2f3456". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Successful Unsuccessful ---------- ------------ {h-0badafd1dcb2f3456} {}
  • Per i dettagli sull'API, vedere ReleaseHosts in AWS Strumenti per PowerShell Cmdlet Reference (V5).

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.