Migrating a Database Using DMS

Hands-On Lab

 

Photo of Derek Morgan

Derek Morgan

Training Architect

Length

00:30:00

Difficulty

Beginner

One of the most important, but volatile, aspects of any migration of data to the cloud is the database migration. Luckily, AWS has made this relatively simple thanks to the Database Migration Service. In this hands-on lab, we are going to use this service to migrate a database from an EC2 server to RDS in order to gain the full benefit of AWS's hosted architecture.

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.

Migrating a Database Using DMS

Introduction

In this hands-on lab, we are going to use the Database Migration Service (DMS) to migrate a database from an EC2 server to RDS in order to gain the full benefit of AWS's hosted architecture.

Solution

Log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.

Create a Replication Instance

  1. Navigate to DMS.
  2. In the left-hand menu, select Replication instances.
  3. Click Create replication instance.
  4. In the first section, set the following values:
    • Name: myreplicationinstance
    • Description: migrate from ec2 to rds
    • Instance class: dms.t2.micro
    • Engine version: 2.4.3
    • VPC: Lab_VPC
    • Multi-AZ: No
    • Publicly accessible: Uncheck
  5. In the Advanced section, set the following values:
    • Allocated storage (GB): 10
    • Replication Subnet Group: Select the one listed
    • Availability zone: No preference
    • VPC Security Group(s): DatabaseSecurityGroup
    • KMS master key: Default
  6. Leave the Maintenance section settings as-is.
  7. Click Create replication instance. It will take a few minutes to finish creating and become available.

Create a DMS Target Endpoint

  1. In the left-hand menu, select Endpoints.
  2. Click Create endpoint.
  3. In the first section, set the following values:
    • Endpoint type: Target
    • Select RDS DB instance: Check
    • RDS instance: Select the one listed
    • Endpoint identifier: Leave as-is
    • Target engine: mysql
    • Server name: Leave as-is
    • Port: 3306
    • SSL mode: none
    • User name: cloud_user
    • Password: Password provided on lab page
  4. In the Test endpoint connection section, set the following values:
    • VPC: Lab_VPC
    • Replication instance: Select the one listed
  5. Click Run test.
  6. Once it's done, click Save.

Create a DMS Source Endpoint

  1. On the endpoints dashboard, click Create endpoint.
  2. In the first section, set the following values:
    • Endpoint type: Source
    • Select RDS DB instance: Uncheck
    • Endpoint identifier: my-db-source
    • Source engine: mysql
    • Server name: Enter the private IP address on the lab page
    • Port: 3306
    • SSL mode: none
    • User name: cloud_user
    • Password: Password provided on lab page
  3. In the Test endpoint connection section, set the following values:
    • VPC: Lab_VPC
    • Replication instance: Select the one listed
  4. Click Run test.
  5. Once it's done, click Save.

Create a DMS Task

  1. In the left-hand menu, select Tasks.
  2. Click Create task.
  3. In the first section, set the following values:
    • Task name: my-migration-task
    • Replication instance: Leave as-is
    • Source endpoint: Leave as-is
    • Target endpoint: Leave as-is
    • Migration type: Migrate existing data
    • Start task on create: Check
  4. In the Task Settings section, set the following values:
    • Target table preparation mode: Drop tables on target
    • Include LOB columns in replication: Don't include LOB columns
    • Enable validation: Uncheck
    • Enable logging: Uncheck
  5. In the Table mappings section, go to the Guided tab.
  6. Set the following values:
    • Schema name is: classicmodels
    • Table name is like: %
    • Action: Include
  7. Click Add selection rule.
  8. Click Create task.

Conclusion

Congratulations on completing this hands-on lab!