Skip to Content

Kinesis and Data Firehose

Kinesis Data Streams for real-time streaming, its shards and capacity modes, Amazon Data Firehose for loading streams into S3, Redshift and more, and how the two differ.

Kinesis Data Streams

Kinesis Data Streams: producers such as click streams, IoT devices, and metrics and logs write records in real time to a stream made of shards; consumers such as applications, Lambda and Data Firehose read them; records are kept from 1 to 365 days and can be replayed Kinesis Data Streams: producers such as click streams, IoT devices, and metrics and logs write records in real time to a stream made of shards; consumers such as applications, Lambda and Data Firehose read them; records are kept from 1 to 365 days and can be replayed

Many producers, a stream of shards, many consumers.

Amazon Kinesis Data Streams collects and stores streaming data in real time: a constant flow of small records such as click streams, IoT device readings, metrics and logs.

  • Producers (applications, the Kinesis Agent) write records to the stream.
  • Consumers (the customer's applications, Lambda, Amazon Data Firehose, Managed Service for Apache Flink) read them.

Key properties:

  • Retention from 24 hours up to 365 days.
  • Replay: consumers can re-read (reprocess) old data, and several consumers can read the same data.
  • Data can't be deleted from Kinesis; it stays until it expires.
  • Records of up to 10 MiB (the typical use is lots of small real-time records).
  • Ordering is guaranteed for records with the same partition key, which always go to the same shard.
  • Encryption at rest with KMS, in flight with HTTPS.
  • Kinesis Producer Library (KPL) and Kinesis Client Library (KCL) help write optimized producer and consumer applications.

Shards and capacity modes

A stream is made of shards. Each shard handles 1 MB/s or 1,000 records/s in and 2 MB/s out (shared by all standard consumers). With enhanced fan-out, each registered consumer gets its own 2 MB/s per shard, pushed to it.

  • Provisioned mode:
    • the number of shards is chosen up front;
    • scaling is manual, by adding or removing shards;
    • billing is per shard per hour.
  • On-demand mode:
    • no capacity to provision or manage;
    • starts at 4 MB/s or 4,000 records/s of write capacity;
    • scales automatically based on the peak throughput seen in the last 30 days;
    • billing is per stream per hour and per GB in and out.

Updated since the slides

AWS has since split on-demand into On-demand Standard (as in the slides) and On-demand Advantage, an account-level option with lower prices for steady use. The exam choice is unchanged: predictable traffic → provisioned; unknown or spiky traffic → on-demand.

Amazon Data Firehose

Amazon Data Firehose: sources such as applications, Kinesis Data Streams, CloudWatch Logs and AWS IoT send records to Firehose, which can transform them with Lambda, buffers and batches them, and writes them to destinations such as Amazon S3, Redshift, OpenSearch, Splunk, Datadog or any HTTP endpoint Amazon Data Firehose: sources such as applications, Kinesis Data Streams, CloudWatch Logs and AWS IoT send records to Firehose, which can transform them with Lambda, buffers and batches them, and writes them to destinations such as Amazon S3, Redshift, OpenSearch, Splunk, Datadog or any HTTP endpoint

Collect, buffer, transform and deliver, with no code.

Amazon Data Firehose (formerly Kinesis Data Firehose) loads streaming data into storage and analytics services, fully managed:

  • Sources: applications, clients and SDKs, the Kinesis Agent, Kinesis Data Streams, CloudWatch Logs and Events, AWS IoT.
  • Destinations:
    • AWS: Amazon S3, Amazon Redshift (through S3), Amazon OpenSearch Service, Apache Iceberg tables;
    • third-party partners: Splunk, Datadog, New Relic, MongoDB and others;
    • any custom HTTP endpoint.
  • Automatic scaling, serverless, billed per use.
  • Near real time: Firehose buffers records and writes them in batches, by size or time (for example every 60 seconds).
  • Formats: CSV, JSON, Parquet, Avro, raw text, binary. It can convert to Parquet or ORC and compress with gzip or snappy.
  • Transformations with AWS Lambda, for example CSV to JSON.
  • Records up to about 1 MB. All or failed data can be backed up to an S3 bucket.

Kinesis Data Streams vs Data Firehose

Data StreamsData Firehose
PurposeCollect streamsLoad into storage
CodeWrite producer and consumerFully managed
SpeedReal timeNear real time
StorageUp to 365 days, replayNone, no replay
  • Data Streams: streaming data collection; producer and consumer code; real time; provisioned or on-demand; data stored up to 365 days; replay.
  • Data Firehose: load streaming data into S3, Redshift, OpenSearch, third-party or HTTP; fully managed; near real time; automatic scaling; no data storage; no replay.

Real-world examples

  • A mobile game streams player events into Kinesis Data Streams; one consumer updates a live leaderboard, another detects cheating, and both can replay the last day after a bug fix.
  • A website sends its clickstream through Data Firehose to S3 as compressed Parquet files every 60 seconds, ready for Athena.
  • A security team streams CloudWatch Logs through Firehose to Splunk.

Exam tips

  • "Real-time streaming", "clickstream", "IoT telemetry", "process in real time", "replay" → Kinesis Data Streams.
  • "Several applications must read the same stream" → Kinesis Data Streams (enhanced fan-out for many consumers).
  • "Order per device or user" → same partition key → same shard.
  • "Load streaming data into S3, Redshift, OpenSearch or Splunk with the least effort" → Data Firehose.
  • "Convert incoming JSON to Parquet before S3" → Firehose format conversion (or Lambda transformation).
  • "Near real time is fine (about a minute)" → Firehose; "milliseconds" → Data Streams.
  • "Unpredictable stream throughput, no shard management" → on-demand mode.

Common traps

  • "Firehose stores data and allows replay." It only delivers; use Data Streams for storage and replay.
  • "Kinesis Data Streams writes to S3 by itself." It needs a consumer, such as Firehose.
  • "Delete records from a stream after processing." Records stay until they expire.

Hands-on lab: a Firehose stream to S3

Goal: send test data through Data Firehose into an S3 bucket.

Costs money

Firehose charges per GB ingested (minimum 5 KB per record); the built-in test data for a few minutes costs a cent or two. Any Region works.

Create a bucket

Create an S3 bucket saa-firehose-<random>.

Create the Firehose stream

Amazon Data Firehose → Create Firehose stream. Source Direct PUT, destination Amazon S3, name saa-stream, bucket saa-firehose-<random>. Under Buffer hints, set the interval to 60 seconds. Create.

Send test data

Open saa-stream → Test with demo data → Start sending demo data. After a minute, Stop. Wait another minute, then open the bucket: folders by year/month/day/hour contain files of batched stock-ticker records.

Expected result: a stream of records delivered to S3 in batches, with no code.

Clean up: delete saa-stream, then empty and delete the bucket.

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt