π 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




