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 |
Provisioning
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 |
Provisioned |
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. ProjectExpression 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 consistency (no strong consistency) |
Additional RCU and WCU needed |
⚠️Changes to table must be done to GSI |
GSI can scale independently of main table => high throughput for indexed attr. |
Transactions
Transactions - can query multiple tables at once, all or nothing |
|