Kafka vs Kinesis

Scaling, Ordering, Cost and When to Use Each

Kinesis Data Streams is the simpler choice on AWS for modest or spiky throughput with no servers to run. Apache Kafka is the stronger choice when you need exactly-once processing or compacted topics; it also fits long retention and many consumers, and it isn't tied to 1 cloud. Both order records only within a partition or shard.

Last updated: Proudly published by: Jeff Wahl13 min read

Kafka vs Kinesis: which one to choose

Choose Kinesis Data Streams when you're on AWS, your throughput is modest or spiky, and you want a stream with no servers to run. Choose Apache Kafka when you need exactly-once processing or compacted topics. Retention measured in weeks also points to Kafka, as do many independent consumers and a platform that's not tied to 1 cloud. Kafka runs self-managed or as a managed service: Amazon MSK on AWS, or Confluent Cloud and Redpanda.

The 2 share a model. Each is an append-only log split into ordered pieces, and order is guaranteed only inside 1 piece; Kafka calls the pieces partitions and Kinesis calls them shards. They differ in who owns capacity. A Kinesis shard is a fixed quota of 1 MB/s or 1,000 records a second in and 2 MB/s out, priced by the hour or by the gigabyte. A Kafka partition has no quota of its own, so its limit is whatever its broker can carry on the disks and network you give it.

That one difference explains most of the rest: how each scales for a traffic spike, what scaling does to the order of a key, what each costs at volume, and how much operations work you take on.

Kafka vs Kinesis at a glance

Apache Kafka
  • Who runs itYou, or MSK and others
  • Unit of scalePartition
  • Write capacitySet by your brokers
  • OrderingPer partition
  • Default retention168 hours
  • Maximum retentionUnlimited
  • DeliveryExactly-once available
  • Scale downNever fewer partitions
Kinesis Data Streams
  • Who runs itAWS
  • Unit of scaleShard
  • Write capacity1 MB/s per shard
  • OrderingPer shard
  • Default retention24 hours
  • Maximum retention365 days
  • DeliveryAt least once
  • Scale downMerge shards

Partitions vs shards: how each stores a stream

A Kafka topic is a set of partitions, each an ordered, replicated log on a leader broker and its followers. A producer that sends a key hashes it to pick the partition, so every record for that key lands in the same log in the order it was written. Consumers in a group split the partitions between them and track their position as 1 offset per partition, which they can rewind to replay.

A Kinesis stream is a set of shards. Each record carries a partition key, which Kinesis hashes with MD5 into a 128-bit number; every shard owns a contiguous range of that number line, and the record goes to the shard whose range holds its hash. Records in a shard carry sequence numbers, and consumers built on the Kinesis Client Library (KCL) keep their checkpoints and shard leases in DynamoDB tables.

On paper the models match. In practice the Kinesis shard is also the unit you pay for and the unit that throttles: a producer that pushes more than 1 MB/s or 1,000 records a second into 1 shard gets ProvisionedThroughputExceededException and must retry. A Kafka partition slows down only when its leader broker runs short of CPU, or of disk or network throughput, and the fix is a bigger or additional broker rather than a quota.

Prepare for the interview
01 / Open invite
02min.

Know Kafka vs Kinesis the way the interviewer who asks it knows it.

a Kafka vs Kinesis query, the same shape a screen would give you.
The diff against expected. Where ties broke. What you missed.
sandbox
1source → bronze → silver → gold
2 ingest : CDC + Kafka
3 transform : dbt + Airflow
4 serve : Snowflake
5
Execute your solution0.4s avg.
SnowflakeInterview question
Solve a Kafka vs Kinesis problem

Re-sharding time vs partition expansion: which is faster for traffic spikes

Compare the 2 ways to add capacity for a spike. A provisioned Kinesis stream reshards with UpdateShardCount: the call returns at once, the stream stays readable and writable while it is UPDATING, and the AWS API reference says the action could take a few minutes depending on the stream's size. Each call may at most double the shard count, and a stream may scale at most 10 times in a rolling 24 hours. When traffic on a 10 shard stream quadruples, reaching 40 shards takes 2 calls in a row (10 to 20 to 40), each waiting for the stream to return to ACTIVE.

Kafka partition expansion, and Redpanda partition expansion, which uses the same Kafka API, is faster as an operation: the alter command of kafka-topics.sh or rpk topic add-partitions changes metadata and copies no data. It also adds less. The new partitions are placed on the brokers you already have, so they add consumer parallelism, not broker throughput. Saturated brokers need more brokers, and a new broker carries no partitions until a reassignment copies replicas onto it. You usually throttle that copy so it does not starve live traffic.

The 2 also treat keys differently. A Kinesis split cuts a parent shard's hash range into 2 child ranges, so every key moves to exactly 1 child; the parent closes and stays readable, and a consumer that drains the parent before reading the children keeps each key in order. Kafka maps a key to hash(key) mod partitions, so a key whose hash is 14 moves from partition 2 of 4 to partition 6 of 8. Its older events stay where they were, and Kafka doesn't move them.

Left, a Kinesis split: the closed parent shard's hash range is cut into 2 child shards and key K lands in 1 child, so its order is kept. Right, Kafka going from hash mod 4 to hash mod 8 partitions: key K's old events stay in 1 partition and its new events go to another, so its order is splitLeft, a Kinesis split: the closed parent shard's hash range is cut into 2 child shards and key K lands in 1 child, so its order is kept. Right, Kafka going from hash mod 4 to hash mod 8 partitions: key K's old events stay in 1 partition and its new events go to another, so its order is split

So for handling traffic spikes, the answer depends on the bottleneck. Slow consumers are fixed fastest by adding Kafka or Redpanda partitions, provided no consumer relies on per-key order across the change. For an ingest bottleneck, a Kinesis stream in on-demand mode absorbs the spike sooner than either a provisioned reshard or a Kafka broker expansion. Kafka teams handle spikes the other way: they size partitions and brokers for the peak in advance, because scaling a running cluster is slow, and it never shrinks the partition count afterwards.

How Kinesis on-demand mode handles a traffic spike

On-demand mode removes shard planning: AWS splits shards for you and bills per gigabyte. A new on-demand stream starts with 4 MB/s of write capacity and can grow to 10 GB/s in the largest Regions. The rule that matters during a spike is about headroom: a stream accommodates up to 2 times the peak write throughput it saw in the previous 30 days, at once.

A stream whose 30 day peak is 40 MB/s can take a burst to 80 MB/s without throttling. If traffic jumps to 120 MB/s, the 40 MB/s above that ceiling is throttled for about 15 minutes while the stream adds shards, and producers must retry those writes. A launch or a backfill that you can see coming is better handled by switching the stream to provisioned mode at the size you need, or, under On-demand Advantage, by setting a warm throughput in advance.

Write throughput on 1 scale: a 30-day peak of 40 MB/s, a dashed 2x ceiling at 80 MB/s, and a spike to 120 MB/s whose part up to the ceiling is absorbed and whose part above it is throttled for 15 minutesWrite throughput on 1 scale: a 30-day peak of 40 MB/s, a dashed 2x ceiling at 80 MB/s, and a spike to 120 MB/s whose part up to the ceiling is absorbed and whose part above it is throttled for 15 minutes

On-demand also doesn't fix a hot key. Kinesis splits shards evenly and doesn't isolate the hash keys behind a busy shard, so a single partition key that needs more than 1 MB/s or 1,000 records a second is throttled in every mode. The same is true of a Kafka partition, whose single leader caps a hot key; the fix in both is a better key, often the natural key plus a small bucket number.

How many Kinesis shards you need for X events per second

A provisioned stream needs enough shards to cover writes, counted in both bytes and records a second, and to cover reads. Each shard takes 1 MiB of writes a second and serves 2 MiB of reads a second, and every consumer that reads with GetRecords shares that read capacity with the others, so a second consumer doubles the read requirement.

Take 5,000 events a second at 2 KiB each, read by 2 consumers. Writes are 10,000 KiB a second, which needs 10 shards. Reads are 20,000 KiB a second, which also needs 10. The record rate needs only 5. The stream needs 10 shards, and since partition keys never spread perfectly, leave headroom of a quarter or more on top.

Consumers change the arithmetic. Enhanced fan-out gives each registered consumer its own 2 MB/s per shard, pushed over HTTP/2, so read capacity stops being shared; it costs extra per consumer-shard hour and per gigabyte. Kafka has no per-partition read quota at all: any number of consumer groups can read the same partition, limited only by broker network and disk.

Kinesis shard count formula

Formula
shards = ceil(max(W / 1024, W × C / 2048, R / 1000))
W
Write bandwidth in KiB per second, events times average record size
C
Consumers reading with shared GetRecords throughput
R
Records written per second
5,000 events a second of 2 KiB, 2 consumers
Write shards10
Read shards10
Record shards5
Shards needed10

Ordering and exactly-once: Kafka vs Kinesis

Both order records within 1 partition or shard and nowhere else, so the partition key decides what is ordered. Key by order_id and every event of an order is in sequence; events of different orders interleave in whatever order they arrive.

Delivery is where they part. Since version 0.11, Kafka has an idempotent producer, which uses sequence numbers so a retry cannot write a duplicate, and transactions, which commit writes to several partitions and the consumer's offsets atomically. A job that transforms records from 1 topic into another can therefore be exactly once end to end inside Kafka, which is what Kafka Streams and Flink's Kafka sink rely on.

Kinesis is at least once, and AWS documents the 2 sources of duplicates. A producer that times out before its acknowledgement and retries writes the record twice, under 2 sequence numbers. A consumer restarted by a crash or a deploy resumes from its last checkpoint and processes records again, and so does one restarted by a reshard. Deduplication has to happen in the sink. Embed a unique id in each record and upsert on it, or write files whose names are fixed by the shard and the first sequence number, so a retry overwrites instead of duplicating.

In an interview, say where duplicates come from and where you remove them. If you claim exactly-once on Kinesis, name the idempotent sink that provides it; without that sink the answer is wrong, however the rest of the design looks.

Retention, replay and compaction

A Kinesis stream keeps records for 24 hours by default; you can raise retention to 365 days and pay for every hour past the first day. Replay means asking for a shard iterator at a timestamp or sequence number, per shard. Long retention on Kinesis is priced per gigabyte-month, so most teams land the stream in S3 and replay history from there.

Kafka's broker default is 168 hours, and retention can be any duration or size, or unlimited, bounded by the disks you pay for; tiered storage moves older segments to object storage so a long retention no longer means large broker disks. Replay is resetting a consumer group's offsets, a single command across all partitions.

Kafka also has log compaction, which Kinesis has no equivalent for: a compacted topic keeps at least the latest record for every key, so it works as a changelog that a new consumer can read from the start to rebuild current state. CDC pipelines lean on it, keeping the latest row image per primary key without keeping every update forever.

Consumers and fan-out

Every Kinesis consumer that polls with GetRecords shares a shard's 2 MB/s and its 5 read calls a second. AWS measures an average propagation delay of about 200 ms with 1 such consumer, rising to about 1,000 ms with 5. Enhanced fan-out pushes records to each registered consumer with about 70 ms of delay, and a stream allows 20 registered consumers, or 50 under On-demand Advantage.

A Kafka topic serves any number of consumer groups, and adding one costs only broker network and disk reads, which mostly hit the page cache for recent data. That makes Kafka the more natural hub when many teams read the same events: the warehouse loader and a fraud model can read 1 topic at their own pace, alongside a search indexer and an audit archive.

Consumer scaling is capped the same way on both. 1 KCL worker per application reads each shard, and 1 consumer per group reads each partition, so no consumer can spread its work wider than the partition or shard count. Rebalances move that ownership around; Kafka 4.0 made the newer consumer group protocol, which rebalances incrementally on the broker, generally available.

Kafka vs Kinesis cost at 100 MB/s

Kinesis prices are public, so the arithmetic is exact. Take 100,000 records a second of 1 KiB, roughly 100 MB/s, read by 1 consumer, every hour of a 730 hour month at US East prices. Provisioned mode needs 100 shards for the record rate: $1,095 of shard hours plus 262.8 billion PUT payload units at $0.014 per million, $3,679, for about $4,774 a month.

On-demand bills the same 250,626 GB by volume. On-demand Standard charges $0.08 per GB in and $0.04 per GB out, about $30,104 a month. On-demand Advantage, an account-level commitment of at least 25 MiB/s, bills $0.032 per GB in and $0.016 per GB out, which comes to about $12,030. For flat traffic, provisioned shards cost a fraction of on-demand; on-demand is worth its price when traffic is spiky enough that provisioning for the peak would leave most shards idle.

2 details move these numbers. On-demand rounds every record up to 1 KiB, so 200 byte events are billed as 1 KiB each, and provisioned PUT payload units are 25 KB, so batching small events into larger records with the Kinesis Producer Library cuts the PUT bill sharply in both modes.

Kafka has no list price, because you pay for what you run: brokers sized for the peak, disks for retention times the replication factor, and on AWS the data transfer between Availability Zones that replication and cross-zone consumers generate. A managed service such as MSK or Confluent Cloud adds its margin in return for running it. Compare the 2 on the same steady volume with your own broker quote, and count the engineers who operate the cluster as part of its price.

Monthly Kinesis cost for a steady 100 MB/s, by capacity mode

Provisioned
$4,774
On-demand Advantage
$12,030
On-demand Standard
$30,104

100,000 records a second of 1 KiB, 1 consumer, 730 hours, US East prices

Operating Kafka vs Kinesis

With Kinesis your work is choosing partition keys that spread load and sizing or scaling the shards, plus handling throttling and duplicates in your producers and consumers. You run no brokers, so their disks and upgrades are not yours to own, and neither is replication.

Self-managed Kafka leaves you the whole cluster. You size the brokers and set the replication factor along with min.insync.replicas. Disk growth and rolling upgrades are yours, as is partition reassignment when you add brokers, and you monitor under-replicated partitions and consumer lag. Kafka 4.0, released in March 2025, removed ZooKeeper, so a cluster now keeps its metadata in its own KRaft controllers and there is 1 less system to run.

Between the 2 sit the managed Kafka services. Amazon MSK runs the brokers inside your VPC while you still choose partitions and broker sizes; Confluent Cloud and Redpanda Cloud sell throughput and take the cluster off your hands. Redpanda is a separate implementation of the Kafka API in C++. Kafka clients work against it unchanged, and it handles partitions and keys the way Kafka does, partition expansion included.

When to use Kafka and when to use Kinesis

Use Kinesis when the platform is AWS, throughput is in the tens of MB/s or is hard to predict, a replay window of a day to a week covers your recovery plans, and the consumers are a handful of AWS services such as Lambda and Firehose, or Managed Service for Apache Flink. The team ships a stream on day 1 and never pages for a broker.

Use Kafka when many teams build on the same stream: exactly-once pipelines, compacted changelog topics for CDC, retention long enough to rebuild a table from the log, dozens of consumer groups, Kafka Connect for sources and sinks, or a deployment across clouds and data centers. If you want those semantics without staffing a cluster, get them from MSK on AWS, or from Confluent Cloud or Redpanda.

A useful test is the spike you expect. If traffic can double in minutes with no warning, Kinesis in on-demand mode takes up to 2 times its recent peak with no action from you. If the peak is known, Kafka sized for it costs less at volume and never throttles below that size. The batch vs streaming guide covers the earlier question of whether the pipeline should stream at all.

Kafka vs Kinesis in a data engineering interview

The comparison comes up in the design round, rarely as a trivia question and usually as a follow-up: you chose a stream for clickstream or CDC events, and the interviewer asks why that one, how you would key it, what happens when traffic quadruples, and how you avoid double counting. Strong answers tie each choice to a number: the shard or partition count from the throughput, the retention from the replay plan, the delivery guarantee from the sink.

Practise the design end to end with the data pipeline practice problems, which have you lay out the queue and the transforms on a canvas and decide where the quality gates go, and check your reasoning against the data pipeline interview questions interviewers ask about streaming. For the broker internals that follow a Kafka answer, such as ISR and consumer group rebalances or how transactions commit, work through the Kafka interview questions, and see how the round is run in the data engineering system design round guide.

Kafka vs Kinesis FAQ

Is Kafka or Kinesis better?+
Neither wins everywhere. Kinesis is the better default for a team on AWS with modest throughput, a 1 to 7 day replay window and no wish to run brokers. Kafka is the better choice when you need exactly-once processing inside the stream, compacted topics, long retention, many independent consumers or a runtime outside AWS. It is also the choice when the pipeline already runs on Kafka Connect or Kafka Streams, or reads through the Flink Kafka connectors.
Which scales faster for a traffic spike, Kinesis or Kafka?+
A Kinesis stream in on-demand mode absorbs up to 2 times its 30 day peak at once, which beats any manual step. A provisioned stream can at most double per UpdateShardCount call, and each call can take a few minutes. Adding Kafka or Redpanda partitions finishes almost at once, but it adds no broker capacity. If the brokers are saturated, you have to add brokers and then move replicas onto them, and that copy takes longer than a Kinesis reshard.
What's the right shard count for X events per second on Kinesis?+
Take the largest of 3 numbers: events per second times average record size in KiB divided by 1,024, the same write bandwidth times the number of shared consumers divided by 2,048, and events per second divided by 1,000. For 5,000 events a second of 2 KiB read by 2 consumers, that is 10 shards.
Does Kinesis support exactly-once delivery?+
No. Kinesis delivers at least once: a producer retry after a timeout can write a record twice, and a consumer that restarts from its last checkpoint reprocesses records. Exactly-once results come from the sink, by writing with a unique key or overwriting deterministic files. Kafka has an idempotent producer and transactions, so a job that consumes from 1 topic and produces to another can be exactly once inside Kafka.
What does Kinesis cost at 100 MB/s?+
For a steady 100,000 records a second of 1 KiB, read by 1 consumer, US East prices give about $4,774 a month in provisioned mode, $12,030 in On-demand Advantage and $30,104 in On-demand Standard. On-demand pays for not planning capacity, which is worth it for spiky traffic and expensive for flat traffic.
Can I move from Kinesis to Kafka later?+
Yes, and teams do, usually by running both for a while: a bridge consumer reads the Kinesis stream and produces to a Kafka topic with the same partition key, consumers move over 1 at a time, and producers switch last. The work is in the code rather than the data. Consumers built on the KCL keep checkpoints in DynamoDB and producers call the Kinesis SDK, so keep that code behind a thin interface from the start.
Which is harder to operate, self-hosted Kafka or Kinesis?+
Self-hosted Kafka, by a wide margin. With Kinesis you pick partition keys and size the shards, and your code has to retry on throttling and handle duplicates. Self-hosted Kafka adds broker sizing, replication settings, disk growth, rolling upgrades, partition reassignment when you add brokers, and alerts on under-replicated partitions and consumer lag. Amazon MSK takes much of that work back, and Confluent Cloud or Redpanda Cloud take back more.
Do data engineering interviews ask about Kafka vs Kinesis?+
Rarely as a standalone question. It comes up as a follow-up in the system design round, after you place a stream in a design: why that one, how you key it, what happens when traffic quadruples, and how you avoid double counting in the sink.
Is Amazon MSK the same as Kinesis?+
No. Amazon MSK runs Apache Kafka brokers for you, but you still size the brokers and set each topic's partition count and replication factor, and your clients use the Kafka protocol. Kinesis Data Streams is a different service, with its own API and its own shard limits. MSK is the way to get Kafka semantics on AWS without running the brokers yourself.
02 / Why practice

The candidate who gets the offer

  1. 01

    Reading a solution is not the same as writing one

    Every engineer who has frozen on a query they had read a dozen times knows the gap. The only preparation that closes it is producing the answer yourself, under time, before the interview does it for you

  2. 02

    76% of hiring managers reject on the coding task, not the resume

    From HackerRank's 2024 Developer Skills Report. Candidates who look strong on paper still fail the live screen if they haven't done timed, executable practice

  3. 03

    System design comes down to the calls you defend out loud

    Ingestion, batch vs streaming, the bronze/silver/gold layers, idempotency, backfill and replay. Sketching the pipeline and naming the failure modes is the signal, not the boxes

Related guides