Skip to main content

Using the AWS DMS to Migrate Data to an Aurora Database

Hands-On Lab

 

Photo of Julie  Elkins

Julie Elkins

AWS Training Architect I in Content

Length

01:00:00

Difficulty

Beginner

One of the most important aspects of any migration of data to the cloud is cost optimization. Luckily, AWS has made this relatively simple thanks to the Database Migration Service. In this hands-on lab, we are going to use the Database Migrations Service (DMS) to migrate a MySQL database from an EC2 server to an RDS Aurora MySQL database.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Using the AWS DMS to Migrate Data to an Aurora Database

Introduction

One of the most important aspects of any migration of data to the cloud is cost optimization. Luckily, AWS has made this relatively simple thanks to the Database Migration Service. In this hands-on lab, we are going to use the Database Migrations Service (DMS) to migrate a MySQL database from an EC2 server to an RDS Aurora MySQL database.

The Scenario

As the Senior Solutions Architect, you have have been tasked with optimizing the data transfer to more cost-effective solutions. You have identified the cost savings of moving a MySQL database currently running on an EC2 instance to an RDS Aurora MySQL instance, and have decided to use the AWS Data Migration Service. Let's get started!

Logging In

Ensure you are in us-east-1 and log in to the AWS console using the credentials provided.

Note: The lab uses an RDS MySQL instance target to stand in for an Aurora DB to speed the lab's setup for you. The migration process is the same.

Create Replication Instance

Navigate to DMS in the AWS console, and click Create replication instance. On the next screen, enter these values:

  • Name: aurorareplication
  • Description: mysql to aurora
  • Leave Instance class and Engine version alone
  • Allocated storage (GB): 10
  • VPC: Choose the one with Lab_VPC in the title from the dropdown
  • Uncheck the Publicly accessible box

Click Advanced security and network configuration, and set the VPC security group(s) to our DatabaseSecurityGroup. The actual name of our security group will be the phrase DatabaseSecurityGroup sandwiched between some other random looking text.

Click Create, and wait a few minutes for it to spin up.

Create Endpoints

Once it's ready, select Endpoints in the left-hand menu. We're going to make two.

Create a Target Endpoint

Click Create endpoint, then select Target endpoint as a type. Check the RDS Instance box, and select new-db from the dropdown below it. Leave the next few things at their defaults, but for the Password box, copy the cloud_user password from the hands-on lab overview page and paste it in here.

Scroll down farther and open up the Test endpoint connection section. Click the Run test button and make sure we get a successful message in the Status column of the table below that. Now we can click Create endpoint and move on.

Create a Source Endpoint

Click Create endpoint, then select Source endpoint as a type. Leave the RDS Instance box unchecked, and enter my-db-source in the Endpoint identifier box. From the Source engine dropdown, choose mysql. In the Server name box, we need the private IP of our instance, so copy it from the hands-on lab overview page and paste it here.

Set the Port to 3306, User name to cloud_user, and use the password on the hands-on lab overview page in the Password field here.

We're going to leave the rest set to the defaults, but scroll down farther and open up the Test endpoint connection section. Click the Run test button and make sure we get a successful message in the Status column of the table below that. Once we've got it, we can click Create endpoint.

Create the Migration Task

Back in the main DMS screen, click in the left-hand menu on Conversion & migration, then select Database migration tasks.

On the next screen, click Create task. Set the series of dropdowns like this:

  • Task identifier: aurorareplicationtask
  • Replication instance: Select the one we just created here
  • Source database endpoint: my-db-source
  • Target database endpoint: new-db
  • Migration type: Migrate existing data

Make sure Start task on create is checked.

Down in the Task settings section, change Include LOB columns in replication to Don't include LOB columns. Leave everything else.

There's a Table mappings section below this, and within it a Selection rules area. Click Add new selection rule. Fill the resulting web form out like this:

  • Schema: Enter a schema
  • Schema name: classicmodels
  • Table name: %
  • Action: Include

That's it for creating a task. Click the Create task button.

Once AWS finishes creating the task, our data will start migrating.

Conclusion

That's all there is to it. We can keep hitting the refresh button on the screen we get to, and the migration should finish in short order. Congratulations!