1. Introduction
Hello! We are a writer team from Definer Inc.
In this issue, you are wondering how to migrate MySQL from Cloud SQL to RDS.
Let's take a look at the actual screens and resources to explain in detail.
In this issue, you are wondering how to migrate MySQL from Cloud SQL to RDS.
Let's take a look at the actual screens and resources to explain in detail.
2. Purpose/Use Cases
This article provides helpful information and practices when you want to migrate MySQL from Cloud SQL to RDS.
3. What is AWS Database Migration Service?
AWS Database Migration Service (DMS) is used for DB migration from Google Cloud to AWS.
AWS Database Migration Service (DMS) is a DB migration service provided by AWS for relational databases, NoSQL databases, and data warehouses.
The following three terms are important to remember when using the Database Migration Service.
・Endpoint
Endpoint is the definition of the connection information to the database.
There are two endpoints, one for the source DB and the other for the target DB.
・Replication Instance
This is the instance that connects the source and target DBs and executes the data replication task.
・Replication Task
This is the execution unit of data replication and where data migration is actually performed.
The following three patterns exist as data replication methods.
・Full load
The specified table data is migrated from the source DB to the target DB as it is.
・Full load + CDC (continuous replication)
Full load is executed while capturing changes in the source DB.
After the full load is completed, the captured changes are periodically reflected in the target DB.
・CDC (Continuous replication)
Without performing a full load, changes in the source DB are periodically read and the changed data is reflected in the target DB.
AWS Database Migration Service (DMS) is a DB migration service provided by AWS for relational databases, NoSQL databases, and data warehouses.
The following three terms are important to remember when using the Database Migration Service.
・Endpoint
Endpoint is the definition of the connection information to the database.
There are two endpoints, one for the source DB and the other for the target DB.
・Replication Instance
This is the instance that connects the source and target DBs and executes the data replication task.
・Replication Task
This is the execution unit of data replication and where data migration is actually performed.
The following three patterns exist as data replication methods.
・Full load
The specified table data is migrated from the source DB to the target DB as it is.
・Full load + CDC (continuous replication)
Full load is executed while capturing changes in the source DB.
After the full load is completed, the captured changes are periodically reflected in the target DB.
・CDC (Continuous replication)
Without performing a full load, changes in the source DB are periodically read and the changed data is reflected in the target DB.
4. RDS Setup
Let's start with data migration from Google Cloud to Amazon RDS using Database Migration Service (DMS).
As a precondition, we assume that the source (source) Cloud SQL exists.
(1) Creating a subnet group
Create a subnet group to create RDS.
(2) Create RDS for migration destination
Create MySQL DB by the following command.
As a precondition, we assume that the source (source) Cloud SQL exists.
(1) Creating a subnet group
Create a subnet group to create RDS.
(2) Create RDS for migration destination
Create MySQL DB by the following command.
## Creation of DB subnet group
aws rds create-db-subnet-group \
--db-subnet-group-name subg-test \
--db-subnet-group-description test \
--subnet-ids subnet-xxxxxxxx subnet-yyyyyyy
## Creating RDS
aws rds create-db-instance \
--db-instance-identifier mysql-test \
--db-instance-class db.t3.micro \
--engine mysql \
--engine-version 8.0.28 \
--allocated-storage 20 \
--master-username root \
--master-user-password password \
--backup-retention-period 3 \
--vpc-security-group-ids sg-xxxxxx \
--db-subnet-group-name subg-test
5. Data migration from Cloud SQL to RDS
Next, we will migrate the DB with DMS.
(1) Creating a replication instance of DMS
Go to the DMS console and click "Replication Instance" -> "Create Replication Instance".
Enter the name, instance class, and network information such as VPC and SecurityGroup.
For Public Access, check the box if you need to connect to the replication instance from the source/target DB via the Internet.
Wait a few minutes for the creation to complete.

(2) DMS endpoint creation
Two endpoints must be created, one for the source DB and one for the target DB.
In the DMS console, click "Endpoints" > "Create Endpoints."
For the source DB endpoint, enter the Cloud SQL connection information.
Since the target DB is RDS, check "Select RDS DB instance".

(3) Creating a DB Migration Task
In the DMS console, click "Database Migration Task" > "Create Task".
Specify the endpoints and replication instances created earlier.
For the data replication type, we selected "full load" this time.
When the status becomes "Load Complete", replication is complete.
Log in to the DB and check the table list to confirm that the DB migration has succeeded.
(1) Creating a replication instance of DMS
Go to the DMS console and click "Replication Instance" -> "Create Replication Instance".
Enter the name, instance class, and network information such as VPC and SecurityGroup.
For Public Access, check the box if you need to connect to the replication instance from the source/target DB via the Internet.
Wait a few minutes for the creation to complete.

(2) DMS endpoint creation
Two endpoints must be created, one for the source DB and one for the target DB.
In the DMS console, click "Endpoints" > "Create Endpoints."
For the source DB endpoint, enter the Cloud SQL connection information.
Since the target DB is RDS, check "Select RDS DB instance".

(3) Creating a DB Migration Task
In the DMS console, click "Database Migration Task" > "Create Task".
Specify the endpoints and replication instances created earlier.
For the data replication type, we selected "full load" this time.
When the status becomes "Load Complete", replication is complete.
Log in to the DB and check the table list to confirm that the DB migration has succeeded.
## Login to MySQL
mysql -u ${username} -p ${password} -h ${host name}
## After logging in to MySQL, browse table list
show tables;
6. Cited/Referenced Articles
What to consider when migrating MySQL from RDS to Cloud SQL ...
Amazon RDS (Managed Relational Database)| AWS
MySQL major version using Database Migration Service ...
What to consider when building replication from Aurora MySQL to Cloud SQL ...
Cloud SQL explained in depth! - G-gen Tech Blog
Trouble with Migration Tasks with AWS Database Migration Service ...
Amazon RDS (Managed Relational Database)| AWS
MySQL major version using Database Migration Service ...
What to consider when building replication from Aurora MySQL to Cloud SQL ...
Cloud SQL explained in depth! - G-gen Tech Blog
Trouble with Migration Tasks with AWS Database Migration Service ...
7. About the proprietary solution "PrismScaler"
・PrismScaler is a web service that enables the construction of multi-cloud infrastructures such as AWS, Azure, and GCP in just three steps, without requiring development and operation.
・PrismScaler is a web service that enables multi-cloud infrastructure construction such as AWS, Azure, GCP, etc. in just 3 steps without development and operation.
・The solution is designed for a wide range of usage scenarios such as cloud infrastructure construction/cloud migration, cloud maintenance and operation, and cost optimization, and can easily realize more than several hundred high-quality general-purpose cloud infrastructures by appropriately combining IaaS and PaaS.
・PrismScaler is a web service that enables multi-cloud infrastructure construction such as AWS, Azure, GCP, etc. in just 3 steps without development and operation.
・The solution is designed for a wide range of usage scenarios such as cloud infrastructure construction/cloud migration, cloud maintenance and operation, and cost optimization, and can easily realize more than several hundred high-quality general-purpose cloud infrastructures by appropriately combining IaaS and PaaS.
8. Contact us
This article provides useful introductory information free of charge. For consultation and inquiries, please contact "Definer Inc".
9. Regarding Definer
・Definer Inc. provides one-stop solutions from upstream to downstream of IT.
・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition/design development/implementation, and maintenance and operation.
・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition, design development, implementation, maintenance, and operation.
・PrismScaler is a high-quality, rapid, "auto-configuration," "auto-monitoring," "problem detection," and "configuration visualization" for multi-cloud/IT infrastructure such as AWS, Azure, and GCP.
・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition/design development/implementation, and maintenance and operation.
・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition, design development, implementation, maintenance, and operation.
・PrismScaler is a high-quality, rapid, "auto-configuration," "auto-monitoring," "problem detection," and "configuration visualization" for multi-cloud/IT infrastructure such as AWS, Azure, and GCP.