Lesson 1 of 10 Data Pipeline Design Patterns

Designing a Streaming Pipeline

This lesson explains the reference streaming pipeline, which processes events within seconds of their creation for uses such as fraud detection, live metrics and operational alerts, and how most exam scenarios are variations of it.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the stages of the reference streaming design.
  • Simplify the design when requirements allow.
  • Address design concerns such as partition keys and late data.

The reference design

Producers → Kinesis Data Streams (or MSK) → Managed Service for Apache Flink or Lambda → Firehose → S3 (and OpenSearch for search).

Each stage does one job. Kinesis Data Streams or MSK receives events and holds them durably, in order and for a retention period, so several consumers can read them independently and replay them after a failure. Managed Service for Apache Flink, or Lambda for simpler logic, processes events within seconds: computing windowed aggregations, enriching records and raising alerts.

Amazon Data Firehose delivers the results, batching records, converting them to Parquet and writing them to partitioned S3 prefixes, OpenSearch or Redshift. The data then serves two purposes: S3 keeps the history for analytics, while OpenSearch or Redshift streaming ingestion supports search and near-real-time dashboards. The following table summarises the stages.

StageServiceRole
IngestionKinesis Data Streams or MSKDurable, ordered, replayable buffer with several consumers
ProcessingManaged Service for Apache Flink, or LambdaWindows, aggregations, enrichment and alerts in seconds
DeliveryAmazon Data FirehoseBatching, format conversion and partitioned delivery to S3, OpenSearch or Redshift
Storage and servingS3, OpenSearch, Redshift streaming ingestionHistory for analytics; search and dashboards

The following diagram shows a fraud scoring pipeline's stream and its two consumers.

The fraud scoring pipeline. Transactions go to Kinesis Data Streams keyed by card ID, so each card's events stay in order. A Flink application computes per-card spending over sliding five-minute windows and publishes alerts to EventBridge within seconds. Firehose, a second consumer, writes every event to S3 as partitioned Parquet for Athena.
The five-second limit applies only to the alert path.
Put in order

The streaming reference design

Exam skills 1.3.2 · 1.1.1

Put the stages of the streaming reference design in order.

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

Simplifying when requirements allow

Every extra stage adds cost and operational work, so a narrower requirement deserves a simpler design. If events only need to land in S3 within minutes as Parquet, Firehose alone receives, converts and delivers them, with no stream or processing code. If analysts need to query the stream in Redshift within seconds, Redshift streaming ingestion reads Kinesis or MSK directly into a materialised view. If each record needs only simple processing on its own, Lambda consumers on a Kinesis stream are enough, without Flink. The following table summarises these simpler designs.

RequirementSimpler design
Land events in S3 within minutes as ParquetFirehose alone
Query a stream in Redshift within secondsRedshift streaming ingestion from Kinesis or MSK
Simple per-record processingKinesis with Lambda consumers

The following diagram matches each narrower requirement to its simpler design.

Simpler streaming designs for narrower requirements. Landing events in S3 within minutes as Parquet needs only Firehose; querying a stream in Redshift within seconds needs only Redshift streaming ingestion; and simple per-record processing needs only Lambda consumers on a Kinesis stream.
Each design leaves out stages the requirement does not need.
Match the pairs

Simpler streaming designs

Exam skills 1.3.2 · 1.2.4

Match each narrow requirement with the simpler design that meets it.

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

Design concerns

Streaming pipelines raise design concerns that batch pipelines do not. The partition key determines both ordering and load: records with the same key are processed in order, so the key must preserve the ordering the business needs, such as all events for one account, while spreading load evenly across shards or partitions.

Most streams deliver records at least once, so consumers must be idempotent or deduplicate records. Events can arrive late or out of order, which is handled with event-time windows and watermarks rather than processing-time windows. Finally, the pipeline's health is monitored through consumer lag, such as Kinesis iterator age or Kafka consumer lag, which shows whether processing keeps up with incoming data.

Match the pairs

Streaming design concerns

Exam skills 1.3.2 · 1.1.11

Match each streaming concern with how the design addresses it.

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

Real-time fraud scoring

A payments company must flag suspicious card activity within five seconds and keep every event for analysis.

Transactions are written to Kinesis Data Streams keyed by card ID, so each card's events stay in order. A Flink application computes per-card spending over sliding five-minute windows and publishes alerts to EventBridge. Firehose, as a second consumer, converts the events to Parquet and writes them to S3 partitioned by date for Athena. Firehose alone would not meet the five-second requirement, because it buffers.

Check yourself

When is Firehose alone enough for a streaming pipeline?

Show answer

When the only requirement is to land data in S3 within minutes, with no custom processing.

Exam Tips

Remember for the exam

  • Streaming: Kinesis or MSK → Flink or Lambda → Firehose → S3.
  • If the only requirement is to land data in S3 within minutes, Firehose alone is enough.
  • Use partition keys that keep related events in order.
  • Streaming consumers must handle at-least-once delivery.