This document explains how to delete a cluster in Cluster Director.

When you no longer need a cluster and its associated resources, you can
permanently delete it to save costs and free up resources. Deleting a cluster is
an irreversible action that also deletes all of its Compute Engine instances
and Slurm or managed compute configuration.

> [!WARNING]
> **Warning:** When you delete a cluster, you also delete any network or storage resources that Cluster Director created for it. To avoid data loss and retain these resources, back them up before you delete the cluster. If you specified existing network or storage resources when creating the cluster, then deleting the cluster doesn't impact those resources.

## Limitations

When you delete a cluster in Cluster Director, the following limitations
apply.

### Custom firewall rules in managed compute clusters

Before you delete a managed compute cluster, delete any custom firewall rules
that you created in the cluster's Virtual Private Cloud (VPC) network. If custom
firewall rules remain in that network, then attempting to delete the cluster
fails.

### Cluster labels and resource name prefixes

When you delete a cluster, Cluster Director filters resources in your
project by label and name prefix. Don't apply cluster labels from
Cluster Director to Compute Engine resources outside
Cluster Director, and don't start their names with
`CLUSTER_NAME-`. Otherwise, if one of those external resources
matches a cluster label or name prefix, then Cluster Director deletes that
resource, or cluster deletion fails or times out.

To avoid errors or accidental deletion of a Compute Engine resource outside Cluster Director that matches a cluster label or name prefix,
[remove the label](https://docs.cloud.google.com/compute/docs/labeling-resources.md.txt#remove_a_label) or recreate
the resource with a different name before you delete the cluster.

The following table lists the cluster labels and name prefixes that
Cluster Director checks when you delete a cluster:

| Compute Engine resource | Cluster label or name prefix | Behavior during cluster deletion |
| Compute instances in Slurm clusters | The compute instance has both `slurm_cluster_name:CLUSTER_NAME` and `slurm_instance_role:compute` labels in a Slurm cluster's zone. | Cluster Director deletes the compute instance. |
| Compute instances in Slurm or managed compute clusters | The compute instance has the label `slurm_cluster_name:CLUSTER_NAME` on a Slurm cluster, or the label `cd_compute_engine_cluster_name:CLUSTER_NAME` on a managed compute cluster. | Cluster Director keeps the compute instance and waits for you to delete that compute instance until cluster deletion times out. |
| Regional managed instance groups (MIGs) | The MIG name starts with `CLUSTER_NAME-` in the cluster's region. | Cluster Director deletes the MIG and all compute instances in that MIG. |
| Instance templates | The instance template name starts with `CLUSTER_NAME-copy-` in your project. | If no resource uses the instance template, then Cluster Director deletes that template. If another resource uses the instance template, then the operation to delete the cluster retries until the operation times out or you delete the resource that uses the template. |
| Compact placement policies or workload policies | The name of the compact placement policy or workload policy starts with `CLUSTER_NAME-slurmgcp` or matches `CLUSTER_NAME-NODESET_NAME-wp-*`, where `NODESET_NAME` is a nodeset name or any lowercase alphanumeric string, in any region of your project. | If no compute instance uses the compact placement policy or workload policy, then Cluster Director deletes that policy. If a compute instance uses the policy, then attempting to delete the cluster fails. |
|---|---|---|

## Before you begin

Select the tab for how you plan to use the samples on this page:

### Console


When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.

### gcloud

In the Google Cloud console, activate Cloud Shell.

[Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)


At the bottom of the Google Cloud console, a
[Cloud Shell](https://docs.cloud.google.com/shell/docs/how-cloud-shell-works.md.txt)
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.

### REST


To use the REST API samples on this page in a local development environment, you use the
credentials you provide to the gcloud CLI.

1. [Install](https://docs.cloud.google.com/sdk/docs/install) the Google Cloud CLI.
2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud.md.txt).


For more information, see
[Authenticate for using REST](https://docs.cloud.google.com/docs/authentication/rest.md.txt)
in the Google Cloud authentication documentation.

### Required roles


To get the permission that
you need to delete clusters,

ask your administrator to grant you the
[Cluster Director Editor](https://docs.cloud.google.com/iam/docs/roles-permissions/hypercomputecluster.md.txt#hypercomputecluster.editor) (`roles/hypercomputecluster.editor`) IAM role on your project.


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


This predefined role contains the
`hypercomputecluster.clusters.delete`
permission,
which is required to
delete clusters.


You might also be able to get
this permission
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

## Delete a cluster

To delete a cluster in your project, select one of the following options:

### Console

1. In the Google Cloud console, go to the **Clusters** page.

   [Go to Clusters](https://console.cloud.google.com/cluster-director/clusters/list)
2. In the **Clusters** table, in the **Name** column, click the name of the
   cluster that you want to delete. A page that gives the details of the
   cluster appears, and the **Details** tab is selected.

3. Click **Delete**.

4. In the dialog that appears, enter the name of your cluster, and then
   click **Delete** to confirm.

   The **Clusters** page appears. Deleting your cluster can take some time
   to complete.

### gcloud

To delete a cluster, use the
[`gcloud alpha cluster-director clusters delete` command](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/cluster-director/clusters/delete.md.txt).

To run the command, select one of the following options:

### Bash

```bash
gcloud alpha cluster-director clusters delete CLUSTER_NAME \
    --location=REGION
```

### Powershell

```powershell
gcloud alpha cluster-director clusters delete CLUSTER_NAME `
    --location=REGION
```

### cmd.exe

```batch
gcloud alpha cluster-director clusters delete CLUSTER_NAME ^
    --location=REGION
```

Replace the following:

- `CLUSTER_NAME`: the
  name of the cluster that you want to delete.

- `REGION`: the region where
  your cluster exists.

The output is similar to the following:

    Delete request issued for: [cluster000]
    Waiting for operation [projects/example-project/locations/us-central1/operations/operation-1759334170069-6401ae83f88df-342228e4-42174ca2] to complete...working...

Deleting your cluster can take some time to complete. When it does complete,
the output is similar to the following:

    Deleted cluster [cluster000].

### REST

To delete a cluster, make a `DELETE` request to the
[`clusters.delete` method](https://docs.cloud.google.com/cluster-director/docs/reference/rest/v1/projects.locations.clusters/delete.md.txt).

Your request must include the following HTTP method and request URL:

    DELETE https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME

Replace the following:

- `PROJECT_ID`: the ID of
  your project.

- `REGION`: the region where
  your cluster exists.

- `CLUSTER_NAME`: the
  name of the cluster that you want to delete.

To send your request, select one of the following options:

### curl (Bash)

```bash
curl -X DELETE \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME"
```

### Powershell

```powershell
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method DELETE `
    -Headers $headers `
    -Uri "https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME" | Select-Object -Expand Content
```

### curl (cmd.exe)

```batch
curl -X DELETE ^
     -H "Authorization: Bearer $(gcloud auth print-access-token)" ^
     "https://hypercomputecluster.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/clusters/CLUSTER_NAME"
```

The response is similar to the following:

    {
      "name": "projects/example-project/locations/us-central1/operations/operation-1758790097068-63f9c3af860a4-1f0c5497-8b116854",
      "metadata": {
        "@type": "type.googleapis.com/google.cloud.hypercomputecluster.v1.OperationMetadata",
        "createTime": "2025-09-25T08:48:17.077238445Z",
        "target": "projects/example-project/locations/us-central1/clusters/clusterfpv",
        "verb": "delete",
        "requestedCancellation": false,
        "apiVersion": "v1"
      },
      "done": false
    }

Deleting your cluster can take some time to complete.

## What's next

- Create a new cluster:

  - [Create an AI- or HPC-optimized cluster from a template](https://docs.cloud.google.com/cluster-director/docs/create/cluster-from-template.md.txt)

  - [Create a custom cluster](https://docs.cloud.google.com/cluster-director/docs/create/custom-cluster.md.txt)

- [View audit logs](https://docs.cloud.google.com/cluster-director/docs/monitor/view-audit-logs.md.txt)