Show Menu
Cheatography

DynamoDB Cheat Sheet (DRAFT) by

AWS DynamoDB cheatsheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Basics

Table
same as SQL table
Item
a single record (row)
Attribute
field of an item (column)
Partition Key
PK, determines partition (Hash Key)
Sort Key
(Optional) key to sort items (Range Key)
Primary Key
Partition Key OR Partition + Sort Key

Provis­ioning

RCU
Read Capacity Unit
1 RCU =
1 strongly consistent read per second
1 RCU =
two eventually consistent reads per second
WCU
Write Capacity Unit
1 WCU =
1 write per second for item up to 1kb
Throttling
requests are blocked due to capacity limit
On-Demand
pay per request
Provis­ioned
you define WCUs and RCUs
DAX
fully managed in-memory write through cache
not ideal for
strongly consistent reads.
not ideal for
write intensive, not read intensive (it's a cache)
 

Querying

Query Reads items for a specific partition key
- tables require a composite key for query
Scan Reads entire table ( ⚠️ heavy on cost)
- returns all attr. by default. Projec­tEx­pre­ssion to limit

Streams

DynamoDB Streams - set up a Lambda triggered every time data is modified in a table. Streams do not consume RCUs.
Records are available for 24 hours

GSI (global secondary index)

Index with a different partition key and sort key
Only eventual consis­tency (no strong consis­tency)
Additional RCU and WCU needed
⚠️Changes to table must be done to GSI
GSI can scale indepe­ndently of main table => high throughput for indexed attr.

Transa­ctions

Transa­ctions - can query multiple tables at once, all or nothing