

Sono disponibili altri esempi AWS SDK nel repository [AWS Doc SDK](https://github.com/awsdocs/aws-doc-sdk-examples) Examples. GitHub 

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
<a name="ec2_example_ec2_ReleaseHosts_section"></a>

Gli esempi di codice seguenti mostrano come utilizzare `ReleaseHosts`.

------
#### [ 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, consulta [ReleaseHosts AWS CLI](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/release-hosts.html)*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](https://docs.aws.amazon.com/powershell/v4/reference)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](https://docs.aws.amazon.com/powershell/v5/reference)in *AWS Strumenti per PowerShell Cmdlet Reference (*V5). 

------