NavigationContentFooter
Suggest an edit

Migrating Database Instance endpoints via the Scaleway CLI

Reviewed on 27 May 2024Published on 22 November 2023

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 via the Upgrade only option. In this case, you must manually migrate your endpoint.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • A PostgreSQL or MySQL Database Instance
  • Installed and set up the Scaleway Command Line Interface (CLI)
  • A jq library 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.

    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 or the CLI.

    endpoint=$(scw rdb instance get $DB_INSTANCE_ID -o json | jq -r ".endpoints[] | select( .load_balancer != null ) | .id")
    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.

  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.

API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway