Event stream (log)
Amazon Kinesis Data Streams / Amazon MSK
An ordered, replayable, partitioned log of events that many consumers read at their own pace.
In a monolith
Rare
Monoliths seldom need one; an audit or outbox table plays the role.
In a distributed system
Event backbone
Ordered per partition key, retained for days, replayable — used for CDC, analytics pipelines, activity feeds and event sourcing.
On AWS
Amazon Kinesis Data Streams / Amazon MSK
Kinesis: managed shards with ordering per partition key. MSK: managed Apache Kafka. Firehose delivers streams into S3, Redshift or OpenSearch.
- Kinesis Data Streams$$Shards with tight AWS integration
- Amazon MSK (Kafka)$$$Kafka ecosystem, long retention, consumer groups
- Amazon Data Firehose$Managed delivery to S3 / Redshift / OpenSearch
- Reach for it when
- High-volume events need ordering per key, replay, or several consumers reading the same history.
- What it costs you
- Partitioning decides ordering and throughput — hot keys hurt
- Consumers manage offsets/checkpoints
- More to operate than a plain queue
- When it dies
- Producers buffer or fail; consumers resume from their last checkpoint when it returns — nothing is lost within retention.
Interview follow-ups
Kafka/Kinesis vs SQS?
A queue deletes a message once processed and gives it to one consumer. A log keeps events for a retention window; many consumer groups read independently, in order per partition, and can replay.
How is ordering guaranteed?
Only within a partition/shard — pick the partition key so related events (same order, same user) land together.
Connection rules
It talks to
- App server
- Service
- Worker
- Object storageOnly when: Managed delivery (e.g. Data Firehose → S3) for archiving and analytics.
- SearchOnly when: Managed ingestion (e.g. OpenSearch Ingestion) indexing straight from a stream.
Gets traffic from
- App server
- Service
- Worker
- Realtime server
- SQL database
- NoSQL store
- API gatewayOnly when: AWS API Gateway service integrations (e.g. POST /events → SQS, Kinesis or EventBridge) for ingestion and webhooks — fine when there’s no business logic beyond request mapping.
Never
- Event stream → SQL databaseStreams don’t run code. A consumer reads the records and does the write or call.
- Event stream → Read replicaStreams don’t run code. A consumer reads the records and does the write or call.
- Event stream → NoSQL storeStreams don’t run code. A consumer reads the records and does the write or call.
- Event stream → CacheStreams don’t run code. A consumer reads the records and does the write or call.
- Event stream → DB proxyStreams don’t run code. A consumer reads the records and does the write or call.
- Event stream → Third-party APIStreams don’t run code. A consumer reads the records and does the write or call.
- Clients → Event streamClients can’t be trusted to enqueue directly — there’s no validation or auth in between.