How to Relocate Database Clusters

Validated on 24 Apr 2025 • Last edited on 24 Apr 2025

Valkey is a high-performance, open-source database that stores key-value data in memory, and is designed for caching, message queues, and primary database use. Fully compatible with Redis, Valkey serves as a drop-in replacement.

Relocating a database cluster changes which DigitalOcean datacenter hosts it. We recommend hosting your DigitalOcean resources in the same datacenter. This minimizes the latency in connections between them and helps improve performance.

Relocate a Database Cluster Using the CLI

Note
To migrate a database cluster using doctl, you need to provide a value for the --region flag. Use the doctl databases options regions command to get a list of available values.
How to Migrate a Database Using the DigitalOcean CLI
  1. Install doctl, the official DigitalOcean CLI.
  2. Create a personal access token and save it for use with doctl.
  3. Use the token to grant doctl access to your DigitalOcean account.
    doctl auth init
  4. Finally, run doctl databases migrate. Basic usage looks like this, but you can read the usage docs for more details:
    doctl databases migrate <database-cluster-id> [flags]
How to Relocate a Database Cluster Using the DigitalOcean CLI
  1. Install doctl, the official DigitalOcean CLI.
  2. Create a personal access token and save it for use with doctl.
  3. Use the token to grant doctl access to your DigitalOcean account.
    doctl auth init
  4. Finally, run doctl databases migrate. Basic usage looks like this, but you can read the usage docs for more details:
    doctl databases migrate <database-cluster-id> [flags]

Relocate a Database Cluster Using the API

How to Relocate a Database Cluster Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a PUT request to https://api.digitalocean.com/v2/databases/{database_cluster_uuid}/migrate.

cURL

Using cURL:

curl -X PUT \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"region":"lon1"}' \
  "https://api.digitalocean.com/v2/databases/9cc10173-e9ea-4176-9dbc-a4cee4c4ff30/migrate"

Go

Using Godo, the official DigitalOcean API client for Go:

import (
    "context"
    "os"

    "github.com/digitalocean/godo"
)

func main() {
    token := os.Getenv("DIGITALOCEAN_TOKEN")

    client := godo.NewFromToken(token)
    ctx := context.TODO()

    migrateRequest := &godo.DatabaseMigrateRequest{
        Region: "lon1",
    }

    _, err := client.Databases.Migrate(ctx, "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", migrateRequest)
}

Python

Using PyDo, the official DigitalOcean API client for Python:

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "region": "lon1"
}

update_resp = client.databases.update_region(database_cluster_uuid="a7a8bas", body=req)

Relocate a Database Cluster using the Control Panel

To relocate a database cluster from the control panel, select your database cluster from the Databases page. Click the name of the cluster to go to its Overview page, then click the Settings tab.

Cluster settings page.

On the Settings page, in the Cluster datacenter section, click Edit. Select the region and datacenter to which you want to relocate your cluster.

Datacenter selection screen.

Click Save to begin the relocation process. The time to complete the relocation varies depending on the size of the cluster and its data.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.