Ingesting Streaming Data with Kinesis Data Streams and Data Firehose
This lesson explains Kinesis Data Streams and Amazon Data Firehose, the two core AWS streaming ingestion services for real-time features, fraud scoring and continuous training sets, and when to use each.
Learning outcomes
After completing this lesson, you will be able to:
- Size a Kinesis data stream from shard limits.
- Describe how Firehose buffers and delivers records.
- Design a stream with several ML consumers.
Kinesis Data Streams
Kinesis Data Streams stores records in shards. Each shard accepts up to 1 MB or 1,000 records per second of writes and serves 2 MB per second of reads shared by standard consumers. A record's partition key decides its shard, so records with the same key stay in order. Records are kept for 24 hours by default and up to 365 days, so consumers can replay the stream, which is useful for rebuilding features after a bug.
Several applications can read the same stream: a Lambda function that scores transactions, a Flink application that computes features and a Firehose stream that archives raw data. Enhanced fan-out gives each registered consumer its own 2 MB per second per shard. Streams run in on-demand mode, which scales automatically, or provisioned mode with a chosen number of shards.
1MB/s
Writes per shard
1,000records/s
Writes per shard
2MB/s
Reads per shard, shared by standard consumers
365days
Maximum retention, for replay
Shard limits
Amazon Data Firehose
Amazon Data Firehose is a fully managed delivery service. It receives records, buffers them by size or time, and writes them in batches to Amazon S3, Amazon Redshift, Amazon OpenSearch Service, Apache Iceberg tables or HTTP endpoints, with no consumer code. It can call a Lambda function to transform records, convert JSON to Parquet or ORC using a schema from the AWS Glue Data Catalog, and partition S3 output dynamically by fields in the records.
Firehose is near real time because it buffers, and it has no replay and no custom consumers. It is the right tool for landing streaming data in S3 as training data, but not for millisecond scoring.
The following table compares the two services.
What Firehose does
Streaming into ML systems
For ML, a common pattern is to put a Kinesis data stream at the front, then attach three consumers: Firehose to archive raw events in S3 as partitioned Parquet for training; a stream processor that computes aggregate features and writes them to the SageMaker Feature Store online store; and a Lambda function that calls a SageMaker AI endpoint to score events in real time. The same raw data then supports training, features and inference without being copied by custom code.
The following diagram shows one stream with its three consumers.

From click to feature
Sizing a transaction stream
A payment processor sends 4,000 transactions per second of 0.8 KB each to a fraud model. Two consumers, a scoring Lambda function and Firehose, read the full stream.
Write: 4,000 records/s x 0.8 KB = 3.2 MB/s
by records: 4,000 / 1,000 per shard = 4 shards
by size: 3.2 MB/s / 1 MB/s = 4 shards (rounded up)
Read: 2 consumers x 3.2 MB/s = 6.4 MB/s / 2 MB/s per shard = 4 shards
Answer: 4 shards in provisioned mode (add headroom), or on-demand modeThe partition key should be the card or account ID so that each account's transactions stay in order, which matters for features such as "amount compared with the previous transaction". Using the merchant category as the key would create hot shards for popular categories.
Why can Firehose not be used when consumers must replay data?
Show answer
Firehose only buffers and delivers data to a destination. Kinesis Data Streams keeps records so consumers can replay them.
Exam Tips
Remember for the exam
- Replay, ordering and several custom consumers: Kinesis Data Streams.
- Land streaming data in S3 as Parquet with no code: Firehose.
- Firehose buffers, so it is near real time and cannot replay.
- One shard: 1 MB/s or 1,000 records/s in, 2 MB/s out.
- Use a high-cardinality partition key such as account ID.