Amazon DynamoDB is AWS's fully managed NoSQL database service offering single-digit millisecond performance at scale, supporting both key-value and document data models across provisioned or on-demand capacity modes. Unlike relational databases, DynamoDB is designed around access patterns rather than normalized schemas, where tables are identified by primary keys (partition key alone or partition + sort key), and queries are optimized through carefully designed indexes rather than joins. Single-table design, where multiple entity types coexist in one table using overloaded keys and GSIs, is a core pattern for minimizing costs and maximizing performance β understanding partition key distribution, read/write capacity units (RCU/WCU), and the distinction between Query (efficient, key-based) and Scan (expensive, full-table) operations is fundamental to building cost-effective, high-performance applications.
What This Cheat Sheet Covers
This topic spans 20 focused tables and 145 indexed concepts, 96 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Table Creation and Primary Keys
Everything in DynamoDB hangs off the primary key, so getting it right is the whole game. You either use a single partition key or pair it with a sort key to store and range-query related items together, and the rows here show the patterns that make single-table design work β hierarchical sort keys, generic overloaded keys, and high-cardinality designs that spread load evenly instead of creating hot partitions.
| Concept | Example | Description | |
|---|---|---|---|
UserId | β’ Single-attribute primary key that uniquely identifies each item β’ DynamoDB distributes data across partitions based on the partition key hash | ||
PK: UserIdSK: OrderDate | β’ Partition key + sort key combination allowing multiple items with the same partition key β’ items are stored together and sorted by sort key for range queries | ||
SK: COUNTRY#USA#STATE#CA#CITY#SF | Hierarchical sort key pattern using delimiters to enable querying at any hierarchy level with begins_with conditions. | ||
CustomerId#Date or hash suffix | β’ High-cardinality keys distribute load evenly β’ avoid low-cardinality keys like status fields which create hot partitions | ||
PK: USER#123PK: ORDER#456 | Generic key names (PK/SK) with entity-type prefixes allow storing multiple entity types in one table for single-table design. | ||
Up to 4 partition + 4 sort keys | Native support for multi-attribute composite keys in GSIs (Nov 2025 feature) eliminates need for synthetic key concatenation. |