
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create Connection profile for the mysql source instance
/ 20
Create, run and review the status of a continious job migration
/ 20
Confirm the data in Cloud SQL for MySQL
/ 20
Test the continuous migration of data from the source to the destination instance.
/ 20
Promote Cloud SQL to be the primary instance
/ 20
Database Migration Service provides options for one-time and continuous jobs to migrate data to Cloud SQL using different connectivity options, including IP allowlists, VPC peering, and reverse SSH tunnels (see documentation on connectivity options in the Configure connectivity Guide).
In this lab, you migrate an on-premises MySQL database (running on a virtual machine) to Cloud SQL for MySQL using a continuous Database Migration Service job and VPC peering for connectivity.
After you create and run the migration job, you confirm that an initial copy of your database has been successfully migrated to your Cloud SQL for MySQL instance. You also explore how continuous migration jobs apply data updates from your source database to your Cloud SQL instance. To conclude the migration job, you promote the Cloud SQL instance to be a standalone database for reading and writing data.
In this lab, you learn how to configure a continuous Database Migration Service job to migrate databases from a MySQL instance to Cloud SQL for MySQL.
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
This page will either show status information or give you the option to enable the API.
This page will either show status information or give you the option to enable the API.
In this task, you identify the internal IP address of the source database instance that you will migrate to Cloud SQL.
In the Google Cloud Console, on the Navigation menu (), click Compute Engine > VM instances.
Locate the line with the instance called dms-mysql-training-vm-v2.
Copy the value for Internal IP (e.g., 10.128.0.2).
A connection profile stores information about the source database instance (e.g., on-premises MySQL) and is used by Database Migration Service to migrate data from the source to your destination Cloud SQL database instance. After you create a connection profile, it can be reused across migration jobs.
In the Google Cloud Console, on the Navigation menu (), click Database Migration > Connection profiles.
Click Create Profile.
On the Create a connection profile page, from the Profile role list, select Source.
For Database engine, select MySQL.
Enter the required information for a connection profile:
Property | Value |
---|---|
Connection profile name | mysql-vm |
Connection profile ID | keep the auto-generated value |
Hostname or IP address | enter the internal IP for the MySQL source instance that you copied in the previous task (e.g., 10.128.0.2) |
Port | 3306 |
Username | admin |
Password | changeme |
For Connection profile region, select
For the Encryption Type, select None.
Click Create.
A new connection profile named mysql-vm will appear in the Connections profile list.
Click Check my progress to verify the objective.
When you create a new migration job, you first define the source database instance using a previously created connection profile. Then you create a new destination database instance and configure connectivity between the source and destination instances.
In this task, you use the migration job interface to create a new Cloud SQL for MySQL database instance and set it as the destination for the continuous migration job from the MySQL source instance.
In the Google Cloud Console, on the Navigation menu (), click Database Migration > Migration jobs.
Click Create Migration Job.
For Create a migration job, on the Get Started tab, use the following values:
Property | Value |
---|---|
Migration job name | vm-to-cloudsql |
Migration job ID | keep the auto-generated value |
Source database engine | MySQL |
Destination region | |
Migration job type | Continuous |
Leave all other settings as default.
For Select source connection profile, select mysql-vm.
Leave the defaults for the other settings.
Click Save & Continue.
Property | Value |
---|---|
Type of destination instance | New instance |
Destination Instance ID | mysql-cloudsql |
Root password | supersecret! |
For Choose a Cloud SQL edition, select Enterprise.
For Database version, select Cloud SQL for MySQL 5.7
For Zonal availability, select Single zone. Then, click on Show Zones dropdown, and select the zone
In Connections, select Private IP and Public IP.
Select Use an automatically allocated IP range.
Click Allocate & Connect.
When this step is complete, an updated message notifies you that the instance will use the existing managed service connection.
Property | Value |
---|---|
Machine shapes | 1 vCPU, 3.75 GB |
Storage type | SSD |
Storage capacity | 10 GB |
If prompted to confirm, click Create Destination & Continue.
A message will state that your destination database instance is being created. Continue to step 1 while you wait.
For Connectivity method, select VPC peering.
For VPC, select default.
VPC peering is configured by Database Migration Service using the information provided for the VPC network (the default network in this example).
When you see an updated message that the destination instance was created, proceed to the next step.
Review the details of the migration job.
Click Test Job.
After a successful test, click Create & Start Job.
If prompted to confirm, click Create & Start.
In the Google Cloud Console, on the Navigation menu (), click Database Migration > Migration jobs.
Click the migration job vm-to-cloudsql to see the details page.
Review the migration job status.
When the job status changes to Running, proceed to the next task.
Click Check my progress to verify the objective.
In the Google Cloud Console, on the Navigation menu (), click Databases > SQL.
Click on the instance ID called mysql-cloudsql (MySQL read replica).
In the Replica Instance menu, click Databases.
Notice that the databases called customers_data and sales_data have been migrated to Cloud SQL.
In the Replica Instance menu, click Overview.
Click Open Cloud Shell.
The command to connect to MySQL will pre-populate in Cloud Shell:
If prompted, click Authorize for the API.
You have now activated the MySQL interactive console for the destination instance.
There are 5,030 records in the customers table that were migrated from the MySQL source instance.
Note that the last name of the first record in the customers table is Accumsan.
In the next task, you will add new records to the customers table in the source database instance. The continuous migration job will migrate the new records from the source instance to the destination instance.
Click Check my progress to verify the objective.
In the Google Cloud Console, on the Navigation menu (), click Compute Engine > VM instances.
Locate the line with the instance called dms-mysql-training-vm-v2.
For Connect, click SSH to open a terminal window.
To connect to the MySQL interactive console within the terminal window, run the following command:
There are now 5,032 records in the customers table in the MySQL source instance.
Note that the last name of the first record in the customers table has changed to Ablorem.
In the Google Cloud Console, on the Navigation menu (), click Databases > SQL.
Click on the instance ID called mysql-cloudsql (MySQL read replica).
In the Replica Instance menu, click Overview.
Click Open Cloud Shell.
The command to connect to MySQL will pre-populate in Cloud Shell:
If prompted, click Authorize for the API.
You have now activated the MySQL interactive console for the destination instance.
Notice that the two records added to the MySQL source instance have been migrated. There are now 5,032 records in the customers table in the Cloud SQL destination instance.
Notice that the last name of the first record in the customers table is now the same across the Cloud SQL destination instance and the MySQL source instance.
Click Check my progress to verify the objective.
In the Google Cloud Console, on the Navigation menu (), click Database Migration > Migration jobs.
Click the migration job name vm-to-cloudsql to see the details page.
Click Promote.
If prompted to confirm, click Promote.
When the promotion is complete, the status of the job will update to completed.
Note that mysql-cloudsql is now a standalone instance for reading and writing data.
Click Check my progress to verify the objective.
You migrated an on-premises MySQL database (running on a virtual machine) to Cloud SQL for MySQL using a continuous Database Migration Service job and VPC peering for connectivity.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated March 10, 2025
Lab Last Tested March 10, 2025
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one