

Há mais exemplos de AWS SDK disponíveis no repositório [AWS Doc SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples) GitHub .

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

# Use `DeleteCluster` com um AWS SDK ou CLI
<a name="ecs_example_ecs_DeleteCluster_section"></a>

Os exemplos de código a seguir mostram como usar o `DeleteCluster`.

------
#### [ CLI ]

**AWS CLI**  
**Como excluir um cluster vazio**  
O exemplo de `delete-cluster` a seguir exclui o cluster vazio especificado.  

```
aws ecs delete-cluster --cluster MyCluster
```
Saída:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "status": "INACTIVE",
        "clusterName": "MyCluster",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0
        "statistics": [],
        "tags": []
    }
}
```
Para obter mais informações, consulte [Deleting a Cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/delete_cluster.html) no *Guia do desenvolvedor do Amazon ECS*.  
+  Para obter detalhes da API, consulte [DeleteCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-cluster.html)em *Referência de AWS CLI Comandos*. 

------
#### [ PowerShell ]

**Ferramentas para PowerShell V4**  
**Exemplo 1: esse cmdlet exclui o cluster do ECS especificado. Cancele o registro de todas as instâncias de contêiner desse cluster antes de excluí-las.**  

```
Remove-ECSCluster -Cluster "LAB-ECS"
```
**Saída**:  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-ECSCluster (DeleteCluster)" on target "LAB-ECS".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  Para obter detalhes da API, consulte [DeleteCluster](https://docs.aws.amazon.com/powershell/v4/reference)em *Referência de Ferramentas da AWS para PowerShell cmdlet (V4)*. 

**Ferramentas para PowerShell V5**  
**Exemplo 1: esse cmdlet exclui o cluster do ECS especificado. Cancele o registro de todas as instâncias de contêiner desse cluster antes de excluí-las.**  

```
Remove-ECSCluster -Cluster "LAB-ECS"
```
**Saída**:  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-ECSCluster (DeleteCluster)" on target "LAB-ECS".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  Para obter detalhes da API, consulte [DeleteCluster](https://docs.aws.amazon.com/powershell/v5/reference)em *Referência de Ferramentas da AWS para PowerShell cmdlet (V5)*. 

------
#### [ Rust ]

**SDK para Rust**  
 Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1/examples/ecs#code-examples). 

```
async fn remove_cluster(
    client: &aws_sdk_ecs::Client,
    name: &str,
) -> Result<(), aws_sdk_ecs::Error> {
    let cluster_deleted = client.delete_cluster().cluster(name).send().await?;
    println!("cluster deleted: {:?}", cluster_deleted);

    Ok(())
}
```
+  Para obter detalhes da API, consulte a [DeleteCluster](https://docs.rs/aws-sdk-ecs/latest/aws_sdk_ecs/client/struct.Client.html#method.delete_cluster)referência da *API AWS SDK for Rust*. 

------