Architecture
Task 1: Preparing the source endpoint
-
Launch and connect to EC2 instance
-
Install MariaDB
sudo yum install mariadb-server
-
Start MariaDB Server
sudo systemctl start mariadb.service
-
Get into DB prompt
mysql -u root
-
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;
-
Edit the EC2 instance’s Security Group Inbound rule to allow connections on Port 3306 (Protocol: MYSQL/Aurora) from any IPv4 address
-
SSH into EC2 instance
-
Create a CSV file in EC2 instance and lets name it
data.csv
touch data.csv
-
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
-
Exit from nano editor by pressing
Ctrl+O
,Y
,Enter
,Ctrl+X
-
Get into MySQL prompt
mysql -u dmsuser -p
Enter the password: password when prompted
-
Create the table
use TestDB; create table TestTable(emp_id char(4) primary key, emp_name varchar(50), emp_age int);
-
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;
-
Viola, you have your source endpoint ready now
Task 2: Preparing the Target endpoint
- Launch an RDS instance with MariaDB database engine
Task 3: Prepare your DMS
-
Create a replication instance in Database Migration Service of your AWS Management console
-
Create Source and Target endpoint
-
Create a replication task