1. What is DynamoDB?
Amazon DynamoDB is a fully managed, serverless, key-value and document NoSQL database. It delivers single-digit millisecond performance at any scale with built-in security, backup, and in-memory caching.
Core Concept DynamoDB is serverless: no servers to provision, no OS to patch, no capacity to plan (in on-demand mode). It automatically scales to handle trillions of requests per day. Data is replicated across 3 AZs within a Region for high availability. It is the go-to NoSQL database on AWS.
2. Key Characteristics
- Fully managed, serverless — no infrastructure to manage
- Key-value AND document data model (flexible schema)
- Single-digit millisecond latency at any scale
- Data replicated across 3 AZs automatically
- Supports ACID transactions
- Event-driven programming via DynamoDB Streams
- Encryption at rest (KMS) by default
- Maximum item size: 400 KB
- Integrated with IAM for fine-grained access control
3. DynamoDB Data Model
Tables, Items, and Attributes
- Table: A collection of items (like a table in a relational DB, but schema-less).
- Item: A single record in a table (like a row). Each item can have different attributes.
- Attribute: A data element on an item (like a column, but not all items need the same attributes).
Primary Key (Required)
Every table must have a primary key defined at creation. It uniquely identifies each item. Two options:

Choosing a Good Partition Key The partition key determines data distribution. A bad PK (e.g., "country" with only 5 values) creates hot partitions. A good PK has high cardinality (many unique values) and distributes access evenly. Examples of good PKs: UserID, DeviceID, SessionID.
4. Read/Write Capacity
Capacity Modes

Capacity Unit Calculations

Capacity Calculation Examples: Write: 10 items/sec, each 2.5 KB Each item = ceil(2.5/1) = 3 WCU Total = 10 × 3 = 30 WCU Read (Strongly Consistent): 20 items/sec, each 6 KB Each item = ceil(6/4) = 2 RCU Total = 20 × 2 = 40 RCU Read (Eventually Consistent): 20 items/sec, each 6 KB Total = 40 / 2 = 20 RCU (half the strongly consistent)
5. Secondary Indexes
Indexes allow you to query data using different attributes than the table’s primary key.

LSI vs GSI LSI = same partition key, different sort key. Created at table creation only. Shares capacity. GSI = completely different key schema. Can be added anytime. Has own capacity. GSI is more flexible and more commonly used. If the exam asks about querying by a non-key attribute, the answer is usually GSI.
6. DynamoDB API Operations

7. When to use
Use DynamoDB when you need a fully managed, serverless NoSQL database with single-digit millisecond performance at any scale.
Key exam triggers:
- "NoSQL"
- "key-value"
- "serverless database"
- "single-digit millisecond latency"
- "massive scale"
- "session store"
- "gaming leaderboard"
Common scenarios:
- Session storage for web/mobile apps.
- Gaming leaderboards, player profiles.
- IoT device state and telemetry.
- Shopping carts, user preferences.
- Real-time bidding, ad tech.
- Any workload needing predictable low-latency at a massive scale.
Important Warning Scan reads EVERY item in the table and is very expensive on large tables. Always prefer Query (which targets a specific partition key) over Scan. If you must scan, use Parallel Scan and apply filters to reduce the amount of returned data. The exam tests this: if you see "improve DynamoDB performance," the answer often involves replacing Scan with Query + GSI.
Exam Tip
DynamoDB Fundamentals: Max item = 400 KB. PK = partition key (or PK + SK). On-Demand = no planning, more expensive. Provisioned = set RCU/WCU + auto scaling. 1 WCU = 1 write/s for 1 KB. 1 RCU = 1 strongly consistent read/s for 4 KB (or 2 eventually consistent). GSI = flexible, own capacity, eventually consistent only. LSI = created at table time only, shares capacity. Always prefer Query over Scan.