Skip to main content
InterviewHubPRO
HomeTracksSection 19: Amazon DynamoDB (50 Qs)
Section 19 of 6450 Questions (1 Per Page)

Amazon DynamoDB & Cloud NoSQL Architecture Master Interview Bank

Single-table design, Partition Keys vs Sort Keys, Global Secondary Indexes (GSI), read/write capacity units, DynamoDB Streams, and distributed scale.

Curriculum Roadmap & Learning Path

3 Stages
Tip: Click any stage card above to instantly filter the question bank to that topic.3 Connected Milestones
50 of 50 Qs

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

10 Questions
1
JuniorCode#DynamoDB

What is Amazon DynamoDB and how does its data model work?

Amazon DynamoDB is a fully managed, serverless NoSQL key-value and document database designed for single-digit millisecond latency at any scale: Tables: Similar to a relational table, but schema-less except for the primary key • Items: Similar to a row in SQL; an item is a collection of attributes.

2
JuniorCode#DynamoDB

What are Partition Keys (HASH) and Sort Keys (RANGE) in DynamoDB?

Every DynamoDB item must have a primary key. It can be simple or composite: Simple Primary Key (Partition Key only): DynamoDB hashes the partition key value to determine the exact internal storage partition where the.

3
JuniorCode#DynamoDB

What is the difference between Query and Scan operations in DynamoDB?

Query: Highly efficient and targeted • Scan: Reads every single item in the entire table or index sequentially.

4
Junior#dynamodb#Basic

What is the difference between Strongly Consistent Reads and Eventually Consistent Reads?

When data is written to DynamoDB, it is replicated across three Availability Zones (AZs): Eventually Consistent Read (Default): Reads from one of the replicas • Strongly Consistent Read: Returns a response with the most up-to-date data by reflecting all successful writes prior to the read.

5
Junior#dynamodb#Basic

What are Read Capacity Units (RCU) and Write Capacity Units (WCU)?

1 WCU: Represents one write per second for an item up to 1 KB in size • 1 RCU: Represents one strongly consistent read per second (or two eventually consistent reads) for an item up to 4 KB in size • If an item is 8 KB • Strongly consistent read = 2 RCUs.

6
Junior#dynamodb#Basic

What is the difference between Provisioned and On-Demand capacity modes?

Provisioned Mode: You explicitly specify the number of RCUs and WCUs (with optional auto-scaling) • On-Demand Mode: Pay strictly per request (0.25 per million writes, 1.25 per million reads).

7
Junior#DynamoDB

What is DynamoDB Time to Live (TTL) and how does it work?

TTL automatically expires and deletes items from a table at no additional cost (consumes 0 WCU): You designate an attribute containing a Unix epoch timestamp in seconds (e.g. 1773993600) • A background worker scans the table and deletes expired items typically within 48 hours of expiration.

8
Junior#DynamoDB

What is the maximum item size in DynamoDB and how do you store larger data?

The hard limit for an item in DynamoDB is 400 KB (including attribute names and values): If your data exceeds 400 KB (e.g. user documents, PDF blobs, large image metadata) • Store the binary blob or raw JSON payload in Amazon S3 • Store the S3 object URL, bucket name, ETag, and metadata attributes inside DynamoDB.

9
JuniorCode#DynamoDB

What are Condition Expressions in DynamoDB writes?

Condition expressions prevent race conditions and overwrites by executing writes only if specific item attributes meet criteria: attributenotexists(PK) ensures an item cannot be overwritten if it already exists (idempotent creation) • version = :expectedVersion enables optimistic concurrency control.

10
Junior#DynamoDB

What are Projection Expressions in DynamoDB?

Projection expressions specify the subset of attributes to return from an item, reducing network bandwidth between AWS and your application: Example: ProjectionExpression: "userId, email, accountStatus" • Note: It does not reduce RCU consumption; DynamoDB calculates read capacity based on the full item size before projection.

Part 2: Intermediate Data Modeling & API Operations (Mid-Level)

10 Questions
11
Most AskedJuniorCode#HTTP & REST APIs

What is the difference between Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI)?

LSI (Local Secondary Index) • Must share the exact same Partition Key as the base table, but provides an alternative Sort Key • Must be declared at table creation time; cannot be added or deleted later • Enforces a 10 GB partition size limit for the collection.

12
Senior#Forms#Performance

What are the GSI Projection types and their performance trade-offs?

When defining a secondary index, you choose which attributes to duplicate from the base table: KEYS_ONLY: Only the base table primary keys and index keys are copied • INCLUDE: Copies index keys plus a whitelist of specified attributes • ALL: Copies every attribute into the index.

13
Junior#DynamoDB#HTTP & REST APIs

What is Single-Table Design in DynamoDB and why is it recommended?

Instead of modeling relational tables (Users, Orders, Items, Payments) into separate DynamoDB tables, Single-Table Design stores all application entities inside one consolidated table: Mechanism: Overloads generic primary key attributes named PK and SK.

14
MidCode#DynamoDB#HTTP & REST APIs

How do you implement PK and SK Overloading in Single-Table Design?

Entities share standard PK and SK string names using colon or hashtag delimiters: User Profile: PK = "USER#42", SK = "PROFILE#42" • User Order: PK = "USER#42", SK = "ORDER#2026-03-15#991" • Order Item: PK = "ORDER#991", SK = "ITEM#SKU-772" • Global Index GSI1: GSI1PK = "STATUS#PENDING", GSI1SK = "DATE#2026-03-15".

15
Junior#DynamoDB#HTTP & REST APIs

What are Hot Partitions in DynamoDB and how do you prevent them?

A hot partition occurs when read or write traffic is disproportionately concentrated on a single partition key value. Each partition has a physical limit of 1,000 WCU and 3,000 RCU: Causes: Keys with high skew (e.g. status = "ACTIVE", or today's date 2026-03-15) • Remedies.

16
Junior#DynamoDB#HTTP & REST APIs

What is DynamoDB Accelerator (DAX) and when should it be used?

DAX is a fully managed, highly available, in-memory cache specifically built for DynamoDB: Provides microsecond response times for read-heavy workloads (from ~5ms down to ~200μs) • Drop-in SDK Replacement: No need to rewrite caching logic; point the DynamoDB client at the DAX cluster endpoint.

17
MidCode#State Management#Databases & SQL

How do DynamoDB Transactions (TransactWriteItems / TransactGetItems) work?

DynamoDB provides all-or-nothing ACID transactions across multiple items within or across tables in the same AWS account and region: TransactWriteItems: Up to 100 items or 4 MB of data in a single transactional batch • Cost: Consumes 2x the capacity units (two-phase commit protocol under the hood).

18
Junior#HTTP & REST APIs

What is BatchGetItem and BatchWriteItem and what are their limitations?

BatchGetItem: Retrieves up to 100 items (max 16 MB) across one or more tables in parallel • BatchWriteItem: Puts or deletes up to 25 items (max 16 MB) in a single request • Crucial Caveat: Batches do not support condition expressions and are not atomic (some items can succeed while others fail).

19
Junior#DynamoDB#HTTP & REST APIs

What is DynamoDB Streams and what are the four stream view types?

DynamoDB Streams captures an ordered log of item-level modifications for 24 hours: KEYSONLY: Only the modified item's primary key attributes • NEWIMAGE: The complete item as it appears after the modification • OLDIMAGE: The complete item as it was before the modification • NEWANDOLDIMAGES: Both before and after representations.

20
MidCode#DynamoDB#HTTP & REST APIs

How do you implement Pagination in DynamoDB queries?

DynamoDB returns at most 1 MB of data or the configured Limit in a single query: If more items remain, the response includes LastEvaluatedKey • Pass ExclusiveStartKey: LastEvaluatedKey in the subsequent query to fetch the next page • Once LastEvaluatedKey is undefined/null, the last page has been reached.

Part 3: Advanced Architecture, Scale & Internals (Senior / Lead)

30 Questions
21
Senior#System Design#DynamoDB

How does DynamoDB partition data physically under the hood?

Physical partitions are SSD-backed storage nodes managed by a storage fleet running Paxos consensus • Each partition holds up to 10 GB of data and supports up to 1,000 WCU and 3,000 RCU • An MD5 hash of the partition key produces a 128-bit integer determining which partition owns the key range.

22
Senior#System Design#DynamoDB

What is Burst Capacity and Adaptive Capacity in DynamoDB?

Burst Capacity: Unused read and write capacity is banked up to 300 seconds (5 minutes) to absorb sudden momentary traffic surges • Adaptive Capacity: Automatically redistributes allocated capacity from cold partitions to hot partitions, preventing throttling if the overall.

23
Senior#System Design#DynamoDB

How do DynamoDB Global Tables work and how do they resolve conflict?

Global Tables provide multi-region, multi-master replication with 99.999% availability: Writes to any replica region are replicated asynchronously within ~1 second to all other regions • Conflict Resolution: Uses Last Writer Wins (LWW) based on an internal system timestamp.

24
Senior#System Design#DynamoDB

How do you model Many-to-Many relationships in DynamoDB?

Modeled using an Adjacency List pattern via Global Secondary Indexes: Example: Students and Classes • Base Table: PK = "STUDENT#1", SK = "CLASS#Math" • GSI1: Invert keys: GSI1PK = SK ("CLASS#Math"), GSI1SK = PK ("STUDENT#1") • To list all classes for a student: Query base table where PK = "STUDENT#1".

25
SeniorCode#System Design

How do you implement Hierarchical 1-to-N relationships using Sort Key prefixes?

Use structured composite string patterns in sort keys: Location Hierarchy • PK = "COUNTRY#US", SK = "STATE#CA#COUNTY#Orange#CITY#Irvine" • Queries can fetch broad or specific child trees using beginswith • Fetch entire state: SK beginswith("STATE#CA#").

26
Senior#System Design

What are the best practices for Primary Key design to prevent write throttling?

Use high-cardinality values for Partition Keys (UUIDs, User IDs, Device IDs) • Avoid low-cardinality keys like status flags, boolean values, or day/month dates • If temporal data is required, prefix date with entity ID: USER#101#2026-03 • Add random or calculated suffixes (sharding salt: 0..N) to hot write partitions.

27
Senior#System Design#DynamoDB

What is the difference between DynamoDB Standard and Standard-IA (Infrequent Access) table classes?

Standard: Optimized for active OLTP workloads; lower read/write capacity costs, normal storage costs (0.25/GB/month) • Standard-IA: Cuts storage costs by 60% (0.10/GB/month), but increases read and write request costs by 25%.

28
SeniorCode#System Design#DynamoDB

How do you implement distributed locking in DynamoDB?

Use conditional writes with TTL: Acquire lock: PutItem with ConditionExpression: attributenotexists(lockName) OR lockExpiresAt < :now and set lockExpiresAt to now + leaseSeconds • Heartbeat: Extend lockExpiresAt conditionally matching lease owner ID • Release lock: Delete item conditionally matching lease owner ID.

29
Senior#System Design#DynamoDB

How does DynamoDB handle Point-In-Time Recovery (PITR)?

PITR provides continuous automated backups of DynamoDB tables: Retains incremental delta logs for the preceding 35 days • Allows restoring the table to any specific second (YYYY-MM-DDTHH:MM:SSZ) within the 35-day window into a new table • Zero performance impact on the active production table.

30
Senior#System Design#DynamoDB

How do you migrate data into DynamoDB with zero downtime?

Dual-write new writes to both legacy database and DynamoDB • Backfill historical data using AWS Glue or AWS DMS (Database Migration Service) • Reconcile data differences using verification jobs • Switch read traffic to DynamoDB.

31
Senior#System Design

What is the GSI Write Amplification problem and how do you minimize it?

Every time an item is updated, DynamoDB must write to every GSI whose index attributes are present on the item: If a table has 5 GSIs, a single item update may consume 1 base table WCU + 5 GSI WCUs!

32
Senior#System Design#DynamoDB

How do you handle leaderboard / rank queries efficiently in DynamoDB?

DynamoDB cannot compute dynamic ranking (like SQL RANK() OVER) across millions of items efficiently • Best approach: Store top scores in high-tier buckets (e.g. PK = "SCOREBUCKET#9001000"), or offload live real-time leaderboards to Redis Sorted.

33
Senior#Security & Auth#System Design

What security and encryption controls are available in DynamoDB?

Encryption at Rest: Enabled by default using AWS KMS (AWS owned key, AWS managed key, or Customer Managed Key - CMK) • Encryption in Transit: Enforced via HTTPS / TLS 1.3 endpoints • Access Control: Fine-grained IAM policies using LeadingKeys condition to restrict users to accessing only their own partition keys (aws:userid).

34
Senior#System Design#DynamoDB

How does DynamoDB prevent Split-Brain during internal node failures?

DynamoDB uses the Paxos consensus protocol within each three-replica storage group: A write must achieve a quorum acknowledgment (at least 2 out of 3 replicas) to be confirmed • If one replica goes offline, the remaining two maintain quorum.

35
Senior#System Design#DynamoDB

When should you NOT use DynamoDB?

Ad-hoc exploratory reporting: Workloads requiring arbitrary multi-column filtering and complex dynamic aggregation (use Snowflake, BigQuery, or • Heavy relational graph traversals: Highly interconnected data requiring deep multi-hop joins (use Neo4j or Amazon Neptune).

36
Senior#System Design

Primary Key Architecture: Partition Key (Hash) vs Composite Primary Key.

Every DynamoDB item is uniquely identified by its Primary Key: Simple Primary Key (Partition Key only): Items are distributed across physical storage partitions using an internal hash function MD5(PK).

37
Most AskedSenior#System Design

Global Secondary Indexes (GSI) vs Local Secondary Indexes (LSI).

Local Secondary Index (LSI): Must share the same Partition Key as the base table, with an alternative Sort Key • Global Secondary Index (GSI): Can have a completely different Partition Key and Sort Key.

38
Senior#System Design#DynamoDB

Single-Table Design: Modeling Complex Domains in One Table.

Instead of creating 10 relational tables for Users, Orders, Products, and Reviews, Single-Table Design models all entities in one physical DynamoDB table using generic key names (PK, SK): User Entity: PK = "USER#101", SK = "METADATA#101" • Order Entity: PK = "USER#101", SK = "ORDER#2026-11-20#501".

39
Senior#System Design

Provisioned vs On-Demand (Pay-Per-Request) Capacity Modes.

On-Demand Mode: Automatically handles up to double the previous peak traffic instantaneously • Provisioned Mode: You allocate specific RCU and WCU with Auto-Scaling.

40
Senior#System Design

Calculating Capacity Units: RCU and WCU Math.

WCU (Write Capacity Unit): 1 WCU handles 1 write per second for an item up to 1 KB in size • RCU (Read Capacity Unit) • Eventually Consistent Read: 1 RCU reads two items per second up to 4 KB each (0.5 RCU per 4KB) • Strongly Consistent Read: 1 RCU reads one item per second up to 4 KB.

41
Senior#System Design

Partition Hotspots and Write Sharding (Key Salting).

A single DynamoDB physical partition can deliver at most 1,000 WCU and 3,000 RCU. If all writes target the same Partition Key (e.g. PK = "2026-11-20" or celebrity profile ID), the partition throttles (ProvisionedThroughputExceededException): Write Sharding (Salting): Append a random suffix between 1 and N to the...

42
Senior#System Design#DynamoDB

DynamoDB Streams: Real-Time Event-Driven Architecture.

DynamoDB Streams captures a time-ordered sequence of item-level modifications: Each stream record contains the change type (INSERT, MODIFY, REMOVE) and before/after item images • Automatically triggers AWS Lambda functions to update search indexes (OpenSearch), invalidate Redis caches, or emit events to Amazon EventBridge.

43
Most AskedSenior#System Design#DynamoDB

DynamoDB Accelerator (DAX): Microsecond In-Memory Cache.

DAX is a fully managed, high-availability in-memory write-through cache designed specifically for DynamoDB: Reduces read response times from milliseconds (3-10\text{ms}) to sub-millisecond microseconds (< 500\mu\text{s}) • Drop-in SDK replacement; requires zero application-level cache invalidation logic.

44
Senior#System Design

Global Tables: Multi-Region Active-Active Replication.

DynamoDB Global Tables replicates tables across multiple AWS Regions (e.g. us-east-1, eu-west-1, ap-northeast-1) with typical replication latency under 1 second: Applications read and write locally to their nearest AWS region for single-digit millisecond latency.

45
Most AskedSenior#State Management#System Design

Multi-Item ACID Transactions in DynamoDB.

DynamoDB provides all-or-nothing transactional guarantees across multiple tables: TransactWriteItems: Atomic write of up to 100 items (or 4MB total size) • TransactGetItems: Atomically reads up to 100 items • If a condition check fails on any single item, the entire transaction rolls back cleanly with zero partial writes.

46
Senior#System Design

Conditional Writes and Optimistic Locking.

Prevents concurrent overwrite race conditions without database locks: Add a version number attribute to the item • Perform updates with a ConditionExpression • If another process updated the version first, DynamoDB throws ConditionalCheckFailedException, allowing the application to retry.

47
Senior#System Design#Astro

Query vs Scan: Why Production Scans Cause Catastrophic Outages.

Query: Finds items using the Primary Key (PK = :val AND SK >= :val2) • Scan (Anti-pattern): Scans every single item in the entire multi-gigabyte table sequentially before applying filter expressions.

48
Senior#System Design

Handling the 400KB Item Limit with S3 Offloading.

DynamoDB enforces a hard ceiling of 400 KB per item (including attribute names and values): The S3 Claim Check Pattern: Store small metadata attributes (IDs, status, timestamps) in DynamoDB, and store large payloads (PDF documents.

49
Senior#System Design#DynamoDB

DynamoDB Time to Live (TTL): Automatic Zero-Cost Deletion.

DynamoDB TTL marks items for deletion based on an epoch timestamp attribute: Background sweep processes automatically delete expired items within 48 hours • Zero Cost: TTL deletions consume zero WCU and do not impact table provisioned throughput!

50
Senior#System Design

Backup and Disaster Recovery: Point-in-Time Recovery (PITR).

Point-in-Time Recovery (PITR): Continuous automatic incremental backups for the past 35 days • On-Demand Backups: Full manual snapshots preserved indefinitely for compliance and auditing.