This quickstart shows you how to use Database Migration Service to migrate data to Cloud SQL for MySQL. The resources created in this quickstart typically cost less than one dollar (USD), assuming you complete the steps, including the clean up, in a timely manner.
Before you begin
Sign in to your Google Cloud account. If you're new to
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.
Database Migration Service offers a variety of source database options and
connectivity methods. Different sources work better with some connectivity
methods than with others. In this quickstart, we assume that you're using a
standalone MySQL database in an environment where you can configure your network
to add an inbound firewall rule. The source database can be on-premises or in a
cloud provider. Because we can't know the specifics of your environment, we
can't provide detailed steps when it comes to your networking configuration.
In this quickstart, you'll select MySQL for the Source database engine and IP
allowlist as the networking method.
Create a connection profile
By creating a connection profile, you're creating a record that contains information
about the source database. Database Migration Service uses the information in the
connection profile to migrate data from your source database to the destination
Cloud SQL database instance.
Go to the Database Migration Service Connection profiles page in
the Google Cloud console.
Open the Source database engine drop-down list and select the classification type of your source database.
The options are:
A standalone MySQL instance (MySQL)
An existing Cloud SQL for MySQL instance (Cloud SQL for MySQL)
An AWS RDS instance for MySQL (Amazon RDS for MySQL)
For this quickstart, select MySQL.
Supply the following information:
In the Connection profile name field, enter a name for the connection profile for your source database, such as My Connection Profile.
Keep the auto-generated Connection profile ID.
Enter Connectivity information:
If you're replicating from a self-hosted database, then enter the Hostname or IP address (domain or IP) and Port to access the host. (The default MySQL port is 3306.)
If you're replicating from a Cloud SQL database, then select the
Cloud SQL instance from the drop-down list.
Enter a Username and Password to authenticate to your source instance.
(Optional) If you plan to transfer sensitive information over a
public network (by using IP allowlists), then we recommend using
SSL/TLS encryption for the connection between the source and destination databases. Otherwise, keep the default value of None.
In the Connection profile region section of the page, select the region where you want to save the connection profile.
Create a migration job
Database Migration Service uses migration jobs to migrate data from your source database instance to the destination Cloud SQL database instance.
Creating a migration job includes:
Defining settings for the job
Selecting the connection profile that you created for your source database (source connection profile)
Defining settings for the destination Cloud SQL database instance
Setting up connectivity between the source and destination database instances
Testing the migration job to ensure that the connection information you provided for the job is valid
Define settings for the migration job
Go to the Database Migration Service Migration jobs page in
the Google Cloud console.
In the Migration job name field, enter a name for the migration job, such as My Migration Job.
Keep the auto-generated Migration job ID.
Open the Source database engine drop-down list and select the classification type of your source
database. Database Migration Service selects the Destination database engine automatically.
Select the Destination region where the destination instance is to be created.
Set the Migration job type to "Continuous" because you want ongoing changes in your source database to be migrated to the destination Cloud SQL database instance.
Review the required prerequisites that are generated automatically to reflect how the environment must be prepared for a migration job. These prerequisites can include how to configure the source database and how to connect it to the destination Cloud SQL database instance. It's best to complete these prerequisites at this step, but you can complete them at any time before you test the migration job or start it. For more information about these prerequisites, see Configure your source.
Click SAVE & CONTINUE.
Specify information about the source connection profile
Open the Select source connection profile drop-down list and select the connection profile that you created.
Click SAVE & CONTINUE.
Define settings for the destination Cloud SQL instance
Provide a Destination Instance ID for the Cloud SQL instance. By default, the
migration job ID is pre-populated in this field. You can keep this name or enter another
Provide an alphanumeric password for the destination Cloud SQL instance. This will be the password for the root administrator account in the instance.
You can either enter the password manually or click GENERATE to have Database Migration Service create one for you automatically.
Choose the Database version for the destination instance from the list
of supported Cloud SQL versions for the specified database engine.
Select the desired Google Cloud Zone for the new
Cloud SQL instance (or leave as "Any").
Select the Public IP check box because, for this quickstart, you're using IP allowlist as the networking method. This method works by configuring the source database server to accept connections from the outgoing IP address of the Cloud SQL instance.
Select the Machine type for the Cloud SQL instance. The disk size
must be equal to or greater than the source database size.
Define the Storage type and Storage capacity for the Cloud SQL
Click CREATE & CONTINUE to create the new instance.
Click CREATE DESTINATION & CONTINUE in the subsequent dialog box.
Creating the instance may take several minutes to complete.
Set up connectivity
Choose the networking method that you'd like to use to establish connectivity
between the source and destination databases. For this quickstart, use the Connectivity method drop-down list
to select IP allowlist as the networking method.
If the source IP address isn't pre-populated in this field, then copy the Cloud SQL
instance's outgoing IP address from the console, and use
it to configure the network firewall for the source database server to
accept connections from this IP address.
In your firewall rules, create an Inbound (or Ingress) rule to allow
connections on port 3306 from the destination Cloud SQL instance's
connectivity IP address.
Click CONFIGURE & CONTINUE to complete the connection profile configuration.
Test and create the migration job
Review the settings you chose for the migration job.
Click TEST JOB to verify that the source has been configured
correctly, that the source and destination instances are able to communicate
with each other, and that the migration job is valid.
Verify that you see the "Tests passed successfully!" status.
If the test fails, then you can address the problem in the appropriate part of
the flow, and return to re-test.
Click CREATE & START JOB to create the migration job and start it
Click START in the subsequent dialog box.
In the Migration jobs page, verify that your migration job has a status of "Starting". After a few minutes, confirm that the status changes to "Running".
Verify the migration job
In this section, you confirm that Database Migration Service used the migration job to migrate data from your source database instance to the destination Cloud SQL database instance.