In this lab, we will work through the process of migrating a normalized relational database to an Amazon DynamoDB table and test to ensure our data was migrated successfully.
Successfully complete this lab by achieving the following learning objectives:
- Investigate the Source Database
Log in to the provided bastion host:
Then, connect to the source database:
mysql -h <SOURCE_DATABASE_PUBLIC_IP> -u cloud_user -pbettertogether employees
Note: There’s no space between the
-pparameter and the password
- Design a Data Model and DMS Task Mapping Rules
With the information gathered from the source database, design your data model with consideration for the provided access patterns. Map this data model to the DynamoDB table partition/sort keys, as well as any local or global secondary indexes. Then, create DMS task mapping rules to map the data from the source database to your DynamoDB table.
- The data model shown in our solution video is available at this link
- DMS Task Mapping Rule Reference
- Create a DynamoDB Table
Navigate to the DynamoDB web console and create a DynamoDB table called
employees. Additionally, you will need to create three local secondary indexes called
title_from_date, as well as a global secondary index with a partition name of
titleand a sort key of
- Create and Start a DMS Task
Navigate to the Database Migration Service web console and create a new task using the mapping rules you created, and set the task to start automatically.
- Test Access Patterns
Once the DMS task has completed, navigate to the DynamoDB web console and test that you have satisfied the requested access patterns.
You will need to satisfy the following access patterns:
- Search the table for all employees in the Development department with the title Senior Engineer and only include their most recent salary.
- Get all information about an employee in the Production department with the
- Get information on all employees in the Production department hired between January 1, 1999 and January 1, 2001. Filter this data so there are no duplicate records.
- Get information on all employees in the Development department that had a title change in the 6 months before January 1, 2001. Filter this data so there are no duplicate records.
- Get information on all employees with the title Engineer and return only records that show their most recent salary date.