---
title: Migrating Database Instance endpoints via the Scaleway CLI
description: This page explains how to migrate Database Instance endpoints via the Scaleway CLI.
tags: managed-database postgresql mysql engine version database engine endpoints
dates:
  validation: 2025-06-09
  posted: 2023-11-22
---
import Requirements from '@macros/iam/requirements.mdx'


You can migrate your endpoints from a Database Instance to another anytime, using the Scaleway CLI.

The following commands are useful when you [upgrade the version of your database engine](/managed-databases-for-postgresql-and-mysql/how-to/upgrade-version/) via the **Upgrade only** option. In this case, you must manually migrate your endpoint.

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A [PostgreSQL or MySQL Database Instance](/managed-databases-for-postgresql-and-mysql/how-to/create-a-database/)
- Installed and set up the [Scaleway Command Line Interface (CLI)](/scaleway-cli/quickstart/)
- A [`jq` library](https://jqlang.github.io/jq/) installed on your local machine

1. Retrieve a list of your Database Instances.
    ```
    scw rdb instance list
    ```
    You should get a response like the following:

    ```
    ID                                    NAME             NODE TYPE
    70ca91f9-d649-4485-9107-e73c1ecf1eab  rdb-calm-outland  db-play2-pico
    0317a95d-924e-40c0-b6a3-ed579ef3e157  rdb-calm-inland  db-play2-pico
    ```

    Make a record of the unique identifier (UUID) of the Database Instance you wish to migrate from, as well as the UUID of the target Database Instance you intend to migrate to.
2. Run the following command to retrieve the public endpoint of your Database Instance. Make sure you replace `$DB_INSTANCE_ID` with the UUID of the original Database Instance.
    <Message type="important">
      Before migrating the endpoint, keep in mind that:
      - If you want to migrate a `load_balancer` endpoint type the target Database Instance must not have a `load_balancer` endpoint
      - If you want to migrate a `private_network` endpoint type the target Database Instance must not have a `private_network` endpoint

      You can remove existing endpoints in the target Database Instance via the [Scaleway console](/managed-databases-for-postgresql-and-mysql/how-to/remove-public-endpoint/) or [the CLI](https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/rdb.md#delete-a-database-instance-endpoint).
    </Message>


    ```
    endpoint=$(scw rdb instance get $DB_INSTANCE_ID -o json | jq -r ".endpoints[] | select( .load_balancer != null ) | .id")
    ```

    <Message type="tip">
      To retrieve a Private Network endpoint, run:
      ```
      endpoint=$(scw rdb instance get $DB_INSTANCE_ID -o json | jq -r ".endpoints[] | select( .private_network != null ) | .id")
      ```
      Make sure you replace `$DB_INSTANCE_ID` with the UUID of the original Database Instance.
    </Message>

3. Run the following command to migrate the endpoint.
    ```
    scw rdb endpoint migrate endpoint-id=$endpoint instance-id=$NEW_INSTANCE_ID
    ```
    Replace `$NEW_INSTANCE_ID` with the UUID of the Database Instance you want to migrate the endpoint to.

    If the operation was successful, you should see an output like the following:

    ```
    ID    066b2260-affc-40f4-9794-ce8db20aad16
    IP    198.51.100.0
    Port  19377
    ```

    You see the UUID of the endpoint, and the IP and port that make up the endpoint.

You can change your endpoints back to the original Database Instance anytime using the same procedure.