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 description
Note: 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 instance
- Create target and source endpoints
- Refresh the source endpoint schemas
- Create a migration task
- Monitor your migration task
You 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.
Resolution
Note: 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 CloudWatch
Amazon CloudWatch logs can alert you to potential issues when migrating. For more information, see Monitoring replication tasks using Amazon CloudWatch.
Create a replication instance
- Open 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 endpoints
- Open 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 task
- Open 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 task
- Use 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 message
W - indicates warnings
E - indicates errors that occurred when migrating the database - Verify that the databases have been migrated successfully by connecting to the source and target instances through the terminal.
Migrating Oracle
When 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 Server
During 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 information
How AWS Database Migration Service works
Vídeos relacionados
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 10 meses
- AWS OFICIALAtualizada há 7 meses