Database Migration using AWS Database Migration Service(DMS) - Part 1

Possible ways to migrate data,

  • On-prem to Cloud
  • Cloud to On-prem
  • Within Cloud

Onprem to AWS RDS

This is not going to be a single blog instead to make it simple and precise, I'm planning to make it as multiple blogs. This is going to be a migration from on-prem to cloud.

  1. Source: On-prem (We are going to use Amazon EC2 instance)
  2. Destination: Amazon RDS Database

Firstly we need to provision an Amazon Ec2 instance with Amazon Linux2 as AMI and instance type as t2.micro. Make sure to open inbound rule in Security Group with ports 22 for SSH, 3306 for MySQL. Login to ec2 instance using ssh or use Putty.

1) To install & Setup MySQL in On-prem(EC2 Instance)

sudo su
yum update -y
yum install http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm
yum install -y mysql-community-server
rpm -qa | grep -i mysql-community
service mysqld start
service mysqld status
mysql_secure_installation
systemctl restart mysqld

To verify MySQL Installation:

mysql --version
mysql -u root -p

If you are able to login to mysql you will be able to see below output.

dmssnip.PNG

Note: You can find the complete steps for installing MySQL for reference here : cyberithub.com/install-mysql

2) Provision an Amazon RDS Database

  1. In database creation method, choose Standardcreate
  2. In Engine options, choose the Db Engine as MySQL as we have used MySql in on-prem too.
  3. Under Templates, select Free Tier
  4. In Credentials settings, Enter Master Username & Master Password. Make a note of these because you use these credentials to login to the mysql database.
  5. Disable the below options if enabled to save some cost.
    • Storage Autoscaling
    • Multi AZ Deployment
    • Automated Backups
    • Encryption
    • Performance Insights
    • Monitoring
    • Maintenance
    • Deletion Protection We can use the above options based on the use-case in our later labs.
  6. In additional configuration, provide the Initial Database name , so that Amazon RDS will create a database.
  7. Click on Create and AWS RDS database will be created in few minutes.

To connect with AWS RDS Database:

  1. Install MySQL Workbench and connect to the RDS Database. (OR)
  2. Provision a EC2 instance, ssh into the instance, install MySQL by referring the installation steps given in step 1 and run the below commands.

mysql -h ${Endpoint} -P ${Port} -u ${Master username} -p

Note: Replace the value in place of ${value}. For eg, replace ${Port} with 3306

Did you find this article valuable?

Support Sri Balaji by becoming a sponsor. Any amount is appreciated!