Lesson 2 of 7 Analytics: Data Lakes, Athena, Glue, EMR, Redshift and QuickSight

Cataloguing and Preparing Data with AWS Glue

This lesson explains AWS Glue, a serverless data integration service that catalogues data, discovers schemas and runs ETL jobs that prepare data for analytics.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the Data Catalog, crawlers and ETL jobs.
  • Describe how workflows, triggers and other services orchestrate pipelines.
  • Identify typical uses of Glue ETL.

Components

AWS Glue is a serverless data integration service made of several components. The Data Catalog stores table definitions, such as columns, formats and partitions, for data in S3 and databases, and is shared by Athena, EMR, Redshift Spectrum and Lake Formation, so data is described once and queried by many tools. Crawlers scan data and infer its schema and partitions, creating or updating catalog tables automatically.

ETL jobs run serverless Spark or Python scripts that transform data, such as converting CSV to Parquet; job bookmarks track what has already been processed, so each run handles only new data. Glue Studio builds jobs visually, and DataBrew prepares and cleans data visually without code. Data Quality rules check data and can stop bad data from reaching consumers. The following table summarises the components.

ComponentRole
Data CatalogTable metadata shared by Athena, EMR, Redshift Spectrum and Lake Formation
CrawlersInfer schemas and partitions from data in S3 and databases
ETL jobsServerless Spark or Python shell jobs; job bookmarks process only new data
Glue StudioVisual authoring of ETL jobs
DataBrewVisual data preparation without code
Data QualityRules that check data and stop bad data reaching consumers

The following diagram shows how the crawler, the ETL job and the catalog work together.

The AWS Glue components working together. A crawler scans data in S3 and infers its schema and partitions into the Data Catalog. An ETL job converts raw CSV to Parquet, with job bookmarks so that each run processes only new data. Athena, EMR, Redshift Spectrum and Lake Formation all use the same catalog tables.
Describing the data once in the catalog is what lets several engines query it without their own definitions.
Match the pairs

Glue components

Exam skills 3.5.7 · 3.5.1

Match each requirement with the AWS Glue component that meets it.

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

Orchestrating pipelines

Data pipelines consist of several steps that must run in order, with failures handled. Glue workflows and triggers chain Glue crawlers and jobs together, which suits pipelines made only of Glue resources. AWS Step Functions orchestrates larger pipelines across many services, with retries and error handling. Amazon EventBridge starts processing when new data arrives, for example when an object lands in an S3 bucket, so pipelines run when data is ready rather than on a fixed schedule.

Scenario questions

Orchestrating pipelines

Exam skills 3.5.1 · 2.1.1

Choose how to orchestrate each data pipeline.

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

Typical uses

AWS Glue ETL jobs are commonly used for a few data preparation tasks. One is converting CSV or JSON files in the raw zone of a data lake into partitioned Parquet in the processed zone, which makes later queries much faster and cheaper. Another is joining and cleaning data from several sources, such as databases and files, before loading it into Amazon Redshift for analysis.

Worked example

A nightly ETL pipeline

A nightly ETL pipeline is built from several Glue components. The following table identifies the component used at each step.

StepGlue component
Discover new partitions of raw JSON in S3Crawler
Convert new data to partitioned ParquetETL job with job bookmarks, so only new files are processed
Stop bad data reaching analystsData Quality rules
Run the steps in order every nightA Glue workflow with a scheduled trigger

Everything is serverless and billed per use, and the Data Catalog tables are immediately queryable in Athena.

Check yourself

What does a Glue crawler do?

Show answer

It scans data in sources such as S3, infers the schema and creates or updates tables in the Glue Data Catalog.

Exam Tips

Remember for the exam

  • To discover the schemas of data in S3 automatically, use a Glue crawler and the Data Catalog.
  • For serverless ETL, including CSV-to-Parquet conversion, use Glue ETL jobs.
  • To process only new data in each ETL run, use Glue job bookmarks.
  • To orchestrate a multi-step pipeline across services with retries, use Step Functions.