I want to migrate my database, but I need a migration strategy that has a simplified approach with minimal downtime. How do I migrate to Amazon RDS for MySQL using AWS Database Migration Service?

AWS DMS helps you migrate large, terabyte-scale databases to the AWS Cloud easily and securely. During migration, the source database remains fully operational, minimizing downtime.

Note: If you're performing a homogeneous migration, use your engine’s native tools, such as MySQL dump or MySQL replication.

To migrate to RDS for MySQL by using DMS, create a replication instance, endpoints, and tasks for your databases, and confirm your migration. Note that DMS only creates a table with a primary key on the target if necessary, then migrates table data; it doesn't create any other objects that are not required to efficiently migrate the data from the source. If you need to generate a complete target schema, you can use the AWS Schema Conversion Tool. For more information, see Schema Conversion.

Create a replication instance

  1. Open the Amazon DMS console, and choose Replication Instances in the navigation pane.
  2. Choose Create replication instance and enter your replication instance name, description, instance class, VPC, and Multi-AZ preference.
  3. Under the Advanced section, choose your VPC security groups, or choose the default option.
  4. Choose Create replication instance.

Note: There are several instance classes that you can choose from when migrating the database using DMS. The replication instance serves as middleware between the source and the target database, so be sure that the instance class selected is sufficient for the migration workload. You can also modify the instance class if it is not sufficient for your workload.

Create target and source endpoints

  1. From the left navigation pane, choose Endpoints.
  2. Choose Create endpoint to create the source and target database.
  3. Choose the Endpoint type, and enter the endpoint identifier, source engine, server name, port, SSL mode, and user name and password.
  4. Choose Run Test, and Save after the test is complete.
    Note: Be sure to complete this step for both the target and the source.

Create a migration task

  1. From the left navigation pane, choose Tasks, and then choose Create Task.
  2. Specify the task name, replication instance, source endpoint, target endpoint, and migration type. You can choose from the following migration types:
    Migrate existing data only—Use this migration type for one-time migrations.
    Migrate existing data and replicate ongoing changes—Use this migration type to migrate large databases to the AWS Cloud with minimal downtime.
    Migrate ongoing replication changes—Use this migration type when you have already migrated the existing data and want to synchronize the source database with target MySQL database hosted in the AWS Cloud.
  3. Under the Task Settings, modify the task as needed.
  4. Specify your schema name and table name, and choose Add selection rule.
    Note: If you want to change or transform the schema, table, or column name of some or all of the selected objects, choose Add transformation rule.
  5. Choose Create task.

Note: If you have LOB columns, Limited LOB Mode is recommended. It's also a best practice to choose Enable Logging, so CloudWatch Logs can alert you to potential issues. For more information about the various CloudWatch metrics you can use, see Monitoring Amazon RDS.

Confirm that the migration was successful

  1. Under the Task Monitoring tab, you can monitor the tasks using logs for any errors or warnings. You can also view which tables have been migrated successfully and which tables are in the process of migration. You might see the following message types:
    I indicates an informational message
    W indicates warnings
    E indicates errors that occurred when migrating the database
  2. Verify that the databases have been migrated successfully by connecting to the source and target instances through the terminal.

Migrating Oracle

When using Oracle as the source database, the tables are migrated to the specified target endpoint user. You can change the schema for an Oracle target by using transformation rules specified in Changing the User/Schema for an Oracle Target.

Migrating MySQL

When migrating from MySQL to Amazon Aurora, use engine native tools when possible. During migration, schemas and tables are migrated to the same name on the target. If you want to migrate tables to a different schema on target, create a mapping rule to specify the new schema on the target database:  

{
  "rules": [{
      "rule-type": "selection",
      "rule-id": "1",
      "rule-name": "1",
      "object-locator": {
        "schema-name": "test",
        "table-name": "%"
      },
      "rule-action": "include"
    }, {
      "rule-type": "transformation",
      "rule-id": "2",
      "rule-name": "2",
      "rule-action": "rename",
      "rule-target": "schema",
      "object-locator": {
        "schema-name": "test"
      },
      "value": "newtest"
    }
  ]
}

You should now be able to see that the status of the task is complete; you can check the logs to make sure there are no errors. It's a best practice to monitor latency and compare the data counts on the source and the target before switching to the new target database. For more information, see Troubleshooting Migration Tasks.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2017-07-03