Our team is planning on moving from Dynamodb to RDS for various workload issues that we are facing with Dynamodb. But we have are facing a blocker in this migration since our codebase is heavy dependent on the stream feature of dynamodb where it sends new image and old image for every update. I am trying to replicate the same stream behavior after we migrate to RDS. Right now i am thinking about using the outbox pattern to update the base table in RDS and send an event to SNS which fans-out event to consumer lambda but that seems like tedeious work since there are different consumers consuming different attributes from different table. I also considered using the CDC pattern using debezium to stream row level change to kinesis which removing having to manually send events on every update but since we have 4 separate environments (dev, staging, qa and prod) and we need to host a separate ECS instance to run the debezium server to capture RDS logs, it could rack up the bill so i discarded this approach. What do you think would be some of the best ways to replicate DDB stream feature in RDS?
So your main challenge would be row-level before-and-after data automatically. 1/ DMS + Kinesis 2/ RDS Aurora (PostgreSQL)+ Lambda, or maybe even 3/ you can avoid even debrzium if using standard RDS PostgreSQL (not Aurora), you can utilize Logical Decoding without Debezium.
Basically, If you want a production-grade, asynchronous, and scalable solution that mirrors DynamoDB Streams almost exactly without the Debezium price tag, go with AWS DMS to Kinesis. You can use a tiny $15/month DMS instance for Dev/QA and scale it up for Production.If you are using Aurora PostgreSQL and your write throughput is low-to-moderate, the Aurora-to-Lambda trigger approach will cost you next to nothing in non-production environments.
Are you tired to rds for cost reasons? Consider DSQL. It’s less compatible than rds, but it’s cdc with Kinesis is decent. You don’t get the preimages, but the way it’s going, I would suspect it’s going to get debezium support and maybe more ddb like streams in the future.
This is a weird migration. Dynamo and RDS are very dissimilar. I would go back and see what you’re really trying to do here. This is very unusual.
We had a lot of query where we need join operations and also a lot of pagination. These were not considered initially hence have to migrate it now.
Depending on the DB engine, you can use the aws_lambda extension to call out to Lambda to do your work. But if you’ve got significant volume, the outbox pattern is much more scalable.
You should look to see if DynamoDB can meet your needs first. If you design your tables correctly you won’t need joins and DDB can handle pagination.
Migrating from DDB to RDS is not necessarily wrong but is a flag that would make me stop and question assumptions.
That decision is not upto me so.
Have you considered triggers? At least in PostgreSQL you can access both old and new values from within a trigger.
PS. Take this with a grain of salt, as I made this conclusion by quickly googling it; never had to do this myself.
Debezium is the technically correct approach here. Why do you think it will expensive to run debezium for dev and staging. You can shut dev staging infra, when not in use.
It’s correct. There are also ways to call lambdas through procs that can be invoked by triggers. If it were me I’d look at this first so I didn’t have to stand up more hardware to support something like DMS.
What I’d do before that though is actually analyze my schema and read/write patterns to understand why I can’t do what is required within Dynamo. Sounds like OP doesn’t have a dog in that fight but it would probably be much easier to make Dynamo work than to do this migration AND rearchitect everything interacting with Dynamo to use an RDBMS.
Have you considered DSQL ? That is a better fit for such migrations
That would be my choice as well.
Dynamo is super inflexible. I totally get OP here. Either you know your exact query pattern before you launch your app or you’re screwed.
You can do RDS native CDC to MSK and grab it at the other end.
But ideally you’d want to capture events before they go into the database
Right? Relational data modeling in DDB is pretty straightforward, given the access patterns are well understood.
For one-to-many joins store the parent data and child data under the same partition key using the sort key to tell them apart. For one-to-one joins denormalize the data - storage in DDB is cheap.
For pagination encode the LastEvaluatedKey into an encrypted+encoded token passed in the request/response to the client.
DynamoDB only suits simple apps. Complex business logic will break your single table design eventually ![]()
I am a huge DynamoDB fan. I also know that this mantra, “just redesign your tables”, or denormalize, or “just reevaluate your access patterns,” at some point starts to generate so much friction that it stops being worth it. At some point you just want to focus on your application instead of recreating a relational database from first principles.
This is a very narrow-minded take.