AWS Prescriptive Guidance
Patterns

Migrate an on-premises MySQL database to Amazon EC2

R Type :ReHost

source :Databases: Relational

target :MySQL on Amazon EC2

tags :mysql, amazon ec2

Summary

This pattern provides guidance for migrating an on-premises MySQL database to a MySQL database on an Amazon Elastic Compute Cloud (Amazon EC2) instance. The pattern discusses the use of AWS Database Migration Service (AWS DMS) or native MySQL tools for the migration. 

Assumptions and Prerequisites

Prerequisites

  • An active AWS account

  • A MySQL source database in an on-premises data center 

Product versions

  • MySQL versions 5.5, 5.6, and 5.7   

  • For a list of target operating systems supported by Amazon EC2, see Amazon EC2 FAQs

Architecture

Source  technology stack

  • An on-premises MySQL database

Target  technology stack

  • A MySQL database instance on Amazon EC2

AWS data migration methods

  • AWS DMS

  • Native MySQL tools (mysqldbcopy, mysqldump)

Target architecture

AWS data migration architecture

Using AWS DMS:

Using native MySQL tools:

Tools Used

AWS DMS - AWS Database Migration Service (AWS DMS) supports several source and target databases. For information about MySQL source and target databases supported by AWS DMS, see Migrating MySQL-Compatible Databases to AWS. If your source database isn't supported by AWS DMS, you must choose another method to migrate your data.

Epics

Plan the migration

Tasks

Title Description Skills Predecessor
Validate the source and target database versions. DBA
Identify the target operating system version. DBA, SysAdmin
Identify the hardware requirements for the target server instance based on the MySQL compatibility list and capacity requirements. DBA, SysAdmin
Identify storage requirements (storage type and capacity). DBA, SysAdmin
Identify network requirements such as latency and bandwidth. DBA, SysAdmin
Choose the proper instance type based on capacity, storage features, and network features. DBA, SysAdmin
Identify the network or host access security requirements for the source and target databases. DBA, SysAdmin
Identify a list of operating system users required for MySQL software installation. DBA, SysAdmin
Determine a backup strategy. DBA
Determine availability requirements. DBA
Identify the application migration or switchover strategy. DBA, SysAdmin

Configure the infrastructure

Tasks

Title Description Skills Predecessor
Create a virtual private cloud (VPC) and subnets. SysAdmin
Create security groups and network access control lists (ACLs). SysAdmin
Configure and start an EC2 instance. SysAdmin

Install MySQL software

Tasks

Title Description Skills Predecessor
Create the operating system users and groups required for the MySQL software to work. DBA, SysAdmin
Download the required version of the MySQL software. DBA, SysAdmin
Install the MySQL software on the EC2 instance and configure the server. DBA, SysAdmin

Migrate data - option 1

Tasks

Title Description Skills Predecessor
Use native MySQL tools or third-party tools to migrate database objects and data. These tools include mysqldbcopy and mysqldump. DBA

Migrate data - option 2

Tasks

Title Description Skills Predecessor
Migrate data with AWS DMS. DBA

Migrate the application

Tasks

Title Description Skills Predecessor
Follow the application migration strategy. DBA, SysAdmin, AppOwner

Cut over

Tasks

Title Description Skills Predecessor
Follow the application cutover or switchover strategy. DBA, SysAdmin, AppOwner

Close the project

Tasks

Title Description Skills Predecessor
Shut down the temporary AWS resources. Shut down the AWS DMS replication instance. DBA, SysAdmin
Review and validate the project documents. DBA, SysAdmin, AppOwner
Gather metrics around time to migrate, % of manual vs. tool, cost savings, etc. DBA, SysAdmin, AppOwner
Close out the project and provide feedback. DBA, SysAdmin, AppOwner

References and Help

References

Tutorials and videos

Contact and help

Pattern Library Support aws-mpl@amazon.com