AWS, Cloud Computing

4 Mins Read

A Guide to Migrate Amazon EC2 Databases to Amazon RDS via AWS Database Migration Service (DMS)

Voiced by Amazon Polly

Overview

In the ever-evolving world of cloud computing, businesses continuously seek ways to optimize their infrastructure and leverage managed services. Amazon Web Services (AWS) offers a wide range of cloud solutions, including Elastic Compute Cloud (EC2) and Relational Database Service (RDS). Amazon EC2 provides virtual servers in the cloud, while RDS offers managed database services. As businesses grow and their database needs to change, migrating from Amazon EC2 to Amazon RDS becomes a common requirement. This blog will explore how to accomplish this migration using AWS Database Migration Service (DMS).

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Introduction

AWS Database Migration Service (DMS) is a robust and fully managed service that enables seamless and secure database migrations between different database engines. It supports both homogeneous and heterogeneous migrations.

AWS DMS offers various features to simplify database migration, such as ongoing replication with minimal downtime, automatic schema conversion, and data validation to ensure data integrity.

Why Amazon RDS and not Amazon EC2?

Migrating a database from Amazon EC2 to Amazon RDS offers several advantages that cater to the growing needs of a business:

  • Scalability and Performance – Amazon RDS allows easy scaling of database resources, ensuring that applications perform optimally even during high traffic periods. Amazon EC2 may require manual adjustments to handle increased workloads.
  • High Availability and Redundancy – Amazon RDS provides automated backups and the ability to create read replicas, ensuring data redundancy and high availability. Amazon EC2-based databases may lack such built-in redundancy.
  • Managed Services and Automated Backups – With Amazon RDS, AWS handles mundane database management tasks like backups, patches, and maintenance, freeing valuable resources for other business-critical activities.

Pre-requisites

  • AWS Account with appropriate permission
  • Amazon EC2 instance with MySQL setup on it
  • Amazon RDS setup with MySQL

Steps to Migrate the Database

Step 1: Setting up the AWS DMS replication instance

Go to the AWS DMS console and click on Create Replication instance

Give the appropriate name to your Replication instance, select the instance class engine version, and choose the workload type according to your requirements.

step1

Add storage amount and select the appropriate Amazon VPC. Other options can be left as default and click on create replication instance.

step1b

The creation of a replication instance will take around 5 to 10 minutes.

Step 2: Creating Source endpoint

Go to endpoints and click on Create Endpoint.

step2

Select the source endpoint for setting up the endpoint for our Amazon EC2 database, enter the endpoint identifier, and choose the database engine.

step2b

Give your ec2 server name and port, enter the details of the source database, and click on Create endpoint.

step2c

Step 3: Creating Target endpoint

Click on Create endpoint.

Choose the target endpoint checkmark and the Select Amazon RDS DB instance option. This will list down all the Amazon RDS DB available in the account, then choose the appropriate Amazon RDS DB you want to use.

step3

Most of the details will be auto-filled. Mention the password for the Amazon RDS db user and click on Create endpoint.

step3b

Note: Your security group should allow appropriate traffic on port 3306 so that DMS can connect with the respective databases.

Once the endpoints are created, you can test their connection to go inside your endpoint. Click on connections and select test connection.

step3c

You will see successful status if the configuration and security groups are configured properly.

Step 4: Creating Amazon DMS migration task

Go to Database migration task and click on Create task

step4

Give a name to the task and select the replication instance created earlier. In source and target endpoints, select the endpoints created earlier and choose the appropriate option according to your use case in migration type.

step4b

Create a mapping rule and select all the databases, or if you want to include or exclude a schema. You can also mention that in the mapping rule and click Create Task.

step4c

Note: Before creating or starting the migration task, creating a backup of your existing infrastructure is always recommended.

Post Migration Steps

  • Once the status of the migration task is successful, verify the data in Amazon RDS DB.
  • Once data integrity is verified, you need to update the new Amazon RDS endpoint in your application instead of the Amazon EC2 endpoint.
  • Once migration and application configuration are done, you can release the Amazon EC2 instance as it is no longer required.

Conclusion

Migrating a database deployed on Amazon EC2 to Amazon RDS using AWS DMS can significantly enhance a business’s database management capabilities. Leveraging AWS’s managed services not only reduces administrative burdens but also provides better scalability, redundancy, and performance. Following the step-by-step guide and best practices, businesses can ensure a seamless and successful migration.

Drop a query if you have any questions regarding AWS DMS and we will get back to you quickly.

Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.

  • Reduced infrastructure costs
  • Timely data-driven decisions
Get Started

About CloudThat

CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, AWS EKS Service Delivery Partner, and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

FAQs

1. Can I migrate databases from Amazon EC2 to Amazon RDS without downtime?

ANS: – Yes, AWS DMS allows you to perform live migration with minimal downtime.

2. Is data validation necessary after migration?

ANS: – Yes, data validation ensures data integrity and confirms the accuracy of the migrated data.

3. Can I revert to the Amazon EC2 database after migration?

ANS: – It is possible to revert to the Amazon EC2 database if needed, provided you have a backup before the migration.

WRITTEN BY Aniket Kumar Ambasta

Aniket Kumar Ambasta works as a Research associate- TC - Infra, Security, and Migration at CloudThat. He is AWS Solutions Architect- Associate certified and has completed his Bachelor's in Computer Applications. He has good experience in Cloud technologies. Apart from professional interests, he loves exploring and learning new technologies.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!