DynamoDB is one of the fastest-growing databases right now. It’s fully-managed, has pay-per-use billing, and fits perfectly with serverless compute.
But modeling your data in DynamoDB is significantly different than modeling in a traditional relational database. And if you try to model your DynamoDB table like your relational database, you’ll be in a world of hurt.
In this post, we’re going to cover my top ten tips for data modeling with DynamoDB. They run the gamut, from understanding of basic principles to concrete design tips to billing advice. With these tips, you’ll be on your way to DynamoDB success.
Let’s get started!
Understand the basics of single-table design with DynamoDB
By far, the biggest mindset shift you will make as you move from a traditional relational database into DynamoDB is the acceptance of “single-table design”. In a relational database, each different entity will receive its own table, specifically shaped to hold that entity’s data. There will be columns for each of the entity’s attributes with required values and constraints.
With DynamoDB, this isn’t the case. You’ll jam all of your entities – Customers, Orders, Inventory, etc .– into a single table. There are no required columns and attributes, save for the primary key which uniquely identifies each item.
Your table will look more like the following:
GIPHY App Key not set. Please check settings