Architecture

Task 1: Preparing the source endpoint

  1. Launch and connect to EC2 instance

  2. Install MariaDB

    sudo yum install mariadb-server
  3. Start MariaDB Server

    sudo systemctl start mariadb.service
  4. Get into DB prompt

    mysql -u root
  5. Create a new database, user and grant permission for the user on the newly created database

    create database TestDB;
    create user 'dmsuser'@'%' identified by 'password';
    grant all privileges on TestDB.* to 'dmsuser'@'%';
    flush privileges;
    exit;
  6. Edit the EC2 instance’s Security Group Inbound rule to allow connections on Port 3306 (Protocol: MYSQL/Aurora) from any IPv4 address

  7. SSH into EC2 instance

  8. Create a CSV file in EC2 instance and lets name it data.csv

    touch data.csv
  9. Insert the following lines into data.csv

    nano data.csv
    ID,Name,Age
    AB01,Sam,34
    AB10,Jack,28
    AB12,Hugh,23
    AB15,Karthik,46
    AB29,Shyam,33
    AB36,Sundar,29
  10. Exit from nano editor by pressing Ctrl+O, Y, Enter, Ctrl+X

  11. Get into MySQL prompt

    mysql -u dmsuser -p

    Enter the password: password when prompted

  12. Create the table

    use TestDB;
    create table TestTable(emp_id char(4) primary key, emp_name varchar(50), emp_age int);
  13. Load the CSV into table

    LOAD DATA LOCAL INFILE '/home/ec2-user/emp_details.csv' INTO TABLE TestTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES;
  14. Viola, you have your source endpoint ready now

Task 2: Preparing the Target endpoint

  1. Launch an RDS instance with MariaDB database engine

Task 3: Prepare your DMS

  1. Create a replication instance in Database Migration Service of your AWS Management console

  2. Create Source and Target endpoint

  3. Create a replication task

Last modified: March 23, 2022