Outbox pattern with Amazon DynamoDB and Amazon EventBridge

Amazon DynamoDB → AWS Lambda → Amazon EventBridge → AWS Lambda

Outbox pattern example with DynamoDB streams and EventBridge. Listen for new inserts and raise domain events into your architecture.

Example outbox messaging pattern that first stores data, uses change data capture to raise events for downstream consumers
How the outbox pattern works
  • Lambda is triggered to insert data into DynamoDB (new user in this example). This Lambda would be triggered from other event in reality, e.g API Gateway for example
  • 2. Table to store new information (user in this example)
  • 3. Change data capture stream setup for table to listen for New Image (new items into the table)
  • 4. Lambda connects to stream to process the change events, and processed them into Domain events (in this example UserCreated).
  • 5. Events are sent to business event bus, and rules setup for downstream consumers. In this example we have a basic Lambda function listening for the new UserCreated event.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/dynamodb-streams-to-eventbridge-outbox-pattern

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk delete.

Additional resources

Created by:

David Boyne

David Boyne

Helping people learn about event-driven architectures and serverless

Follow on LinkedIn