AWS Streaming Primitives: Kinesis Data Streams and Amazon MSK
Kinesis Data Streams and Amazon MSK are AWS's managed implementations of the commit-log pattern — each trades configurability for managed operational burden. This article maps Kinesis shards to Kafka partitions, implements Enhanced Fan-Out for dedicated consumer throughput, and builds the decision model for choosing between Kinesis, MSK Provisioned, MSK Serverless, and self-managed Kafka.
Messaging at Cloud Scale
AWS Streaming Primitives: Kinesis Data Streams and Amazon MSK
The analytics team needs a real-time clickstream pipeline ingesting 50,000 events per second from a web application, with two downstream consumers: a Lambda that feeds a live dashboard and a Flink job that produces hourly aggregations. The infrastructure team must choose between three options: self-managed Kafka on EC2, Amazon MSK, and Kinesis Data Streams. The Kafka team has expertise but no desire to manage broker VMs. Flink expects the Kafka API. But the dashboard Lambda team wants the simplest possible AWS-native integration.
This is the canonical MSK-vs-Kinesis decision — not a question of which is better, but which fits the team's API expectations, operational model, and throughput shape.
Series positioning: This is Part 2 of Messaging at Cloud Scale. Both Kinesis and MSK implement the commit-log pattern from Series 1 Part 2 (Queues vs Logs). This article maps the Kafka concepts from Part 3 (Kafka Internals) to their AWS-managed equivalents. Prerequisite: familiarity with Kafka partitions, consumer groups, and the producer-broker-consumer lifecycle.
1. Kinesis Data Streams
1.1 Shards: The Kinesis Partition
A Kinesis shard is the direct equivalent of a Kafka partition — the unit of ordered, parallelism-bounded processing:
| Concept | Kafka | Kinesis |
|---|---|---|
| Ordering unit | Partition | Shard |
| Throughput per unit | Variable (depends on broker) | 1 MB/s write, 2 MB/s read |
| Scale unit | Partition count (add, never remove) | Shard count (split/merge) |
| Retention | Configurable (default 7 days) | 24 hours (default), up to 365 days |
| Consumer groups | Multiple, independent | GetRecords (shared) or EFO (dedicated) |
| Partition key | message.key |
PartitionKey (hash → shard assignment) |
1.2 Shard Count and Capacity Planning
UpdateShardCount (resharding) triggers a 24-hour cool-down period during which you cannot reshard again. Model peak throughput before provisioning — Kinesis punishes reactive scaling far more than Kafka, where you can add partitions immediately. Provision 2× your expected peak from the start.
1.3 Standard vs Enhanced Fan-Out Consumers
Use Enhanced Fan-Out whenever you have more than one high-throughput consumer on the same stream. Standard GetRecords splits the 2 MB/s read bandwidth across all consumers on a shard — with two consumers at 50% throughput each, lag accumulates when ingest is near the shard limit. EFO eliminates this by giving each registered consumer a dedicated 2 MB/s pipe per shard, at additional cost ($0.015/shard-hour for EFO consumers).
2. Amazon MSK
2.1 MSK Architecture Modes
Amazon MSK is managed Kafka — AWS provisions and operates the broker VMs, ZooKeeper (or KRaft), and storage. Your application uses the standard kafkajs client unchanged:
2.2 MSK Provisioned vs MSK Serverless vs Self-Managed
| Dimension | Self-Managed Kafka | MSK Provisioned | MSK Serverless |
|---|---|---|---|
| Kafka API compatibility | Full | Full | Full (some limits) |
| Broker management | You | AWS | AWS |
| Schema Registry | You run it | You run it on EC2 | You run it on EC2 |
| Kafka Connect | Self-host | MSK Connect (managed) | Not supported |
| ksqlDB / Kafka Streams | Yes | Yes | Limited |
| Storage | Self-managed | EBS (provisioned IOPS) | Unlimited (auto-scales) |
| Max throughput | Hardware limit | 60 Gbps per cluster | Auto |
| Min cost | EC2 cost (~$200/mo+) | $0/hr + $0.10/GB processed | |
| Cold start | None | None | None (warm) |
| Best for | Ops team, full control | Steady high-throughput | Unpredictable / dev workloads |
2.3 MSK IAM Authentication
3. The Decision Framework
Summary
| Concept | Rule |
|---|---|
| Enhanced Fan-Out | Kinesis Enhanced Fan-Out eliminates the shared 2 MB/s read throughput ceiling — every consumer registered for EFO gets a dedicated 2 MB/s pipe; use it whenever you have more than one high-throughput consumer on the same stream. |
| MSK vs Kinesis | MSK is the right choice when you need Kafka API compatibility (kafkajs, Schema Registry, Kafka Connect, ksqlDB) without managing broker VMs; Kinesis is right when you want the simplest possible AWS-native integration with zero Kafka knowledge required. |
| Shard provisioning | Kinesis shard count is the primary scale knob — but each UpdateShardCount call triggers a 24-hour cool-down; model your peak throughput before provisioning, not after. |
What's Next
Part 3: The Outbox Pattern, CDC, and Exactly-Once DB-to-Broker Writes solves the hardest problem in event-driven architecture: publishing an event to a broker atomically with a database write, without a distributed transaction. The Transactional Outbox pattern and Debezium-based Change Data Capture are the two production-proven approaches.
This article was developed with AI-assisted deep search, specification cross-referencing, and technical research synthesis.