Data Ingestion and Transformation · Topic 5 of 8

AWS Glue ETL Jobs

Build and tune AWS Glue ETL jobs: job types, DynamicFrames, bookmarks, workers and DPUs, connections, streaming ETL and common failure causes in the exam.

  • 5 min
In a nutshell
  • Glue is serverless, and billing follows the capacity used while jobs run.
  • DynamicFrames tolerate messy schemas, and resolveChoice fixes type conflicts.
  • Job bookmarks give incremental processing, and they depend on transformation_ctx.

What it is

AWS Glue is a serverless data integration service. Its ETL (extract, transform, load) engine runs your code on managed infrastructure and you pay for the capacity while a job runs.

A Glue job is a script plus settings: the role it runs as, the type and number of workers, the connections it needs and its parameters. You can write the script yourself or build it visually in AWS Glue Studio, which generates PySpark code.

SourceS3, JDBC, KinesisreadGlue jobSpark transformwriteTargetS3, Redshift, RDSGlue Data Catalogtable definitionsschemaGlue jobSpark transform

How it works

Job types

Job typeUse
SparkLarge scale batch ETL in Python (PySpark) or Scala
Spark StreamingContinuous ETL from Kinesis, Kafka or MSK into a target
Python shellSmall tasks that do not need Spark

Spark jobs run on workers. Capacity is measured in DPUs (data processing units), and the worker type (such as G.1X or G.2X) sets memory and CPU for each worker. Glue can also scale the number of workers automatically.

DynamicFrames and DataFrames

A DynamicFrame is a Glue specific structure that handles records with inconsistent schemas. A field may hold different types in different rows, and a DynamicFrame can represent that as a choice type, which you then resolve with resolveChoice. You can convert to and from a Spark DataFrame when you need standard Spark functions.

datasource = glueContext.create_dynamic_frame.from_catalog(
    database="sales_db", table_name="raw_orders",
    transformation_ctx="datasource")
mapped = ApplyMapping.apply(frame=datasource, mappings=[
    ("order_id", "string", "order_id", "string"),
    ("amount", "string", "amount", "double")])
glueContext.write_dynamic_frame.from_options(
    frame=mapped, connection_type="s3",
    connection_options={"path": "s3://my-bucket/curated/orders/"},
    format="parquet")

The transformation_ctx argument is what job bookmarks use to track state for that step.

Job bookmarks

A job bookmark remembers what the job already processed, so the next run reads only new data. This gives incremental loads without custom code. You can pause or reset a bookmark when you want to reprocess.

Reading and writing data

Glue reads from S3, JDBC databases, DynamoDB, Kinesis, MSK and many other sources. For databases, a Glue connection stores the network and credential details. When the database is in a VPC (virtual private cloud), the job runs with a connection that places it in a subnet with a security group, and that subnet needs a route to S3, often through a gateway endpoint.

Pushdown predicates limit which partitions are read, so a job filters on partition columns before loading data.

glueContext.create_dynamic_frame.from_catalog(
    database="sales_db", table_name="raw_orders",
    push_down_predicate="year == '2026' and month == '10'")

Triggers, parameters and security

Jobs start from the console, a schedule, a Glue trigger, EventBridge or a workflow.

Job parameters let the same script run for different dates or paths. A Glue job needs an IAM (Identity and Access Management) role that can read the sources, write the targets and read the script in S3. Database passwords belong in AWS Secrets Manager, not in the script.

Tuning and common failures

SymptomLikely cause and fix
Out of memory on a workerData skew or too little memory. Use a larger worker type or repartition
One task runs far longer than the restSkewed key. Spread the key, or use salting
Slow job with many small filesGroup small files on read, or compact them
Job cannot reach the databaseMissing connection, subnet route, security group or endpoint
Job reads old data againBookmark disabled or reset
Access denied on S3The job role lacks permissions

Monitor jobs with CloudWatch metrics and logs, and the Spark UI when enabled. Glue also offers automatic retries on a job.

Glue and other tools

Glue DataBrew is a separate visual data preparation tool with built in transforms. Glue Data Quality adds rules to a job. Both are covered in the data operations chapter.

What to remember for the exam

  • Glue is serverless, and billing follows the capacity used while jobs run.
  • DynamicFrames tolerate messy schemas, and resolveChoice fixes type conflicts.
  • Job bookmarks give incremental processing, and they depend on transformation_ctx.
  • Pushdown predicates read only the partitions you name.
  • A Glue connection in a VPC needs correct subnet, security group and route to reach S3 and the source.
  • Store database credentials in Secrets Manager.
  • Skewed keys cause long running tasks and memory errors, and salting is the standard remedy.
  • Streaming ETL jobs read from Kinesis, Kafka or MSK.
Exam tip

A Glue job that works against S3 but hangs against a database in a VPC usually has a networking issue, not a code issue.

Common mistakes

Expecting bookmarks to track everything. They apply to supported sources and to steps with a transformation_ctx, so a missing context breaks the tracking.

Adding workers to fix skew. More workers do not help when one key holds most of the data. Fix the key distribution.

Hardcoding credentials. Putting a password in a script exposes it. Use Secrets Manager or a connection.

Ignoring the role. Most "access denied" Glue errors come from the job role, not the person who started the job.

Watch out

Resetting a bookmark makes the next run read all source data again, which can duplicate output unless the write is idempotent.

Check yourself

  • Which Glue feature lets a job process only new data on each run?

    Job bookmarks.

  • What is a DynamicFrame good for?

    Handling records with inconsistent or changing schemas, with choice types resolved by resolveChoice.

  • A Glue job in a VPC cannot read S3. What should you check?

    The subnet route, for example an S3 gateway endpoint or a NAT (network address translation) gateway, and the security group.

Topic 5 of 8 in Data Ingestion and Transformation

Test yourself on Data Ingestion and Transformation

The full AWS DEA-C01 question bank has 845 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.