Set up Spanner migration tool

This document describes how to install and run the Spanner migration tool (SMT) on Cloud Shell. For more information about SMT, see Spanner migration tool.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Make sure that billing is enabled for your Google Cloud project.

  6. Install the Google Cloud CLI.
  7. To initialize the Google Cloud CLI, run the gcloud init command.

Install Spanner migration tool

You can install SMT using a Linux shell command or Google Cloud CLI:

Linux shell

To install SMT, run the following command:

  sudo apt-get install google-cloud-sdk-spanner-migration-tool

gcloud

You can install SMT by using the gcloud components install command:

  gcloud components install spanner-migration-tool

For more information on installing SMT, see Installing Spanner migration tool.

Access Spanner migration tool

You can use the gcloud alpha spanner migrate command to access and use SMT.

To launch the SMT web UI, you can run the following command:

  gcloud alpha spanner migrate web

You need to provide your Google Cloud credentials to allow SMT to access resources. Click http://localhost:8080 on the response to the previous command to open the web UI.

Connect to Spanner

To connect to Spanner using the SMT web UI, do the following:

  1. Click the edit button to configure the connection to Spanner.

  2. Specify the following information to connect to Spanner:

    • Project ID: the project ID where your Spanner instance is.
    • Instance ID: the Spanner instance ID.
  3. Click Save.

Connect to your source database

You need to connect to the source database using the SMT web UI by providing the following information:

  • Database Engine: specify whether your source database is MySQL, SQL Server, Oracle, or PostgreSQL.
  • Hostname: the IP address of your source database.
  • Port: the port where your source database is accessible.
  • User name: the username of the source database.
  • Password: the password of the source database.
  • Spanner Dialect: specify whether you want to use GoogleSQL or PostgreSQL.

After entering the information you can connect to the source database by clicking Test Connection, and then clicking Connect.

What's next?