Question: How do I migrate to an Amazon RDS or Amazon Aurora DB instance using AWS DMS?

I want to migrate my database to Amazon Relational Database Service (Amazon RDS) or Amazon Aurora. How can I do this with minimal downtime?Short descriptionNote: If you're performing a homogeneous migration, use your engine’s native tools (like MySQL dump or MySQL replication) whenever possible.To migrate to an Amazon RDS DB instance using AWS DMS:Create a replication instanceCreate target and source endpointsRefresh the source endpoint schemasCreate a migration taskMonitor your migration taskYou can use these steps for all Amazon RDS and Amazon Aurora engine types, including Amazon RDS for Oracle and Amazon Aurora for MySQL DB instances.

ResolutionNote: AWS DMS creates a table with a primary key on the target only when necessary before migrating table data. To generate a complete target schema, use the AWS Schema Conversion Tool (AWS SCT). For more information, see Converting schema.(Optional) Turn on logging with Amazon CloudWatchAmazon CloudWatch logs can alert you to potential issues when migrating. For more information, see Monitoring replication tasks using Amazon CloudWatch.Create a replication instanceOpen the AWS DMS console, and choose Replication Instances from the navigation pane.Choose Create replication instance.Enter your replication instance name, description, instance class, Amazon Virtual Private Cloud (Amazon VPC), and Multi-AZ preference.Note: -Choose an instance class that's sufficient for your migration workload. If the instance isn't sufficient for your workload, you can modify the replication instance later.From the Advanced section, choose your VPC security groups, or choose the default option.Choose Create replication instance.Create target and source endpointsOpen the AWS DMS console, and choose Endpoints from the navigation pane.Choose Create endpoint to create the source and target database.For Endpoint type, choose Source.Enter the endpoint's engine-specific information.Choose Run Test.After the test is complete, choose Save.Repeat steps 3-6, but for Endpoint type, choose Target.Note: Complete this step for both the target and the source.Refresh the source endpoint schemas<b></b>Open the AWS DMS console, and choose Endpoints from the navigation pane.Select the source endpoint, and choose Refresh schemas.Choose Refresh schemas.Note: You must refresh the source so that the source schemas appear in the table mappings when you create an AWS DMS task.Create a migration taskOpen the AWS DMS console, and choose Database migration tasks from the navigation pane.Choose Create task.Specify the Task identifier, Replication instance, Source database endpoint, Target database endpoint, and Migration type. Choose one of 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 already have migrated the existing data and want to synchronize the source database with the target MySQL database hosted on the AWS Cloud.From the Task Settings section, modify the task as needed.From the Table mappings section, choose Guided UI.Choose Add new selection rule, and specify your Schema and Table name.Note: You can change or transform the source schema, table, or column name of some or all of the selected objects. To do this, expand the Transformation rules section. Choose Add new transformation rule. Then select the Target, Schema name, and Action.Choose Create task.Note: If you have large object (LOBs) columns, then use Limited LOB Mode. For more information, see Setting LOB support for source databases in an AWS DMS task.Monitor your migration taskUse the Task Monitoring view to monitor the migration tasks. You can see which tables have been migrated successfully and which tables are in the process of migration. Pay attention to the following message types:I - indicates an informational messageW - indicates warningsE - indicates errors that occurred when migrating the databaseVerify that the databases have been migrated successfully by connecting to the source and target instances through the terminal.Migrating OracleWhen you use Oracle as the source database, then AWS DMS migrates table to the specified target endpoint user. You can change the schema for an Oracle target by using transformation rules. For more information, see Changing the user and schema for an Oracle target.Migrating to MySQL/PostgreSQL/SQL ServerDuring migration, schemas and tables are migrated to the same name on the target. If you want to migrate tables to a different schema/table on the target, then create a mapping rule to specify the new schema/table 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"    }  ]}Check the logs to confirm that there are no errors.Monitor latency and compare data counts on the source and the target databases before switching to the new target database. For more information, see Troubleshooting migration tasks in AWS Database Migration Service.

Related informationHow AWS Database Migration Service worksDatabase Migration step-by-step walkthroughsSources for data migrationTargets for data migration