Kinesis Core Vocabulary: Shards, Partition Keys, Ordering, Retention, Replay
coreintermediateA Kinesis data stream is a set of shards; each shard holds an ordered sequence of records. Every record carries a partition key, and Kinesis hashes that key to decide which shard the record lands on. Records with the same partition key always land on the same shard, in the order they arrived. A stream keeps records for 24 hours by default (up to 365 days), so a consumer can replay history instead of only seeing new data.
Think of it as
Think of a stream as several parallel conveyor belts (shards). The partition key is the label on each box that decides which belt it goes on. Boxes on the same belt stay in the order they were placed — that per-belt order is the only ordering guarantee Kinesis makes. Nothing orders boxes across belts.
What we're doing: See why two records with the same partition key stay in order, but records with different keys have no ordering relationship.
- 1
- user-42 hashes into shard-0's hash key range, so this record lands there.
- 2
- Same partition key, same shard — and its sequence number is higher, so a shard-0 consumer always sees e1 before e2.
- 3
- user-7 hashes to a different shard. Kinesis makes no promise about how e3 interleaves with shard-0's records in wall-clock time.
Why this works: Kinesis Data Streams scales by spreading records across shards, so it can only afford to order records within a shard — ordering across the whole stream would require every shard to coordinate on every write, which would remove the parallelism that makes shards useful in the first place.
Assuming Kinesis orders records across the entire stream
Wrong
Better
What you see: Events for two different entities appear interleaved in an order that does not match wall-clock arrival, and a consumer reading multiple shards in parallel sees them out of the sequence the application assumed.
Why: The sequence number that establishes order is assigned per shard, and different shards are read independently by consumers — there is no cross-shard sequence to fall back on.
- Record + partition key
- leads to MD5 hash of partition key (hashed)
- MD5 hash of partition key
- leads to Shard (ordered sequence) (maps to a hash key range)
- Shard (ordered sequence)
Remember: A stream is a set of shards; a partition key's hash decides the shard. Ordering holds only within a shard, for one partition key. Retention defaults to 24 hours, extendable to 365 days — that window is what makes replay possible.
See also: consumers scaling and backpressure · streaming vs sqs vs eventbridge

