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. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Table Creation and Primary Keys
| 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. |