I tried data migration using DMS

I tried data migration using DMS

2025.08.14

I plan to try using DMS with the following configuration to learn how it works.
Architecture diagram

  • Source database: 8.0.mysql_aurora.3.08.2
  • Target database: 8.0.mysql_aurora.3.08.2
  • What to migrate with DMS: test_db database created in the source database and the user table within test_db

The EC2 instance in the architecture diagram is for connecting to the source DB to create test databases and to connect to the target DB to verify that the migration has been completed properly.

Since the purpose this time is to understand what DMS is, I will try the simplest migration between the same engine versions.
Also, for the user table to be migrated, I will only insert data and not create any indexes.

Let's proceed with the verification.

Creating Security Groups

First, I'll create security groups.
Security groups need to be set up for a total of three: the source database, target database, and replication instance.

For source and target, I'll allow inbound rules from the DMS replication instance. I'll also allow inbound from EC2 as it's needed for verification.
For the replication instance, no configuration is needed.

  • source-db-sg
    Screenshot 2025-08-13 20.39.15

  • target-db-sg
    Screenshot 2025-08-13 20.42.05

  • dms-replication-instance-sg
    Screenshot 2025-08-13 20.45.35

Creating the Source Database

I'll create the source DB with the following parameters. I'll use the security group from the previous section.

Configuration item Value
Engine version Aurora MySQL3.08.2
DB cluster identifier source-db
Master username admin
Master password <any password>
Security group source-db-sg
DB cluster parameter group default.aurora-mysql8.0
DB parameter group default.aurora-mysql8.0
Subnet Placed in private subnet

Successfully created.
Screenshot 2025-08-13 20.48.27

Creating the Target Database

I'll create it with the identifier target-db. I'll use the security group mentioned earlier. Other settings are the same as the source DB.

Configuration item Value
DB cluster identifier target-db
Security group target-db-sg

Successfully created.
Screenshot 2025-08-13 21.12.38## Creating EC2 and Logging into the Source DB
Create an EC2 with the following configuration:

  • Amazon Linux 2023
  • Same VPC as the Aurora cluster
  • Public subnet

Login to the EC2 and install the mysql client by following this blog:
https://dev.classmethod.jp/articles/Install-mysql-on-al2023-and-login/

Connect to the source DB.

			
			mysql -u admin -p -h <source DB instance endpoint>

		

Create a test database test_db and table user. We will migrate this using DMS later.

			
			mysql> create database test_db;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test_db            |
+--------------------+
5 rows in set (0.01 sec)

mysql> create table test_db.user (id int, name varchar(10), address varchar(10));
Query OK, 0 rows affected (0.04 sec)

mysql> insert into test_db.user values (1, 'Yamada', 'Tokyo');
Query OK, 1 row affected (0.01 sec)

mysql> insert into test_db.user values (2, 'Satou', 'Chiba');
Query OK, 1 row affected (0.00 sec)

mysql> insert into test_db.user values (3, 'Kinjo', 'Okinawa');
Query OK, 1 row affected (0.01 sec)

mysql> select * from test_db.user;
+------+--------+---------+
| id   | name   | address |
+------+--------+---------+
|    1 | Yamada | Tokyo   |
|    2 | Satou  | Chiba   |
|    3 | Kinjo  | Okinawa |
+------+--------+---------+
3 rows in set (0.00 sec)

		

DMS Configuration

Creating a Subnet Group

Create a subnet group for the replication instance.
Screenshot 2025-08-10 16.22.00

Select the same VPC as the Aurora source database and target database.
Screenshot 2025-08-10 16.24.36
Screenshot 2025-08-10 16.24.52### Creating Endpoints
Select "Migrate or replicate" from the navigation pane on the left. This will display the DMS setup procedure.
Following the screen instructions, start with creating endpoints.
Screenshot 2025-08-10 16.36.30

Create the source endpoint as follows. Select the RDS instance of the source database.
For access information, set up the master username and master password used to connect to the source.
Screenshot 2025-08-10 16.49.39
Screenshot 2025-08-10 16.52.15
Screenshot 2025-08-10 16.52.51

Create the target endpoint using the same procedure.
Screenshot 2025-08-10 16.58.28
Screenshot 2025-08-10 16.58.48
Screenshot 2025-08-10 16.59.04

We have successfully created the source endpoint and target endpoint.
Screenshot 2025-08-10 17.01.44### Creating a Replication Instance
Now that we have created the endpoints, let's proceed to create a replication instance. From the "Migrate or replicate" screen, select "Create instance".
Screenshot 2025-08-13 21.29.34

Let's configure the replication instance.
Since this is for testing purposes, we'll set the high availability part to single AZ.
For the replication subnet group, select the group we created earlier.
Uncheck "Publicly accessible" as it's not needed.
For the security group, specify the previously created dms-replication-instance-sg.

Screenshot 2025-08-10 17.12.49
Screenshot 2025-08-10 17.15.10
Screenshot 2025-08-10 17.15.50
Screenshot 2025-08-10 17.17.12

We have successfully created the replication instance.
Screenshot 2025-08-11 16.31.17### Creating Tasks
Now that we have prepared the environment for data migration with DMS, we'll proceed to configure the specific task settings to determine which databases and tables to migrate.
Tasks define what will be executed on the DMS replication instance (such as which tables to migrate).

Select "Create task" from the following screen.
Screenshot 2025-08-11 16.32.36

In the task settings, specify the previously created source database endpoint and target database endpoint.
Since we're only migrating the test_db and the user table within test_db from the source database, we'll specify "Full load" as the task type.
Screenshot 2025-08-11 16.47.07
Screenshot 2025-08-11 16.47.46

Since the target database is empty, set the Target table preparation mode to "Drop tables on target".
Screenshot 2025-08-11 16.48.33
Screenshot 2025-08-11 16.49.07

In Table mappings, you can select the database schemas and tables to migrate.
Specify the test_db and user table that we previously created in the source database.

Screenshot 2025-08-11 17.58.17

The pre-migration assessment is a feature that checks for errors before executing the migration task and saves the results to S3. We'll leave this disabled for now as we're not doing a pre-migration assessment.
Once the configuration is complete, select "Create task".
Screenshot 2025-08-11 16.54.40

The task has been created successfully.
Screenshot 2025-08-11 17.06.46### Task Execution
Let's execute the task we created in the previous section and actually try the migration.
Select the created task and click "Start" from the actions.
Screenshot 2025-08-11 17.07.42

Once the task starts, the status will change to "Starting" as shown below.
Screenshot 2025-08-11 17.49.25

When completed, the status will change to complete.
Screenshot 2025-08-11 18.01.03

Now, let's log in to the target DB from the EC2 instance and verify that the migration was successful.

			
			mysql -u admin -p -h <target DB cluster endpoint>

		

From the results below, we can confirm that the test_db database and user table created in the source DB have been properly migrated!

			
			mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| awsdms_control     |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test_db            |
+--------------------+
6 rows in set (0.00 sec)

mysql> select * from test_db.user;
+------+--------+---------+
| id   | name   | address |
+------+--------+---------+
|    1 | Yamada | Tokyo   |
|    2 | Satou  | Chiba   |
|    3 | Kinjo  | Okinawa |
+------+--------+---------+
3 rows in set (0.00 sec)

		

Conclusion

This time I tried using DMS. I had been avoiding getting hands-on with DMS because it involves many components like endpoints and tasks, and you also need to prepare source and target databases, but when I actually tried it, it turned out to be relatively straightforward!

I did get stuck with errors due to not understanding how to configure security groups, but I think someone who works quickly could verify this content in about 1-2 hours. I hope this blog will be helpful for those who are trying DMS for the first time to get a general understanding of how DMS works.

References

https://repost.aws/ja/knowledge-center/dms-mysql-source-mysql-target
https://dev.classmethod.jp/articles/Install-mysql-on-al2023-and-login/
https://repost.aws/knowledge-center/dms-endpoint-connectivity-failures
https://docs.aws.amazon.com/ja_jp/dms/latest/userguide/dm-migrating-data-table-prep.html
https://blog.mmmcorp.co.jp/2023/12/01/dms-migration-rds-to-rds/

Share this article

FacebookHatena blogX

Related articles