Migrate from MySQL to Amazon RDS using AWS DMS

Migrate from MySQL to Amazon RDS using AWS DMS

13 January 2022


In this blog, you will learn how to migrate a self-managed MySQL database to a fully managed database on Amazon RDS (Relational Database Service).

Following are the steps to migrate a MySQL database into an Amazon RDS.

1. Create a database instance in Amazon RDS.

Following are the steps to create a MySQL database instance.

  • Step 1: Navigate to the Amazon RDS console. To create a new database click on the Create database button.
  • Step 2: Navigates to the database creation wizard. In the Engine Options section, select MySQL as the engine type. Select the MySQL version you want to use.
  • Step 3: In the Settings section, configure the setting of your Amazon RDS database.Note: Do not auto generate your password for this lab, and make sure you write down your password.
  • Step 4: In the Connectivity section, Specify the Amazon Virtual Private Cloud (Amazon VPC) in which your database resides, as well as the network subnet and security group for your database instance.Note: If you are migrating from a self-managed database instance to Amazon EC2, you can use the same Amazon VPC and security groups as your existing database.
  • Step 5: Choose the database authentication methods.
  • Step 6: Select Create database to create your database instance.

2. Create a replication instance in AWS DMS.

AWS DMS is a service that copies data from an existing database to a fully managed database on AWS. A replication instance is an Amazon EC2 instance that can host replication tasks within the AWS DMS.

Following are the steps to create a replication instance in AWS DMS:

  • Step 1: Navigate to the Replication Instances section of the AWS DMS console. Select Create replication instance to begin the replication instance creation wizard.
  • Step 2: In the Replication instance configuration section, configure the replication instances.
  • Step 3: In the Advanced Security and Network Configuration section. For the VPC security group(s) configuration, select the same security group that you added to your Amazon RDS database.
  • Step 4: Click Create to create your replication instance in AWS DMS.Note: You need to add a rule to your security group to allow your replication instance to access your database.

3. Create endpoints in AWS DMS.

Followings are the steps to create source and target endpoints for the AWS DMS.

  • Step 1: To create the endpoints, Navigate to the Endpoints section of the AWS DMS console. Select Create endpoint to create a new endpoint.
  • Step 2: In the Endpoint Creation Wizard, choose Target Endpoint. Select the check box to Select RDS DB instance, and choose your newly created Amazon RDS database in the dropdown.
  • Step 3: Fill the Endpoint Configuration details.
  • Step 4: Test the connection to make sure it was configured correctly. To test this, open the Test Endpoint Connection section. Select the replication instance you want to use, and then select Run test.
  • Step 5: To save your endpoint, select Create endpoint.

    • Follow these same steps again to create source endpoints for your source database.
    • You also need to make sure that your replication instance has network access to your source database. Allow traffic from your replication instance security group to the source database security group if the source database is hosted on the Amazon EC2. You need to handle the network settings for your source database if the database is not hosted on Amazon EC2.
    • You need to disable foreign key checking by entering initstmt=SET FOREIGN_KEY_CHECKS=0 in the Extra connection attributes box while loading the data into a MySQL database.

4. Create a replication task in AWS DMS.

The replication task is responsible for migrating data from a source database to a target database.

Following are the steps to create a replication task:

  • Step 1: Navigate to the Database migration tasks section of the AWS DMS console.Select Create Task to create a new replication task.
  • Step 2: In the Task Configuration section, configure the parameters for the replication task.
  • Step 3: In the Table mappings section, Enter the name of the schemas and tables you want to copy.
  • Step 4: When configurations are completed, choose Create task to start your replication task.

Blog Categories
Request a quote