DynamoDB basics

2 min read



  • Table = Table
  • Item = Row
  • Attribute = Column (but this is schemaless)

Primary Key

Primary key can be one of

  1. Partition Key. Single attribute. Hash(Partition Key) determines partition.
  2. Partition Key + Sort key. All items with the same partition key value are stored together, in sorted order by sort key value.

Primary key attributes have to be scalar - string, number or binary.

Secondary Index

  • Global secondary index. Basically a copy of the table with a different Primary key.
  • Local secondary index. Same partition key, different sort key.


Near real time events when items are added/updated/deleted. Can combine with Lambda.


Mostly obvious - link

Read consistency

When your application writes data to a DynamoDB table and receives an HTTP 200 response (OK), the write has occurred and is durable. The data is eventually consistent across all storage locations, usually within one second or less.

  • Eventually Consistent Reads - When you read data from a DynamoDB table, the response might not reflect the results of a recently completed write operation. The response might include some stale data. If you repeat your read request after a short time, the response should return the latest data.
  • Strongly Consistent Reads - When you request a strongly consistent read, DynamoDB returns a response with the most up-to-date data, reflecting the updates from all prior write operations that were successful. Issues:
    • Network outage/delay - 500
    • Higher latency
    • Not supported on global secondary indexes
    • Uses more throughput capacity