Evolving DynamoDB Designs
Tags: aws, serverless, dynamodb, nosql
Published: 2021-03-01 07:01:36

---
title: Evolving DynamoDB Designs
published: true
description: How to easily evolve single table DynamoDB designs
tags: aws, serverless, dynamodb, nosql, 
cover_image: https://www.sensedeep.com/images/blog/face-palm.jpg
canonical_url: https://www.sensedeep.com/blog/posts/2021/evolving-dynamodb-designs.html
---

Conventional wisdom seems to be that changing a DynamoDB design is **extremely difficult** and you want to avoid it at all costs.

It is repeated without question that you must determine all your access patterns up front because you cannot easily change your DynamoDB design after the fact. For example:

> "you cannot change primary indexes so the only option is to create a new (table), migrate the data with transformations and delete the old table. This process is excruciating, especially in production."

However, with single table designs, this thinking is out of date and today, is just plain wrong.

With single table DynamoDB designs, your keys and attributes are uncoupled from the physical implementation, so you can evolve your DynamoDB design much more easily.

**This may be the most important benefit of single table designs.**

<!--BREAK-->
<!--more-->

While planning your query access patterns is hugely important, even essential, this does not mean that the only way to change a DynamoDB implementation is a "fork-lift" upgrade where you are forced create a new table.

>Over the past year, we have extensively evolved our SenseDeep DynamoDB implementation without any downtime. We have not once had to re-create our DynamoDB table or modify our primary keys. We have added new entities, new access patterns, new indexes, changed inter-entity references and extended our item collections.

We did this by using single table designs that uncoupled our keys and attributes from the physical table keys and attributes. This is an essential tenent of single table designs. We used the [DynamoDB OneTable Library](https://www.npmjs.com/package/dynamodb-onetable) which makes defining your entities and attributes and uncoupling your keys straight forward.

We then used sequenced, reversible DynamoDB migrations to evolve our DynamoDB design without downtime. These migrations are small, scriptable atomic database mutations that add new capabilities before removing or modifying existing attributes or entities. Using migrations expressed as code, you can confidently evolve your DynamoDB design knowing that you can easily and quickly reverse a change.

We use the [OneTable CLI](https://www.sensedeep.com/blog/posts/2021/onetable-cli.html) to sequence and manage (or rollback) database migrations interspersed with code deploys.

## More?

You can read more about OneTable at: [OneTable](https://www.sensedeep.com/blog/posts/2020/dynamodb-onetable.html) and [OneTable CLI](https://www.sensedeep.com/blog/posts/2021/onetable-cli.html).

## SenseDeep with OneTable

At SenseDeep, we've used OneTable and the OneTable CLI extensively with our [SenseDeep](https://app.sensedeep.com) serverless troubleshooter. All data is stored in a single DynamoDB table and we extensively use single table design patterns. We could not be more satisfied with DynamoDB implementation. Our storage and database access costs are insanely low and access/response times are excellent.

Please try our Serverless trouble shooter [SenseDeep](https://www.sensedeep.com/).

### Contact

You can contact me (Michael O'Brien) on Twitter at: [@SenseDeepCloud](https://twitter.com/SenseDeepCloud), or [email](mob-pub-18@sensedeep.com) and ready my [Blog](https://www.sensedeep.com/blog).

To learn more about SenseDeep and how to use our troubleshooter, please visit [https://www.sensedeep.com/](https://www.sensedeep.com/).


### Links

* [OneTable Post](https://www.sensedeep.com/blog/posts/2020/dynamodb-onetable.html)
* [OneTable Migrate CLI](https://www.npmjs.com/package/onetable-cli)
* [SenseDeep Web Site](https://www.sensedeep.com/)
* [SenseDeep App](https://app.sensedeep.com/)