Lesson 2 of 10 Data Pipeline Design Patterns

Designing a Batch Pipeline

This lesson explains the reference batch pipeline, the most common pattern in data engineering, which processes data in scheduled or file-triggered runs wherever minutes or hours of latency are acceptable and cost per terabyte matters.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the stages of the reference batch design.
  • Make batch runs reliable with logical dates and partition overwrites.
  • Choose between batch and streaming from the required latency.

The reference design

Files land in the S3 raw zone → EventBridge or a schedule starts a Step Functions workflow → Glue crawler or catalogue update → Glue ETL to Parquet or Iceberg in the curated zone → Glue Data Quality → COPY into Redshift or query with Athena.

Files first land unchanged in the S3 raw zone, which keeps an immutable copy for reprocessing. EventBridge, reacting to the file's arrival or to a schedule, starts a Step Functions workflow, or an MWAA DAG, which runs the steps in order and handles retries and failure alerts. Glue or EMR jobs clean and conform the data and convert it to Parquet or Iceberg in the curated zone.

Glue Data Quality then checks the result, stopping the workflow or quarantining bad records before they are published. Finally, the data is served: loaded into Redshift with COPY for warehouse queries, or queried in place with Athena. The following table summarises the stages.

StageServiceRole
LandingS3 raw zoneImmutable copy of source data
Trigger and orchestrationEventBridge, Step Functions, MWAAStart the run, order the steps, retry and alert
TransformationGlue or EMRClean, conform and convert to columnar formats
ValidationGlue Data QualityStop or quarantine bad data
ServingRedshift, AthenaWarehouse tables and lake queries

The following diagram shows a daily sales pipeline's timeline against its deadline, and the workflow's steps.

The daily sales pipeline against its deadline. Stores upload files between 01:00 and 03:00. At 03:30 EventBridge Scheduler starts a Step Functions workflow that runs the Glue job and its Data Quality ruleset, then COPY into staging and MERGE into the sales table through the Redshift Data API, well before 06:00. A Catch on every step publishes failures to SNS.
The workflow's duration is illustrative.
Put in order

The batch reference design

Exam skills 1.3.1 · 1.3.2 · 1.2.3

Put the stages of the batch reference design in order.

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

Making batch runs reliable

Batch pipelines must cope with retries, reruns and late-arriving files without corrupting results. Each run is parameterised by its logical date, the period it processes, rather than by the current time, so a run for 3 October produces the same result whether it runs on 4 October or a week later.

Writes are idempotent: each run overwrites the partitions for its logical date, or merges on a key, so a rerun replaces rather than duplicates its output. Glue job bookmarks process only new files. Finally, pipelines alert on failures and on missing or stale data, because a run that silently processes nothing is as harmful as one that fails.

Spot the bug

A run that depends on today

Exam skills 1.3.2 · 1.4.4

Find the lines that make reruns unsafe.

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

Batch or streaming?

The choice between batch and streaming depends on the required latency. Batch is simpler and cheaper per terabyte; streaming is justified when the business acts on data within seconds or minutes. Many organisations combine both: a streaming path for immediate needs and a batch path for complete, corrected history.

True or false

Batch or streaming?

Exam skills 1.3.2 · 1.2.4

Decide whether each statement is true.

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

A daily sales pipeline

Stores upload sales files to S3 each night between 01:00 and 03:00. Finance needs validated sales in Redshift by 06:00, and the team wants alerts if anything fails.

EventBridge Scheduler starts a Step Functions workflow at 03:30. It runs a Glue job that reads the night's files, writes partitioned Parquet to the curated zone and evaluates a Data Quality ruleset; if the ruleset passes, a Redshift Data API task runs COPY into a staging table and MERGE into the sales table. A Catch on every step publishes failures to SNS.

Check yourself

Why keep the raw zone in a batch pipeline?

Show answer

So the data can always be reprocessed, for example after a bug fix or a change in business rules.

Exam Tips

Remember for the exam

  • Batch: S3 → Step Functions → Glue → Parquet → Redshift or Athena.
  • Keep the raw zone so data can always be reprocessed.
  • Parameterise runs by logical date and write idempotently.
  • Validate data with Glue Data Quality before loading it.