DynamoDB Streams (CDC)

What Makes This CDC, Not Just a Log

DynamoDB Streams captures an ordered sequence of item-level modifications (INSERT, MODIFY, REMOVE) for a table. The critical property: stream record generation happens synchronously as part of the write's commit path — if the write succeeded, the stream record for it is guaranteed to exist. This is what makes it usable as a real change-data-capture mechanism (safe to build replication, search indexing, or audit logging on top of) rather than a best-effort notification you might occasionally miss.

Shards: Structure and Lineage

Stream records are grouped into shards, which map closely to the table's own partitions — when a table partition splits (see Partitioning and Request Routing), its corresponding stream shard splits too, producing child shards with a recorded parent/child lineage.

Partition P (getting hot) splits into P1, P2   [Section 1, "split for heat"]
        │
        ▼
Stream shard S (parent) splits into S1, S2 (children)
        │
        │  S1.ParentShardId = S
        │  S2.ParentShardId = S
        ▼
Consumer MUST fully process S before starting S1 or S2,
or item-level ordering guarantees break.
  • Shards are ephemeral — created and retired automatically as the underlying table reshapes.
  • DescribeStream does not guarantee shards are returned in chronological order — a consumer that wants a correct processing order must walk the ParentShardId lineage itself, not trust list order.
  • All updates to the same partition key are guaranteed to land in the same shard, in the exact order they were applied — this is the ordering guarantee, and it is scoped to one item's key, not the table.

What Ordering Does and Doesn't Guarantee

Guaranteed Not guaranteed
Changes to item with PK=user#123 appear in the stream in the exact order they were committed Changes to user#123 and user#456 have any defined relative order to each other, even if one was committed "before" the other in wall-clock time
Exactly-once delivery per record within a shard Exactly-once processing by your consumer — retries after a consumer-side failure can reprocess records; consumers must be idempotent

Retention and the Poison-Pill Problem

Stream records are retained for 24 hours and then permanently deleted, whether consumed or not. Consumption is typically via: - Lambda trigger (Lambda's poller reads shards on your behalf, invokes your function in batches, and by default retries a failed batch — with configurable "bisect on error" to isolate a single bad record). - Kinesis Adapter (KCL) for custom consumers needing checkpointing control. - "Kinesis Data Streams for DynamoDB" — a related but distinct feature that pipes the same change data into an actual Kinesis stream, buying up to 1-year retention and multiple independent consumers, at the cost of Kinesis's own pricing and operational model.

TTL Deletes: A Stream Record With No Human Behind It

DynamoDB's Time to Live (TTL) feature automatically deletes items past a per-item expiry timestamp attribute, as a background housekeeping process — not a client request. These TTL-driven deletes do generate REMOVE stream records, identical in shape to a client-issued delete, but tagged with userIdentity.principalId = "dynamodb.amazonaws.com" so a consumer can distinguish "this item expired" from "a user explicitly deleted this item."

Common Uses of Streams Beyond Global Tables

  • Search indexing — propagate every item change into OpenSearch/Elasticsearch, keeping a full-text-searchable index in sync with an operational table that itself has no query flexibility (see What Is DynamoDB and Single-table design).
  • Materialized aggregates — a Lambda consumer maintains a separate, pre-aggregated rollup item (e.g., "total orders today," a leaderboard summary assembled from the write-sharded shards of the Adaptive Capacity and Hot Partitions part) updated incrementally as changes stream in, rather than computed on read.
  • Cross-service event propagation — in a microservices architecture, Streams can be the trigger that publishes a domain event ("OrderShipped") to other services, without those services needing direct DynamoDB access or coupling to the owning service's schema.
  • Audit logging — an durable, ordered record of every change for compliance, independent of the table's own point-in-time-recovery window.

Every one of these consumers inherits the same at-least-once, per-item-ordered-only delivery contract — meaning every Streams consumer must be written to be idempotent, because Lambda's retry behavior (and any consumer's own restart-from-checkpoint behavior) can and will redeliver a record more than once under ordinary failure conditions, not just exotic ones.

Why This Matters Beyond CDC-the-Feature

DynamoDB Streams is not just a feature you opt into for downstream search-indexing or audit-logging pipelines — it is the literal transport mechanism underneath Global Tables (see Global Tables). Understanding its ordering and retention guarantees here is a prerequisite for reasoning correctly about cross-region replication behavior next.