AWS in 1 Min · Episode 134

Amazon Kinesis Data Streams explained

Real-time data, kept and replayed. Watch the one-minute video, then read the details.

David Gomez1:13 video · 2 min read

"A data stream is just a queue." Both move messages from producers to consumers, so they look alike on a diagram. But they behave very differently. A queue such as Amazon SQS hands each message to one worker, which deletes it once processed. A stream such as Amazon Kinesis Data Streams keeps every record for a retention period, so many applications can read the same data, each at its own pace, and even read it again.

What Kinesis Data Streams does

Kinesis Data Streams ingests events in real time: website clicks, payments, IoT sensor readings, application logs, game telemetry. Producers write records with PutRecord or PutRecords; consumers read them within seconds. Records can be up to 10 MiB, though most are a few kilobytes.

Shards and partition keys

Inside, a stream is made of shards. In provisioned mode, each shard accepts up to 1 MB per second or 1,000 records per second of writes and serves up to 2 MB per second of reads, so you size the stream by counting shards.

Every record carries a partition key. Kinesis hashes the key to pick a shard, and records in a shard keep their order. So if you use the customer ID as the key, one customer's events arrive in order. A common mistake is a key with too few values (say, a country code): one "hot" shard gets most of the traffic and throttles while the others sit idle.

Retention and replay

Records stay for 24 hours by default, and you can extend retention up to 365 days. Because the data stays, a consumer can rewind and replay: reprocess yesterday's events after fixing a bug, or feed a brand-new application from history.

On-demand or provisioned

  • On-demand mode manages shards for you: it scales with your traffic and you don't plan capacity. It suits new or spiky workloads. An account-level On-demand Advantage option adds pre-warmed capacity and lower data prices in exchange for a minimum usage commitment.
  • Provisioned mode gives you control: you choose the shard count and scale it yourself. It suits steady, predictable traffic.

You can switch a stream between the two modes (up to twice in 24 hours).

Who reads the stream

AWS Lambda, Amazon Managed Service for Apache Flink, Amazon Data Firehose and your own apps (with the Kinesis Client Library) can all read the same stream. Standard consumers share each shard's read throughput; enhanced fan-out gives each registered consumer its own dedicated throughput, so adding a consumer doesn't slow the others down.

Where AI fits

Many predictions are only valuable if they are fast. A fraud score that arrives in tomorrow's batch report is too late. With Kinesis, a consumer (a Lambda function or a Flink application) can send each event to a model as it arrives, for example an Amazon SageMaker AI endpoint, and flag a suspicious payment in seconds. The same stream can feed a second consumer that stores the events for training the next model version, because the stream keeps the data for every reader.

Quick recap

  • Queues delete, streams keep: many consumers, replay within retention.
  • Partition key chooses the shard and keeps per-key order.
  • On-demand scales for you; provisioned means you count shards.
AWS in 1 Min #134 · 1:13

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS