This page describes how to delete instances in Memorystore for Valkey.

## Delete an instance

You can delete instances by using the Google Cloud console or the
[Google Cloud CLI](https://docs.cloud.google.com/sdk/gcloud.md.txt).

> [!CAUTION]
> **Important** : If you delete an instance and create another instance with the same name, then Memorystore for Valkey assigns different IP addresses to the instance. If you hardcode the IP addresses from the instance that you delete into your client applications, then the clients can't connect to the instance. You must update the IP addresses to point to the instance's new [discovery endpoints](https://docs.cloud.google.com/memorystore/docs/valkey/instance-node-specification.md.txt#discovery_endpoint).

### Console

1. In the Google Cloud console, go to the **Memorystore for Valkey** page.

   [Memorystore for Valkey](https://console.cloud.google.com/memorystore/valkey/instances)
2. Click the instance that you want to delete.

3. **Optional**. If the instance that you want to delete is a secondary
   instance, then do the following:

   1. Click the expander arrow next to the primary instance that's the parent of the secondary instance.
   2. Click the link of the secondary instance.
4. Click **Delete**.

5. In the dialog, enter the instance ID, and then click **Delete**.

### gcloud

To delete an instance, use the [`gcloud memorystore instances delete`](https://docs.cloud.google.com/sdk/gcloud/reference/memorystore/instances/delete) command.

```
gcloud memorystore instances delete INSTANCE_ID \
--project=PROJECT_ID \
--location=REGION_ID
```

Make the following replacements:

- <var translate="no">INSTANCE_ID</var>: the ID of the instance that you want to delete
- <var translate="no">PROJECT_ID</var>: your project ID
- <var translate="no">REGION_ID</var>: the region where your instance is located

For example:

```
gcloud memorystore instances delete my-instance \
--project=my-project \
--location=us-central1
```