You can delete database clusters with the
GDC console or the Distributed Cloud CLI.

> [!NOTE]
> **Note:** When backup is disabled, deleting a database cluster is an irreversible action. When backup is enabled, you have the option to delete a cluster while keeping its backups. This makes the cluster recoverable within your set retention period.

### Console

1. From the main menu of the GDC console, choose **Database Service**.
2. Select the database cluster to delete.
3. Click **DELETE**.
4. Optional: If backup was previously enabled, select **Delete all backups**. This results in a permanent deletion. Otherwise, backups will be automatically deleted once the project's retention period expires.
5. Confirm deletion by typing the cluster's ID.
6. Click **DELETE** to finish.

### gdcloud

Delete a database cluster while keeping its backups:

```bash
gdcloud database clusters delete CLUSTER_NAME
```

To permanently delete a database cluster along with all of its backups,
include the `--hard` flag:

```bash
gdcloud database clusters delete CLUSTER_NAME --hard
```

Replace <var translate="no">CLUSTER_NAME</var> with the name of the database cluster to
delete.

For database clusters with backup enabled, omitting `--hard` deletes the
database cluster while keeping its backups (making the database cluster
recoverable within the retention period). Adding `--hard` immediately and
permanently deletes the database cluster and all of its backups.

### API

```bash
kubectl patch dbcluster.DBENGINE_NAME.dbadmin.gdc.goog DBCLUSTER_NAME -p '{"spec":{"isDeleted": true}}' --type=merge -n USER_PROJECT
kubectl delete dbcluster.DBENGINE_NAME.dbadmin.gdc.goog DBCLUSTER_NAME -n USER_PROJECT # for database clusters with backup enabled, this will permanently delete the database.
```

Replace the following variables:

- `DBENGINE_NAME`, the name of the database engine. This is one of `alloydbomni`, `postgresql`, or `oracle`.
- `USER_PROJECT`, the name of the user project where the database cluster was created.
- `DBCLUSTER_NAME`, the name of the database cluster.

For database clusters without backup, only the first step is needed. For databases with backup, running the first command only will delete the database while keeping its backups (and therefore the database cluster is still recoverable). These backups will be deleted after their retention time if no action is taken. The second command can be used to immediately delete the database cluster and all of its backups.