Streaming ingestion
DEA-C01 · Lesson 2 of 23 · 10:33
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DEA-C01 exam (AWS Certified Data Engineer – Associate). In this lesson: Kinesis Data Streams, Amazon MSK, DynamoDB Streams, and DMS as stream sources, Glue streaming jobs and Redshift streaming ingestion, the Lambda event source mapping (batch size, parallelization factor, starting position), retries with backoff and RDS Proxy, partition keys, enhanced fan-out, retention and replay, and stateful processing with Amazon Managed Service for Apache Flink and tumbling windows. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
A million events a minute
During a weekend tournament, AnyCompany Games receives a million game events every minute: matches started, items bought, and players who quit. The finance team wants purchases within seconds, the fraud team wants alerts, and the game designers want counts every hour. This lesson covers streaming ingestion: the sources, Lambda consumers, throttling, fan-in and fan-out, replay, and state.
Streaming sources
Amazon Kinesis Data Streams keeps records in shards, in order, for consumers that read them in near real time. Amazon MSK runs Apache Kafka, for teams that already use Kafka topics and tools. DynamoDB Streams captures every change to the items of a table for 24 hours, and AWS DMS can send the changes of a database to a Kinesis stream. On the reading side, AWS Glue streaming jobs run all the time, in windows of 100 seconds by default, and track their progress with checkpoints. And Amazon Redshift streaming ingestion reads a Kinesis stream or an MSK topic straight into a materialized view.
Lambda and Kinesis
To call a Lambda function from Kinesis, you create an event source mapping, and Lambda polls each shard for you. The batch size and the batching window decide how many records each call receives, up to a payload of six megabytes. A parallelization factor from one to ten processes several batches of the same shard at once, while records with the same partition key stay in order. The starting position decides where reading begins: LATEST for new records only, TRIM_HORIZON for the oldest record still kept, or AT_TIMESTAMP for a moment in time. When a batch fails, Lambda retries it, so split the batch on errors, report the failed items, and send records that still fail to an on-failure destination.
Throttling and rate limits
Every store has limits, and a pipeline must respect them. In provisioned mode, a Kinesis shard accepts one megabyte or one thousand records per second for writes, and serves two megabytes and five read calls per second, beyond which callers get a ProvisionedThroughputExceededException. A DynamoDB table in provisioned mode throttles requests beyond its capacity units, and the AWS SDKs retry them with exponential backoff. A burst of Lambda functions can also open too many connections to an RDS or Aurora database, so put RDS Proxy in front of it, which pools and reuses connections. So retry with backoff, spread the load with a good partition key, add capacity or switch to on-demand mode, and buffer bursts in a queue or a stream.
Fan-in and fan-out
Fan-in means that many producers write into one stream, like thousands of game servers that all send their events to the same Kinesis stream. Fan-out means that one stream feeds many consumers: finance, fraud, and the data lake. Standard consumers share the read throughput of each shard, two megabytes per second in total, so each new consumer slows the others down. Enhanced fan-out gives each registered consumer its own two megabytes per second for each shard, pushed to it without polling. And Amazon Data Firehose is a simple consumer that delivers the stream to S3, Redshift, or OpenSearch.
Replay and state
Replay means reading the same records again, after a bug fix or for a new consumer: a Kinesis stream keeps records 24 hours by default and up to 365 days, so a consumer can start again from the trim horizon or from a timestamp, and Kafka topics keep records for the retention that you configure. Stateless processing handles each record on its own, like converting a format or masking a field, and Lambda functions are stateless from one call to the next. Stateful processing needs earlier records, like counts per minute, player sessions, or repeated events, so it keeps state. Managed Service for Apache Flink saves that state in checkpoints and snapshots, and Lambda tumbling windows keep up to one megabyte of state for each shard.
Recap
Let's recap. Kinesis Data Streams, MSK, DynamoDB Streams, and DMS feed streams, and Glue streaming jobs and Redshift streaming ingestion read them. A Lambda event source mapping sets the batch size, the parallelization factor, and the starting position. Retry with backoff, use RDS Proxy, and spread writes with a good partition key. Enhanced fan-out gives each consumer its own throughput. And retention allows replay, while Flink and tumbling windows keep state.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A Lambda function reads the purchase stream, which has four shards. At peak hours, the age of the records it reads keeps growing, although the function has plenty of free concurrency. What should the data engineer do first?
- Raise the parallelization factor of the mapping
- Set the starting position to TRIM_HORIZON
- Raise the retention period of the stream
- Add provisioned concurrency to the function
Show the answer
Raise the parallelization factor of the mapping
A higher parallelization factor lets Lambda process up to ten batches from each shard at once, so the function keeps up. “Set the starting position to TRIM_HORIZON” would make it read older records, and fall further behind. “Raise the retention period of the stream” would keep records longer, without reading them any faster. And “Add provisioned concurrency to the function” is for removing cold starts, not for reading more batches from a shard.
Five teams read the same Kinesis stream of game events. Since the fifth team joined, every consumer falls behind with read throughput errors, although producers write well below the limits. What should the data engineer do?
- Raise the retention period to seven days
- Change the partition key of the producers
- Register the consumers for enhanced fan-out
- Set the starting position to LATEST
Show the answer
Register the consumers for enhanced fan-out
With enhanced fan-out, each consumer gets its own two megabytes per second for each shard, instead of sharing them. “Raise the retention period to seven days” would keep records longer, without raising the read limits. “Change the partition key of the producers” is for spreading writes, while the problem here is with reads. And “Set the starting position to LATEST” would skip records, without adding any read capacity.
A bug in the fraud consumer wrote wrong scores for the last two days. The bug is fixed, and the Kinesis stream keeps records for seven days. How can the team process those two days again?
- Ask every producer to send the events again
- Restart the consumer at a timestamp two days back
- Raise the retention period to 365 days
- Start a new consumer at the LATEST position
Show the answer
Restart the consumer at a timestamp two days back
The records are still in the stream, so the fixed consumer reads them again from a timestamp two days back. “Ask every producer to send the events again” would depend on every producer, which may no longer have the events. “Raise the retention period to 365 days” would help in the future, but the two days are already in the stream. And “Start a new consumer at the LATEST position” would read only new records, so the two days would never be fixed.