Lesson 6 of 6 AWS Glue

Processing Streams with Glue Streaming ETL

This lesson explains Glue streaming jobs, which use the same Spark engine and catalogue as batch jobs, for teams that want Spark-based transformations on Kinesis or Kafka data with code close to their batch jobs.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how Glue streaming jobs process micro-batches.
  • Choose between Glue streaming, Flink, Lambda and Firehose.
  • Explain the cost of continuously running streaming jobs.

How Glue streaming jobs work

Glue streaming jobs use Apache Spark Structured Streaming to process data continuously. They read from Amazon Kinesis Data Streams, Amazon MSK or self-managed Apache Kafka, and process the data in micro-batches: small batches of the most recent records, processed at a regular interval set by the window size.

Checkpoints stored in Amazon S3 record each job's progress, so a restarted job resumes where it stopped without losing or reprocessing data. Jobs can deserialise records using schemas from the AWS Glue Schema Registry, and they write to S3, Apache Iceberg tables, databases and other streams. For low-volume streams, small G.025X workers keep the cost of a continuously running job down.

The following diagram shows a batch job and a streaming job sharing the same transformation code.

Reusing the team's batch transformations for a stream. The same transformation functions run in the nightly PySpark job and in a Glue streaming job that reads the Kinesis stream in micro-batches, keeps checkpoints in S3 and writes to the same Iceberg table. Flink would need the logic rewritten, and Firehose cannot apply Spark transformations.
The batch job can keep running for files that still arrive daily.
True or false

Glue streaming

Exam skills 1.1.1 · 1.2.5

Decide whether each statement about Glue streaming jobs is true.

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

Choosing a streaming service

Glue streaming ETL is one of four ways to process streams, and the requirement decides which fits. Glue streaming runs Spark Structured Streaming in micro-batches, which suits Spark transformations that reuse logic from batch jobs. Firehose with a Lambda transformation handles simple per-record changes and delivery to S3 or Redshift with the least effort. Managed Service for Apache Flink is for complex stateful processing, such as event-time windows, joins and late data. Lambda consumers are the cheapest option for per-record processing at low volume. The following table summarises the choice.

RequirementChoose
Spark transformations on streams, reusing batch logicGlue streaming ETL
Simple transformation and delivery to S3 or RedshiftFirehose with a Lambda transformation
Complex stateful processing with event-time windowsManaged Service for Apache Flink
Per-record processing with low cost at low volumeLambda consumers
Sort into groups

Which stream processor?

Exam skills 1.2.5

Choose the stream processing service for each requirement.

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

Cost considerations

Streaming jobs run continuously, so their workers are billed all the time, unlike batch jobs that stop when they finish. A streaming job that processes a few records a minute can therefore cost far more over a month than a batch job handling the same data.

Costs are controlled in three ways. Workers are right-sized, using small G.025X workers for low-volume streams. Auto scaling adds and removes workers with the volume of data. And the latency requirement is checked honestly: if results are needed within minutes rather than seconds, longer micro-batch windows, or a batch job that runs every few minutes and then stops, may meet the requirement at a fraction of the cost.

Scenario questions

Streaming cost

Exam skills 1.2.4

Choose the most cost-effective design for each stream.

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

A team already transforms clickstream files in a nightly PySpark Glue job. The business now wants the same transformations applied within a few minutes of events arriving on a Kinesis stream, and the team wants to reuse its code.

A Glue streaming job reads the Kinesis stream, applies the existing transformation functions to each micro-batch, and writes to the same Iceberg table, with checkpoints in S3. Flink would require rewriting the logic, and Firehose could not apply the Spark transformations.

Check yourself

How does a Glue streaming job resume after a restart?

Show answer

From its checkpoints in S3, which record how far it had processed the stream.

Exam Tips

Remember for the exam

  • Glue streaming jobs use Spark Structured Streaming on Kinesis or Kafka.
  • Checkpoints in S3 let streaming jobs resume after a restart.
  • Glue streaming for Spark-based stream ETL; Firehose for simple delivery; Flink for complex stateful streams.
  • Streaming jobs run continuously and are billed all the time.
  • Use G.025X workers for low-volume streaming jobs.