You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This scenario demonstrates how to use Database Migration Service (DMS) to create change data capture (CDC) and full load tasks using the Cloud Development Kit in Python. It is a self-contained setup that will create a VPC to host 2 databases, a Kinesis stream, and 4 replication tasks.
15
+
This sample demonstrates how to use AWS Database Migration Service (DMS) to create change data capture (CDC) and full load replication tasks using the AWS Cloud Development Kit in Python. The application showcases real-time data replication from MariaDB databases to Kinesis streams, enabling you to capture and stream database changes as they occur. It is a self-contained setup that will create a local VPC to host 2 databases, a Kinesis stream, and 4 replication tasks. To test this application sample, we will demonstrate how you use LocalStack to deploy the complete DMS infrastructure on your developer machine and validate the data replication workflow locally. This provides a cost-effective way to develop and test database migration patterns before deploying to production AWS environments.
-[CDK](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://github.com/localstack/aws-cdk-local) wrapper
38
+
-[`make`](https://www.gnu.org/software/make/) (**optional**, but recommended for running the sample application)
23
39
24
-
The Docker Compose file will start LocalStack Pro container and a MariaDB container. The MariaDB container will be used to showcase how to reach a database external to LocalStack.
40
+
## Installation
25
41
26
-
## Instructions
42
+
To run the sample application, you need to install the required dependencies.
- Captures and logs five Kinesis events: 2 for `awsdms_apply_exceptions` table, 3 for our tables
89
-
- Makes four inserts
90
-
- Captures and logs four Kinesis events: 2 for tables in task 1, 2 for table in task 2
91
-
- Makes three table alterations, one per table
92
-
- Captures and logs three Kinesis events
93
-
- Logs `table_statistics` for both tasks
121
+
This sample demonstrates full load replication tasks against an external MariaDB database running in Docker. The full load scenario showcases initial data migration and bulk data transfer patterns.
94
122
95
-
Two tasks perform full load replication on Dockerized MariaDB. The other two perform CDC replication on a MariaDB RDS database.
123
+
The full load replication workflow includes:
96
124
97
-
All tasks target the same Kinesis Stream.
125
+
- Creating three tables: `authors`, `accounts`, `novels` with sample data
126
+
- Starting full load task 1 targeting tables starting with 'a' (`a%` table mapping)
127
+
- Starting full load task 2 targeting the `novels` table (specific table mapping)
128
+
- Capturing Kinesis events for table operations: drop tables, create tables, and data inserts
129
+
- Monitoring table statistics and replication progress for both tasks
130
+
- Demonstrating selective table replication using different mapping rules
98
131
99
-
## Deploying on AWS
132
+
This pattern is ideal for initial database migrations where you need to transfer existing data from on-premises or external databases to AWS-managed services.
100
133
101
-
You can deploy and run the stack on AWS by running the following commands:
134
+
### Change Data Capture (CDC)
102
135
103
-
```bash
104
-
make deploy-aws
105
-
make run-aws
106
-
```
136
+
The CDC replication tasks demonstrate real-time change capture from a MariaDB RDS instance, streaming ongoing database changes to Kinesis as they occur.
137
+
138
+
The CDC replication workflow includes:
139
+
140
+
- Creating three tables: `authors`, `accounts`, `novels` in the RDS database
- Capturing real-time changes: INSERT, UPDATE, and DELETE operations
144
+
- Performing table alterations and schema changes during active replication
145
+
- Streaming all changes to the same Kinesis Data Stream for downstream processing
146
+
- Monitoring replication lag and table statistics for ongoing operations
147
+
148
+
This pattern enables building event-driven architectures and real-time analytics pipelines that respond to database changes as they happen.
149
+
150
+
## Summary
151
+
152
+
This sample application demonstrates how to build, deploy, and test a complete database migration and replication pipeline using AWS DMS and related services. It showcases the following patterns:
153
+
154
+
- Deploying DMS infrastructure using AWS CDK with Python
155
+
- Configuring full load and CDC replication tasks for different migration scenarios
156
+
- Integrating multiple database sources (RDS and external MariaDB) with streaming targets
157
+
- Using Secrets Manager for secure credential management in DMS workflows
158
+
- Monitoring data replication through Kinesis stream events and DMS table statistics
159
+
- Leveraging LocalStack Pro for cost-effective development and testing of DMS workflows
160
+
161
+
The application provides a foundation for understanding enterprise database migration patterns and real-time data replication architectures.
107
162
108
-
## License
163
+
## Learn More
109
164
110
-
This project is licensed under the Apache 2.0 License.
0 commit comments