AWS Glue Module 3: Your First ETL Job with Glue Studio
Introduction
Glue Studio lets you build ETL jobs by connecting nodes on a canvas and generates the PySpark script for you. It is the fastest way to a first working job, and the generated script is a good way to learn. Screens change, so follow the current AWS Glue documentation for exact menu names.
Prerequisites
- Module 2 completed (the raw_orders table exists)
Step-by-Step Guide
Step 1: Create a visual job
In the AWS Glue console, open the ETL jobs area and start a visual job. A visual job starts with a source node, transform nodes, and a target node. Pick the newest Glue version, and set the IAM role to GlueLabRole.
Step 2: Configure the source
Add a data source node of the Data Catalog type, and choose the glue_lab database and the raw_orders table. This reads the file through the catalog, so the schema comes from the table definition.
Step 3: Add transforms
Add a Filter node to keep only rows where status is not CANCELLED, and a Change Schema (ApplyMapping) node to rename or cast columns, for example casting order_date to a date and amount to a double. Each node has a preview you can check with sample data.
Source (Data Catalog: glue_lab.raw_orders)
-> Filter status != 'CANCELLED'
-> Change Schema order_id:int, customer_id:int, order_date:date, amount:double, status:string
-> Target (S3, Parquet, snappy)Step 4: Configure the target and run the job
Add a target node that writes to S3 in Parquet format with compression, for example s3://my-glue-lab-123456/clean/orders/, and optionally register the output as a catalog table. Name and save the job, set the number of workers to the minimum (two) for this small data, and run it. Open the run details and watch the status and logs.
# Check the output after the run
aws s3 ls s3://my-glue-lab-123456/clean/orders/
aws glue get-job-runs --job-name orders-visual-job --max-items 1 \
--query "JobRuns[0].[JobRunState,ExecutionTime]"Step 5: Read the generated script
Switch to the Script tab and read the PySpark code Glue generated. You will see the same pattern in the next module: create a GlueContext, read from the catalog, apply transforms, write the result, and commit the job. Understanding this script is the bridge to writing your own jobs.
FAQs
- Can I edit the script of a visual job?
- You can convert or copy the generated script into a script-based job and then edit it freely, but a job you edit as a script can no longer be changed in the visual editor. Many teams start visually and move to code once they need custom logic.
Summary
Glue Studio builds ETL jobs visually: a catalog source, Filter and Change Schema transforms, and an S3 Parquet target. Run with minimal workers while learning, check the output and run details, and study the generated script.
Related tutorials
- Databricks Module 8: SQL Warehouses, Performance, Cost, and a First Look at MLflow
- Databricks Module 7: Jobs, Orchestration, and Deploying with Git and Bundles
- Databricks Module 6: Declarative Pipelines and the Medallion Architecture
- Databricks Module 5: Ingesting Files with Auto Loader and COPY INTO
- Databricks Module 4: Unity Catalog, Volumes, and Governance
Comments
Log in or create a free account to join the discussion.