Interview Q&A · questions with model answers
DynamoDB Interview Questions
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked How do you approach data modelling in DynamoDB, and how is it different from relational design?
Start from the access patterns, not the entities: list every query the application needs (with filters, sort order and volume), then design keys and indexes so each pattern is a single GetItem or…
-
Most asked How do you calculate read and write capacity units?
One WCU writes one item of up to 1 KB per second; one RCU performs one strongly consistent read (or two eventually consistent reads) of up to 4 KB per second. Sizes round up, and transactional reads…
-
Most asked How do you enforce uniqueness on an attribute that is not the primary key, such as email?
DynamoDB only guarantees uniqueness of the primary key. Create a separate item whose key is the unique value (PK = EMAIL#[email protected]) and write it together with the user item in a…
-
Most asked What causes throttling in DynamoDB, and how should clients handle it?
Throttling happens when requests exceed provisioned capacity, a partition's limits (hot keys), on-demand scaling limits during a sudden surge, or a GSI's capacity (which back-pressures writes to the…
-
How do you make writes to DynamoDB idempotent?
Use conditional writes keyed on a natural or client-supplied ID (PutItem with attribute_not_exists(PK) on REQUEST#<id>), ClientRequestToken for transactions, and set-like updates (SET status = :x)…
-
How do you model a one-to-many relationship in DynamoDB?
Put the parent and its children in the same item collection: the same partition key (CUSTOMER#123) with sort keys that distinguish and order them (PROFILE, ORDER#<date>#<id>). One Query returns the…
-
What should you know about GSI projections and costs?
A GSI stores a copy of each projected item: KEYS_ONLY, INCLUDE (keys plus chosen attributes) or ALL. Larger projections cost more storage and write capacity; smaller ones may force a second GetItem…
-
How do you implement counters in DynamoDB?
Use an UpdateItem with ADD (or SET count = count + :inc), which increments atomically on the server without reading first. Note that the update is not idempotent: a retried request may increment…
-
How do you model many-to-many relationships in DynamoDB?
With the adjacency list pattern: store an item per relationship edge (PK = STUDENT#1, SK = COURSE#7) and add a GSI that inverts the keys (GSI1PK = COURSE#7, GSI1SK = STUDENT#1). Querying the table…
-
How would you store time-series data in DynamoDB?
Partition by entity and time bucket (DEVICE#42#2026-10-17) with a timestamp sort key, so each partition holds a bounded slice of data and queries for a time range read a few buckets. Use TTL or…
-
How do you reduce DynamoDB costs?
Match the capacity mode to the traffic shape (provisioned with auto scaling and reserved capacity for steady load), keep items and projections small, avoid scans and filter-heavy queries, use…
-
How do you secure access to DynamoDB?
Use IAM roles with least-privilege policies per table and action, fine-grained access control with conditions such as dynamodb:LeadingKeys (a user can only access items whose partition key is their…
-
How do you evolve a DynamoDB data model after launch?
Add new attributes freely (items are schemaless), add GSIs for new access patterns (DynamoDB backfills them automatically), and run backfill jobs when existing items need new keys or attributes.…
-
How do you model hierarchical data, such as locations or folders, in DynamoDB?
Encode the hierarchy in a composite sort key (COUNTRY#US#STATE#CA#CITY#SF) so begins_with queries return every item under any level of the tree: everything in the US, everything in California, and…
-
How do you add full-text or flexible search to data stored in DynamoDB?
Replicate the data to a search engine such as Amazon OpenSearch Service (using the zero-ETL integration, or a stream consumer) and run searches there, keeping DynamoDB as the source of truth for…
-
How do you export DynamoDB data for analytics?
Use the managed export to S3 (full or incremental exports from the PITR backup, in DynamoDB JSON or Ion format), which consumes no table capacity, and query the files with Athena, Glue, EMR or a…
-
How do you test code that uses DynamoDB?
Use DynamoDB Local (a downloadable or Docker version) or LocalStack for integration tests, create tables from the same infrastructure-as-code definitions you deploy, and test conditional-write…