Lesson 2 of 7 Amazon Kinesis and Amazon MSK

Delivering Streaming Data to Storage with Amazon Data Firehose

This lesson explains Amazon Data Firehose, formerly Kinesis Data Firehose, the fully managed, no-code way to deliver streaming data into storage and analytics destinations, scaling automatically with no consumer applications.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify Firehose sources and destinations.
  • Explain how buffer size and interval trade latency against file size.
  • Transform records in flight with Lambda and format conversion.
  • Describe how Firehose handles retries and failed records.

Sources and destinations

Amazon Data Firehose is a delivery service: it receives streaming records, buffers them by size or time, and writes them in batches to a destination, with no consumer code to write. Records arrive by direct PUT from applications or the Kinesis Agent, from a Kinesis data stream or an MSK topic, or from AWS services that deliver to Firehose natively, such as CloudWatch Logs, EventBridge, VPC Flow Logs and AWS WAF logs.

The most common destination is Amazon S3, usually a data lake. For Amazon Redshift, Firehose stages the data in S3 and then loads it with COPY. It also delivers to OpenSearch Service, to Apache Iceberg tables, including S3 Tables, and to third-party services such as Splunk, Snowflake, HTTP endpoints and partners like Datadog. The following table summarises the principal sources and destinations.

SourcesDestinations
Direct PUT from apps or the Kinesis AgentAmazon S3
Kinesis Data Streams, Amazon MSKAmazon Redshift (staged in S3, then COPY)
CloudWatch Logs, EventBridge, VPC Flow Logs, WAF logsOpenSearch Service and Serverless
Apache Iceberg tables, including S3 Tables
Splunk, Snowflake, HTTP endpoints, partners such as Datadog
True or false

Firehose sources and destinations

Exam skills 1.1.1

Decide whether each statement about Firehose is true.

Log in to try this activity Interactive activities are free with an account.

Buffering

Firehose delivers when a buffer size (e.g. 64–128 MB) or buffer interval (e.g. 60–900 seconds) is reached, whichever comes first, so it is near real time. Larger buffers give fewer, larger S3 files that are cheaper and faster to query; some destinations support zero buffering for lower latency.

The following diagram shows a Firehose delivery stream for click events, from buffering through format conversion to partitioned S3 prefixes, and the path of records that fail conversion.

The Firehose delivery stream for click events. Records are buffered up to 128 MB or 300 seconds, converted from JSON to Parquet with a Glue table schema and written to S3 prefixes by country and date, so Athena reads only the partitions a query needs. Records that fail conversion go to a separate error prefix.
The prefix names are illustrative.

Transforming in flight

Firehose can change records on the way to their destination, which can remove the need for a separate processing step. A Lambda transformation receives batches of records and can clean, enrich or filter them. Record format conversion turns JSON into the columnar Apache Parquet or ORC formats, using a schema from the Glue Data Catalog, so later queries in Athena or Redshift Spectrum are faster and cheaper. Dynamic partitioning writes each record to an S3 prefix built from its own fields, such as customer and date, so queries can skip partitions they do not need. The following table summarises the features.

FeatureWhat it does
Lambda transformationCleans, enriches or filters records
Record format conversionConverts JSON to Apache Parquet or ORC using a Glue Data Catalog schema
Dynamic partitioningWrites to S3 prefixes based on fields, e.g. customer_id=123/date=2026-01-05/, so queries can prune partitions
Match the pairs

Firehose features

Exam skills 1.2.6 · 1.1.1

Match each requirement with the Firehose feature that meets it.

Log in to try this activity Interactive activities are free with an account.

Reliability and limits

Firehose handles delivery reliability itself. It can compress output with GZIP, Snappy or ZIP, encrypt it with AWS KMS, and retry failed deliveries automatically. Records that still cannot be delivered, or that a transformation function marks as failed, are written to a backup location in Amazon S3, and Firehose can also back up all records there, while delivery failures appear in CloudWatch metrics and logs.

Firehose also has limits that rule it out for some designs. Delivered records cannot be replayed, it supports no custom consumers, and buffering always adds some latency. When a design needs replay, several independent consumers or sub-second processing, Kinesis Data Streams or Amazon MSK is placed in front, and Firehose becomes one consumer of that stream, delivering a copy to the lake while other consumers process the data in real time.

The following diagram shows a stream placed in front of Firehose, so that Firehose becomes one consumer.

Placing a stream in front of Firehose. Producers write to Kinesis Data Streams or Amazon MSK, which keeps records for replay. Firehose becomes one consumer that delivers a copy to the lake, while other consumers process the same records in real time.
Amazon MSK can take the place of Kinesis Data Streams in this design.
Scenario questions

Is Firehose enough?

Exam skills 1.1.1 · 1.1.11

Decide whether Firehose alone meets each requirement.

Log in to try this activity Interactive activities are free with an account.
Worked example

From JSON events to query-ready Parquet

An application sends 20 million small JSON click events a day. Analysts want to query them in Athena by date and country, cheaply.

Firehose settingChoiceReason
Record format conversionJSON to Parquet using a Glue table schemaColumnar files scan far less data
Dynamic partitioningPartition by country from the record and date from arrival timeQueries read only the partitions they need
Buffering128 MB or 300 secondsFewer, larger files instead of millions of tiny ones
Error outputA separate S3 prefix for records that fail conversionBad records are kept for inspection

With 1 MB buffers, the same stream would write thousands of tiny files an hour, making Athena slow and S3 requests expensive. Buffering trades a few minutes of latency for much better query performance, which suits analytics that do not need second-by-second freshness.

Check yourself

How can Firehose write fewer, larger files to S3?

Show answer

By increasing the buffer size and buffer interval, so each delivery contains more data.

Exam Tips

Remember for the exam

  • To stream data to S3 as partitioned Parquet with the least effort, use Firehose with format conversion and dynamic partitioning.
  • For fewer, larger S3 files, increase the buffer size and interval.
  • To load streaming data into Redshift with no code, use Firehose, which stages data in S3 and then runs COPY.
  • To transform records in flight, use a Firehose Lambda transformation.
  • If you need replay or several custom consumers, use Kinesis Data Streams instead.
  • Firehose is near real time, because it buffers, rather than millisecond latency.