---
type: "article"
title: "DynamoDB as EventStore"
summary: "I would like to share with you how I managed to deploy a solution to store Domain Events in DynamoDB in 2 days (and mostly because of AWS  permission issues...😅)."
newsletter: "Engineering Strategy"
newsletter_handle: "engineeringstrategy"
newsletter_url: "https://usecommune.com/n/engineeringstrategy"
author: "Aleix Morgadas (@aleixmorgadas)"
published: "2021-08-11T08:54:35.376Z"
canonical_url: "https://usecommune.com/n/engineeringstrategy/a/dynamodb-as-eventstore"
markdown_url: "https://usecommune.com/n/engineeringstrategy/a/dynamodb-as-eventstore.md"
chat_url: "https://usecommune.com/n/engineeringstrategy/a/dynamodb-as-eventstore/chat"
body_source: "imported"
likes: 0
replies: 0
body_words: 189
---

# DynamoDB as EventStore

[![practical-dev](https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/bc437f55-0a53-4f41-bca2-96e5843fad8a_1000x420.png "practical-dev")](https://substackcdn.com/image/fetch/$s_!i-vR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc437f55-0a53-4f41-bca2-96e5843fad8a_1000x420.png)

I would like to share with you how I managed to deploy a solution to store Domain Events in DynamoDB in 2 days (and mostly because of AWS permission issues...😅).

I wanted a solution to store how the user interacted with different Domain Models and decouple that storage from the monolithic so they can grow independently. I aimed to create something super simple, or at least not that complex, in 2 to 3 days.

I wanted to process events as:

`Monolith sends message to ➡️ SQS ➡️ Triggers Lambda to store it into ➡️ DynamoDB Table`

Even though DynamoDB might not be an optimal solution to be used as Event Store, I have given it a try for the next reasons:

- It is fully managed by AWS
- It is cheap enough
- We don't require high write throughput nor read for the moment.
- Able to encrypt the content

## Implementation

I decided to go with:

- [Terraform](https://www.terraform.io/) as Infrastructure as Code
- Python for [AWS Lambda](https://aws.amazon.com/lambda/)

You can find the [source code here](https://github.com/aleixmorgadas/dynamodb-as-eventstore) 😊

Ready to be deployed into your cloud solution 💪😁

[![](https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/0fa73e16-8c98-41fc-aa7f-1f88dedb8a71_480x469.gif)](https://github.com/aleixmorgadas/dynamodb-as-eventstore)

***

## Discussion

No replies yet.
