Tables, Items, and Primary Keys
Design DynamoDB tables with partition keys and composite primary keys, and understand item-level storage limits.
DynamoDB: NoSQL Key-Value Store
Amazon DynamoDB is a fully managed, serverless key-value and document database designed for single-digit millisecond performance at any scale. Unlike relational databases, DynamoDB is schema-less—each item can have a different set of attributes as long as the primary key is present.
DynamoDB stores data in tables, which are the top-level container analogous to a SQL table. Tables are spread across multiple storage nodes across AZs automatically, providing built-in redundancy without any configuration required from you.
Tables and Items
A DynamoDB table holds a collection of items, each of which is a collection of attributes. Attributes are typed values: String (S), Number (N), Binary (B), Boolean (BOOL), Null (NULL), List (L), Map (M), and Set types (SS, NS, BS).
Every item in a table must include the primary key attributes—all other attributes are optional and can differ between items. A single item can be at most 400 KB in size, including all its attribute names and values.
# Example DynamoDB item structure (JSON)
{
'UserId': {'S': 'user-abc-123'},
'Timestamp': {'N': '1719000000'},
'Username': {'S': 'alice'},
'Score': {'N': '4200'},
'Tags': {'SS': ['premium', 'verified']}
}All lessons in this course
- Tables, Items, and Primary Keys
- Provisioned vs On-Demand Capacity
- Global Secondary Indexes and Local Secondary Indexes
- DynamoDB Streams and Global Tables