Skip to main content

Command Palette

Search for a command to run...

πŸš€ Migrating to AWS : Database Migration using AWS DMS

Updated
β€’4 min read
πŸš€ Migrating to AWS : Database Migration using AWS DMS

πŸ“‹ Introduction

Migrating databases from on-premises to AWS is a critical step in cloud adoption. AWS Database Migration Service (DMS) helps streamline this process by providing a secure, scalable, and automated solution for full-load and ongoing replication of databases.

Following Phase 1 - Application Discovery & TCO Analysis, we now move to Phase 2: AWS Database Migration to efficiently transition MySQL databases from an on-premises setup to Amazon RDS (Relational Database Service).


πŸ“Œ Key Objectives of Phase 2

βœ… Provision AWS RDS as the target database.
βœ… Create a DMS Replication Instance to facilitate data migration.
βœ… Configure Source & Target DMS Endpoints for secure connections.
βœ… Enable Binary Logs in MySQL for ongoing replication.
βœ… Execute AWS DMS Migration Task for database replication.

By the end of this phase, the on-prem MySQL database will be fully migrated to AWS RDS, ensuring data integrity, security, and scalability.


πŸ“‘ Follow the GitHub Documentation for Full Details

πŸ”Ή GitHub Repo: AWS Migration Project
πŸ“Œ Phase 2: AWS Database Migration
➑️ Pre-Requisite: GitHub Link
➑️ Database Migration: GitHub Link
➑️ Troubleshooting: GitHub Link

πŸ”Ή πŸŽ₯ Watch the Video Tutorial on YouTube: Click Here


🌍 On-Premises Database Overview

Before migration, let’s understand the existing on-prem database setup:

πŸ“Œ Database Server Details
πŸ”Ή Database: MySQL 5.7
πŸ”Ή Operating System: Ubuntu 24.04 LTS
πŸ”Ή Storage: 8 GB SSD
πŸ”Ή Tables: obbs.tbladmin, obbs.tblbooking, obbs.tblcontact, etc.
πŸ”Ή Replication Type: Full Load + Ongoing Replication (CDC)

πŸ’‘ Challenges with On-Premises Databases:
❌ High Maintenance Costs – Requires manual upgrades and monitoring.
❌ Limited Scalability – Hard to scale with increasing data load.
❌ Backup & Recovery Issues – No automated snapshot capabilities.

βœ… Why AWS RDS?
βœ”οΈ Fully managed database with automated backups.
βœ”οΈ High availability with Multi-AZ deployment.
βœ”οΈ Auto-scaling capabilities for dynamic workloads.


πŸ— Step 1: Create Target RDS Database in AWS

πŸ“Œ The first step is to provision an Amazon RDS MySQL instance as the target database.

πŸ›  Steps to Create RDS Instance

1️⃣ Go to AWS Console β†’ Amazon RDS β†’ Create Database
2️⃣ Select MySQL as Engine Type
3️⃣ Choose Multi-AZ Deployment for High Availability
4️⃣ Set Master Username & Password
5️⃣ Configure Security Groups for Database Access
6️⃣ Enable Automated Backups & Monitoring
7️⃣ Click on Create Database

πŸ“Œ Once the RDS instance is running, note the endpoint.
βœ… Example: database-1.cpioo8iee1me.us-west-2.rds.amazonaws.com


πŸš€ Step 2: Create AWS DMS Replication Instance

πŸ“Œ AWS DMS Replication Instance acts as a bridge to replicate data from the source MySQL database to Amazon RDS.

πŸ›  Steps to Create a DMS Replication Instance

1️⃣ Go to AWS DMS Console β†’ Replication Instances β†’ Create Replication Instance
2️⃣ Choose Instance Type: dms.t3.medium (for moderate workloads)
3️⃣ Set Storage: 100 GB (adjust based on database size)
4️⃣ Select VPC & Security Groups: Ensure RDS and On-Prem Server are accessible
5️⃣ Click Create Replication Instance

πŸ“Œ Once the replication instance is available, proceed to configuring endpoints.


πŸ”„ Step 3: Configure Source & Target Endpoints

πŸ”Ή Source Endpoint (On-Prem MySQL)

1️⃣ Go to AWS DMS Console β†’ Endpoints β†’ Create Endpoint
2️⃣ Choose Source Type: MySQL
3️⃣ Enter Source Database Endpoint: <on-prem-db-IP>:3306
4️⃣ Enter Username & Password
5️⃣ Test Connection β†’ If Successful, Save Endpoint

πŸ”Ή Target Endpoint (Amazon RDS MySQL)

1️⃣ Go to AWS DMS Console β†’ Endpoints β†’ Create Endpoint
2️⃣ Choose Target Type: MySQL
3️⃣ Enter Amazon RDS Endpoint: database-1.cpioo8iee1me.us-west-2.rds.amazonaws.com
4️⃣ Enter Username & Password
5️⃣ Test Connection β†’ If Successful, Save Endpoint

βœ… With both endpoints successfully configured, we move to DMS Migration Task.


πŸš€ Step 4: Execute DMS Migration Task

πŸ“Œ Create a migration task in AWS DMS to transfer data from On-Prem MySQL to AWS RDS.

πŸ›  Steps to Create DMS Migration Task

1️⃣ Go to AWS DMS Console β†’ Database Migration Tasks β†’ Create Task
2️⃣ Select Source & Target Endpoints
3️⃣ Choose Replication Type: Full Load + Ongoing Replication (CDC)
4️⃣ Enable Logging & CloudWatch Monitoring
5️⃣ Click Start Migration Task

πŸ“Œ DMS will now start migrating the data. Check CloudWatch logs for progress.

Status: Created

Status: Load Complete


βœ… Step 5: Testing & Validation

πŸ“Œ Once migration is complete, validate the database in AWS RDS.

πŸ›  Steps to Verify Data Migration

1️⃣ Connect to AWS RDS using MySQL Workbench or CLI.

mysql -h database-1.cpioo8iee1me.us-west-2.rds.amazonaws.com -u admin -p

2️⃣ Check database and tables.

SHOW DATABASES;
USE obbs;
SHOW TABLES;

3️⃣ Verify Data Consistency

SELECT COUNT(*) FROM obbs.tbladmin;

βœ… Data successfully migrated from on-prem to AWS RDS! πŸŽ‰


🎯 Summary of Phase 2

βœ… Provisioned AWS RDS MySQL as the Target Database.
βœ… Created AWS DMS Replication Instance for Data Transfer.
βœ… Configured Source & Target Endpoints for Secure Migration.
βœ… Executed DMS Migration Task for Full Load & Ongoing Replication.
βœ… Verified Data Consistency Post-Migration.

πŸ“Œ Next Step: Phase 3 - Application Migration

πŸ”— GitHub Repo: AWS Migration Project
πŸŽ₯ Watch on YouTube: Click Here

πŸš€ Stay tuned for more AWS migration insights!

#AWS #DMS #DatabaseMigration #CloudComputing #DevOps #RDS #AmazonWebServices

AWS Projects

Part 2 of 12

πŸ”₯ **AWS Cloud Hands-On Projects**: Elevate Your Skills with Real-World Experience πŸš€ Dive into a world of cloud mastery as we explore captivating projects that fuse cutting-edge technology with hands

Up next

Migrating to AWS with Application Discovery Service (ADS)

πŸ“‹ Overview The Application Discovery Service (ADS) is the first step in migrating your workloads to AWS. It helps analyze your on-premises environment, identifying dependencies, resource usage, and configurations to streamline your migration journey...

More from this blog

C

cloud/devops

29 posts

PRAFUL PATEL β˜οΈπŸš€, Highly skilled and motivated Cloud/DevOps Engineer with a proven track record of designing, implementing, and managing robust cloud infrastructure solutions.