A guide to Amazon DynamoDB: Access-Pattern Modeling and Cost

How to work through this course

Seven modules, about eighty hours. It is marked advanced, and the difficulty is not the API - the API is small - it is the design discipline.

Write the access pattern list before you create a table, every time, without exception. In a file, numbered, each with the key condition it will use. This feels like unnecessary process for the first two tables you build and then it saves you a migration. The reason it matters more here than elsewhere is structural: in a relational database a query you did not anticipate is a new WHERE clause, and here it may be a new index, a new access pattern on an existing index, or a table rebuild. The list is the schema's specification.

Two numbers to watch, always. ConsumedCapacity - turn ReturnConsumedCapacity: "INDEXES" on in development and leave it on, because capacity is the billable unit and the honest way to compare two designs. And ScannedCount against Count on anything that filters, because the gap between them is money you spent on items you threw away.

What to unlearn if you come from SQL. Normalisation, as a default. Joins, which do not exist. The idea that the schema is about entities rather than about queries. And the instinct that a filter reduces work - here it reduces the result, not the cost, and that single misunderstanding accounts for a remarkable share of surprising DynamoDB bills.

Develop against DynamoDB Local and verify in the cloud. Local is free, offline, instant to reset and supports transactions and indexes. What it cannot show you is throttling behaviour, adaptive capacity, real latency, GSI propagation delay or a bill - so the laboratories in Modules 4, 5 and 6 need a real account. The free tier covers this course comfortably, and every laboratory includes teardown steps for a reason.

Do the capacity arithmetic by hand once. Module 4 asks you to calculate the RCUs and WCUs for your own item sizes and then reconcile with the actual ConsumedCapacity. That reconciliation is the exercise, and it is the moment DynamoDB cost stops being mysterious. After it, you can look at a proposed schema and estimate what it will cost, which is a genuinely rare skill.

The sparse index is the technique to internalise. "All pending orders" as a one-RCU query against an index of ten items, rather than a scan of two hundred thousand, by setting an attribute only on the items you want in the index and removing it when they leave. Once you see it, you will find uses for it in every DynamoDB schema you touch, and it is the clearest demonstration that in DynamoDB you design the index to fit the query rather than the reverse.

Be honest about single-table design. It is idiomatic, it is genuinely efficient, and it is harder to read and harder to maintain. Learn it properly - the capstone needs it - and keep the judgement that two or three tables for entities that never appear in the same query is not a failure. The worst outcome is a half-committed single-table schema that nobody on the team can explain.

What to skip on a first pass. DAX, the in-memory accelerator - useful and a narrower case. PartiQL for DynamoDB, which lets you write SQL-ish queries and does not change the underlying cost model, so it mostly hides the thing you need to see. Zero-ETL to Redshift and OpenSearch integrations. Kinesis Data Streams for DynamoDB as distinct from DynamoDB Streams. Import from S3. And the deeper internals of partition splitting - understand that partitions exist, have limits, and split, and move on.

Where to look things up. The official documentation is comprehensive and its Best Practices section is unusually good. Alex DeBrie's DynamoDB Book is the standard reference on single-table design and worth buying. The AWS re:Invent talks on advanced DynamoDB design - particularly Rick Houlihan's - are the clearest explanation of why the model is the way it is. And the pricing calculator will become familiar.

One closing thought. DynamoDB is the database in this programme that most rewards thinking before typing and most punishes the opposite. There is no query planner to rescue a careless query, no index you can add retroactively to a key you chose wrong, and no gradual degradation - it is fast and cheap, or it is throttled and expensive, and which one you get was decided in the design. That makes it an excellent teacher: the discipline it demands is good practice everywhere, and here you cannot skip it.

dynamodb database