SynfraCore
Synfracore
Start Learning
Navigation

Academies

Platform

RoadmapsLabsCertificationsInterviewPYQsAI AssistantCareer
Start Learning Free Learning Roadmaps

DynamoDB β€” Overview

What it is, why it matters, architecture and key concepts

πŸ“„
Last updated Aug 2026
Expert Content

DynamoDB Overview

Before you start: basic AWS familiarity helps but isn't required. No prior NoSQL experience is assumed β€” every concept below is explained from scratch.

What is DynamoDB?

Amazon DynamoDB is a fully managed, serverless, NoSQL key-value and document database provided by AWS. It delivers single-digit millisecond performance at any scale and is used by companies like Amazon, Lyft, Airbnb, and Samsung for applications requiring high-throughput, low-latency data access.

Why This Exists (The Hook)

Running a database that can reliably handle Amazon's own retail traffic β€” spikes during a sale, millions of requests per second, zero tolerance for a slow checkout β€” used to mean a team of engineers dedicated to sharding, replicating, and capacity-planning a database cluster by hand. DynamoDB exists because Amazon built exactly that operational muscle internally, then productized it: you define a table and a key, and AWS handles the sharding, replication, and scaling behind the scenes β€” you never provision a server or tune a query planner.

Analogy β€” Think of a traditional database like owning and driving your own delivery truck β€” full control over the route, but you're also responsible for maintenance, fuel, and hiring a backup driver if yours calls in sick. DynamoDB is like a fully-staffed courier service you just hand packages to: you specify the destination (the key), and the service handles routing, backup drivers, and scaling up its fleet during a busy season β€” you just pay per package delivered (per request).

Try it (2 minutes) β€” Reason through why a "hot partition" is a real problem without running anything: DynamoDB spreads data across partitions based on a hash of the partition key. If you designed a table using date (like "2026-08-28") as the partition key for an app logging every user action platform-wide, every single write for today would hash to the same partition, no matter how many users are active. What happens to that one partition's throughput ceiling when your whole platform's traffic funnels through it, compared to using something higher-cardinality like user_id?

Core Concepts

Table / Item / Attribute
Like a SQL table/row/column, but attributes are flexible per item
Partition Key
Hashed to determine storage location -- design for high cardinality
Sort Key
Determines order within a partition -- enables range queries
Capacity Mode
Provisioned (RCU/WCU) or On-Demand (pay per request)
TABLE: collection of items (like a table in SQL)
ITEM: a record in the table (like a row, up to 400KB)
ATTRIBUTE: a data element (like a column, but flexible β€” each item can differ)

PRIMARY KEY (uniquely identifies every item):
  Simple (hash): partition key only
    aws_region -> no sort key
  Composite (hash + range): partition key + sort key
    user_id (PK) + order_date (SK) -> enables range queries within a user

PARTITION KEY: determines which partition stores the item (hashed)
  Design for high cardinality β†’ even distribution β†’ avoid hot partitions
  
SORT KEY: determines order within a partition
  Enables: >, <, BETWEEN, begins_with queries on sort key
  Enables: rich query patterns within a single partition

CAPACITY MODES:
  Provisioned: specify Read Capacity Units (RCU) and Write Capacity Units (WCU)
    1 RCU = 1 strongly consistent read/sec of ≀4KB item (or 2 eventually consistent)
    1 WCU = 1 write/sec of ≀1KB item
    Use with Auto Scaling for variable traffic
  On-Demand: pay per request, no capacity planning
    Use for: unpredictable traffic, new applications
Provisioned
Specify RCU/WCU, use with Auto Scaling for variable traffic
On-Demand
Pay per request, no capacity planning -- unpredictable traffic, new apps

Key Operations

bash
# Create table
aws dynamodb create-table \
  --table-name Orders \
  --attribute-definitions \
    AttributeName=UserId,AttributeType=S \
    AttributeName=OrderDate,AttributeType=S \
  --key-schema \
    AttributeName=UserId,KeyType=HASH \
    AttributeName=OrderDate,KeyType=RANGE \
  --billing-mode PAY_PER_REQUEST

# Put item
aws dynamodb put-item --table-name Orders \
  --item '{"UserId":{"S":"user-123"},"OrderDate":{"S":"2025-06-24"},"Total":{"N":"99.99"}}'

# Get item (by exact primary key)
aws dynamodb get-item --table-name Orders \
  --key '{"UserId":{"S":"user-123"},"OrderDate":{"S":"2025-06-24"}}'

# Query (by partition key, optionally filter by sort key)
aws dynamodb query --table-name Orders \
  --key-condition-expression "UserId = :uid AND OrderDate BETWEEN :start AND :end" \
  --expression-attribute-values '{":uid":{"S":"user-123"},":start":{"S":"2025-01-01"},":end":{"S":"2025-12-31"}}'

# Scan (all items β€” expensive, avoid in production)
aws dynamodb scan --table-name Orders \
  --filter-expression "Total > :amount" \
  --expression-attribute-values '{":amount":{"N":"50"}}'

Advanced Features

GLOBAL SECONDARY INDEX (GSI):
  Alternative access patterns (different PK + SK)
  Eventual consistency only | separate RCU/WCU from table
  Up to 20 GSIs per table

LOCAL SECONDARY INDEX (LSI):
  Same partition key, different sort key
  Must be created at table creation
  Up to 5 LSIs; shares table RCU/WCU; strongly consistent reads possible

STREAMS:
  Time-ordered sequence of item-level changes (24-hour retention)
  Trigger Lambda functions β†’ event-driven patterns
  Use for: cross-region replication, audit logs, cache invalidation

GLOBAL TABLES:
  Multi-region, multi-active replication
  DynamoDB Streams + replication across selected regions
  Conflict resolution: last-writer-wins based on timestamps

TRANSACTIONS:
  TransactGetItems / TransactWriteItems
  ACID across up to 100 items in same or different tables
  Use for: order placement, financial transfers

TTL (Time to Live):
  Set expiration timestamp attribute on items
  DynamoDB automatically deletes expired items
  No charge for TTL deletes; items removed within 48 hours of expiry

Study Resources

β€’DynamoDB documentation (docs.aws.amazon.com/dynamodb) β€” official
β€’The DynamoDB Book (Alex DeBrie) β€” best single resource for DynamoDB design
β€’DynamoDB Design Patterns (AWS re:Invent sessions on YouTube) β€” real examples
β€’AWS SAA-C03 / DAS-C01 β€” certifications that include DynamoDB heavily
Share:
Join our Community
Daily tips, job alerts, interview help β€” join engineers learning together
β†’
Up Next
βœ…
DynamoDB β€” Prerequisites
What to know or set up before starting
Also Worth Exploring
← Back to all DynamoDB modules
Prerequisites β†’