Viewing your DynamoDB ER Diagram

  • DynamoDB
  • ER Diagram
About 1 min

# Viewing your DynamoDB ER Diagram

DynamoDB is our favorite NoSQL database. Having worked with it for years now, we have begun to see a few patterns that emerge. One of them is that, if you decide to setup your tables in a more normalized way, that there ends up being loosely defined relationships between them.

If you end up going the route of one table, that houses all your data this will not apply. It is a perfectly valid solution as well, but in this particular case, we have decided to actually setup our database a bit more like a traditional SQL database. What this then affords you is the ability to view all the primary keys, global secondary indexes, and inferred foreign keys in one place.

You can get to the ER Diagram for your DynamoDB tables in the side navigation on the left, as seen below.

There are two real types of indexes, the Primary Key which may or may not have a Sort Key also associated with it. And then you can also have Global Secondary Indexes that may or may not have Sort Keys also associated with them. The last key, the Foreign Key, is what we infer, based on the data in your table. Currently, if you have a column called userId in a table, and then a User table, we infer that this is related. Below you can see a sample ER Diagram.

And if we drill down into the Team and User tables, you can see the relationship between them.

# Conclusion

Under the hood, we grab one record from each table in your database, and figure out what your columns are. Because it is NoSQL, and columns can always change, this doesn't give a perfect representation of your data, but it is quite helpful in being able to explain your system in a non-code, visually impactful way.

Last update: February 24, 2021 13:56