You are on page 1of 2

DB Migration:

# If you have a source DB already running with an expossed static IP then you can
skip the below mentioned step:
1) Create a linux AMI Ec2 instance and download mysql in to it .
For this we can use a bootstrap script mysql.sh at the time of creation of
instance.
2) Once the instance is created with mysql running on it, we need to login to mysql
via terminal and create a new user, grant all access to it.
Command:
mysql;
CREATE USER 'USER_NAME'@'%' IDENTIFIED BY 'PASSWORD';
grant all privileges on DB_NAME.* to 'USER_NAME'@'%' identified by 'PASSWORD';
3) Run SELECT * FROM mysql.user \G; to check wehter the user has been created and
if it is created successfully than exit form mysql terminal.
4) Now we need to add the below mentioned lines in the my.cnf file kept in /etc
location.
bind-address = 0.0.0.0 //this will allow all the public IP to connect to our
instance i.e it will allow us to remotely acces the DB
//below mentioned line allows the logging in binary log format and add it to row.
server-id = 1
log_bin = mysql-bin
binlog_format = row
5) Note down the EC2 instance DNS it will be the end point as server name while
creating the source endpoint

# If u have created a target DB and its runnign then skip the below mentioned
steps:
1) Go to the RDS in the amazon console
2) Create a RDS instance and source with mysql server
3) The RDS instance Security group must be same as the of EC2 instance security
group
4) Note the RDS End point name it will be used as server name while creating the
targe end point

Migration process
1) Creating a replication instance with t2.micro instance
2) The vpc security group of replication instance must be same as that of the EC2
isntance and RDS isntance.
3) Once the instance is created we need to create endpoint
4) While creating end point we will need to enter follwing info
A)Source(EC2 instance):
1) Source engine: It will be the name of the db engine running in our source
instance
2) Server name: It will be the DNS/Static IP for our source instance
3) Port: Port number in which our DB is running in our source instance.
4) UserName and Password of DB running in our source instance
5) Let keep rest of the thing as default
Run test: which will test the source connection endpoint
B)Target(RDS instance):
1) Source engine: It will be the name of the db engine running in our target
instance
2) Server name: It will be the DNS for our target instance
3) Port: Port number in which our DB is running in our target instance.
4) UserName and Password of DB running in our target instance
5) Let keep rest of the thing as default
Run test: which will test the target connection endpoint
5) Once the source and target endpoints are created we need to create a migrating
task and we will required below mentioned information for the same
1) Replication instance: it will be auto populated and we will need to choose
our replication instance from the populated list
2) We need to select our source and target endpoint which we have created in
above steps
3) Select migration type as : Migrating existing data and replicate on going
changes
4) Rest let every thing be default and just add table mapping and in the
selection rule allow only the schema that we want to include and exclude the other
schema
6) Once the task is created it will automatically get started and will monitor the
migration.

You might also like