- A Cloud Guru
Using DMS to Migrate a Database for Cost Optimization
One of the most important aspects of any migration of data to the cloud is cost optimization. Luckily, AWS has made this relatively simple thanks to the Database Migration Service. In this hands-on lab, we are going to use the Database Migrations Service (DMS) to migrate a database from an EC2 server to RDS in order to gain the cost savings of running your database on an RDS instance versus an EC2 instance and also getting the full benefit of AWS's hosted architecture.
Table of Contents
Create a Replication Instance
- Add a name: COreplicationdb
- Add description: MySQL EC2 to MySQL RDS
- Choose t2.micro.
- Set the Engine version to 2.4.3 or the latest version.
- Set the Allocated Storage (GB) to 10.
- Choose the lab VPC.
- Choose no for multi-AZ to ensure multi-AZ is NOT selected.
- Uncheck publicly accessible.
- Under advanced, change 50 to 10.
- For the replication subnet group, choose the default VPC.
- Leave no preference for AZ.
- Choose the Database Security Group.
- For KMS, leave the defaults.
Create a Target Endpoint
- Check the Target box.
- Check the RDS instance box.
- Select the new-db instance from the drop down.
- Leave the defaults for the endpoint identifier, target engine, server name, and port number.
- For SSL mode, select None.
- The user name is cloud_user.
- For the password, we have to go back to our Linux Academy credentials and copy and paste the password.
- Choose our lab VPC again, the replication instance we created, and run the test.
Create a Source Endpoint
- Leave source checked this time.
- Do not select the RDS DB instance.
- For our endpoint identifier, we can add
- For our source engine, we need to select MySQL.
- For the server name, we need our EC2 instance's private IP address (10.0.0.121). This is listed on the LA credentials, so let's copy and paste it in.
- The port will be 3306 again, the same for our target endpoint.
- The SSL mode will also be none again.
- The user name is cloud_user.
- The password is the same password we used for our target endpoint from the LA credential page.
- Again, choose the lab VPC and the replication instance we created.
- Run the test.
Create a Task
- Add a name: replicationtask
- Our replication instance and source and target endpoints are already populated.
- For the migration type, click in and see our options, then choose Migrate existing data.
- Leave the drop tables on Target for the target table preparation mode.
- For the option to include large objects, choose the Do not include large object columns.
- Leave Enable validation unchecked; otherwise, it will delay the creation of our task.
- Under table mappings, choose classicmodels for our schema.
- Leave the table name as a wildcard.
- Click on Add selection rule.
- Click Create task.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.