Courseiva
DEA-C01Chapter 17 of 18Objective 4.5

Data Transformation and Querying with AWS Glue Studio and Amazon Athena

How do you take raw, messy data stored in Amazon S3 and turn it into clean, organised, query-ready information without managing any servers? This chapter explains how AWS Glue Studio and Amazon Athena work together to do exactly that, making data transformation and querying accessible to anyone, even if you have zero IT background.

12 min read
Advanced
Updated Jul 23, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Data Transformation and Querying with AWS Glue Studio and Amazon Athena

The Community Kitchen Renovation Analogy

A big, messy community kitchen, where volunteers cook meals for a local shelter. The fridge is stuffed with ingredients in all sorts of states: whole vegetables, half-used jars, unlabelled containers, and bags of rice with no cooking instructions. A volunteer, Alex, needs to prepare a hundred balanced meals by dinnertime. Alex doesn't want to cook from scratch in a chaotic kitchen.

First, Alex pulls out the 'Cooking Studio' – a special prep station with all the knives, peelers, and measuring tools needed. At this station, Alex cleans the carrots, chops the onions, drains the canned beans, and portions the rice into sealed bags. This is the transformation stage – taking raw, messy ingredients and turning them into ready-to-use, standardised components. Alex labels each bag with its contents and the date, creating an organised 'catalogue' of prepped ingredients.

Now, the chaotic kitchen is tidy, but Alex still needs to write the menu. With all the prepped ingredients laid out like building blocks, Alex uses a 'Recipe Query Book' – a magical notebook where you can ask questions about the ingredients in plain English. 'Find all the prepped vegetables that can be roasted,' Alex writes. The notebook instantly lists the chopped carrots and onions. 'Show me how many bags of rice I have.' The notebook counts them in a second. Alex can quickly assemble the meals by asking the notebook to combine ingredients without ever touching the stove. The community kitchen is transformed from a mess of raw goods into an efficient meal-prep factory, all because of the prep station and the recipe query book.

How It Actually Works

At its core, data transformation and querying is about taking your data from a raw, unusable state and making it clean, structured, and ready for analysis. Imagine you have a giant pile of unlabelled photographs. Before you can search for 'pictures of dogs', you need to organise them into albums and add tags like 'dog', 'park', 'sunny'. AWS Glue Studio and Amazon Athena are the tools that automate this process for data stored in the cloud.

Let's break down the key terms first. Amazon Simple Storage Service, or Amazon S3, is a cloud storage service. Think of it as a massive, secure, and infinitely large filing cabinet in the cloud where you can store any type of file – text files, images, videos, and, most importantly for us, data files like CSV (Comma-Separated Values) or JSON (JavaScript Object Notation). A CSV file is like a spreadsheet saved as plain text, with each row being a record and each column separated by a comma. A JSON file is a more flexible format that stores data in key-value pairs, like a digital index card with fields like 'Name: John' and 'Age: 30'.

Now, AWS Glue Studio. AWS Glue is a fully managed extract, transform, and load (ETL) service. 'Fully managed' means AWS takes care of all the underlying servers and infrastructure for you – you don't have to install, patch, or maintain anything. 'ETL' is a three-step process:

Extract: Reading the raw data from its source, like an S3 bucket.

Transform: Cleaning, filtering, combining, and reformatting the data. This is where you fix inconsistencies (e.g., changing 'NY' and 'New York' to a standard 'New York'), remove duplicate records, or aggregate sales data by month.

Load: Writing the transformed data into a destination, like a cleaned S3 bucket or a database.

AWS Glue Studio is the visual interface (a graphical, drag-and-drop editor) for building these ETL jobs. You don't need to write complex code. Instead, you drag boxes representing data sources, transformation steps, and destinations, and connect them with arrows. It generates the underlying code (usually Python) automatically. For example, you could drag a 'Source' box pointing to your raw CSV files, then a 'Filter' box to remove rows where the 'age' column is blank, then a 'Rename Field' box to change 'dob' to 'date_of_birth', and finally a 'Destination' box to save the result into a new S3 folder.

Why does this matter? Before services like AWS Glue, companies had to write custom scripts, maintain servers, and manually schedule jobs. It was slow, error-prone, and required deep programming skills. AWS Glue Studio removes that barrier by providing a visual, serverless way to transform data.

Next, Amazon Athena. Once your data is cleaned and transformed, you need to ask questions about it. Athena is an interactive query service that lets you analyse data in S3 using standard SQL – Structured Query Language. SQL is the universal language used to talk to databases. You write simple statements like 'SELECT * FROM my_table WHERE year = 2023' and Athena runs the query for you. Here's the magic: there is no database to manage. Athena works directly on the data stored in S3. It is serverless, meaning you pay only for the queries you run, based on the amount of data scanned. You never provision a server or worry about scaling.

For Athena to query data, it needs to understand its structure. This is where the AWS Glue Data Catalog comes in. The Data Catalog is a central metadata repository. 'Metadata' is data about your data – like a library card catalogue tells you the author, title, and shelf location of a book. The Glue Data Catalog stores schema (the names and data types of columns – e.g., 'customer_id' is a number, 'purchase_date' is a date) and table definitions for your data in S3. You can either run an AWS Glue crawler (a program that automatically scans your data and infers the schema) to populate the Data Catalog, or you can define the tables manually in Athena.

Once the Data Catalog has the table definitions, you open Athena, type your SQL query, and get results in seconds. For example, if you have a CSV file with sales data, after running a Glue crawler, you can query it instantly with SQL like 'SELECT region, SUM(sales) FROM sales_data GROUP BY region'. Athena handles the heavy lifting of parsing the file, applying the schema, and computing the answer.

The combination works like an assembly line: AWS Glue Studio prepares and packages your raw materials (data), the Glue Data Catalog labels and indexes the packages, and Athena lets you ask questions about the packages' contents without ever opening them manually. Together, they provide a complete, serverless solution for data preparation and interactive analysis, which is exactly what the AWS Certified Data Engineer Associate DEA-C01 exam expects you to understand.

The flow of data from raw S3 storage through AWS Glue transformation and cataloguing, to querying with Amazon Athena.

Walk-Through

1

Identify Raw Data Sources

Locate the raw data files in Amazon S3. This could be CSV, JSON, or other formats. Understanding the source location and format is the first step because Glue and Athena need to know where the data lives and what shape it is in before they can process or query it.

2

Create or Update the AWS Glue Data Catalog

Use an AWS Glue Crawler to scan the raw data and automatically infer the schema (column names, data types). The crawler writes this metadata into the Glue Data Catalog. Without this step, Athena would not know how to interpret the data files.

3

Build the ETL Job in AWS Glue Studio

Open AWS Glue Studio and create a new ETL job. Drag and drop the data source (S3 location), transformation nodes (filter, join, rename), and destination (a clean S3 bucket). This job will clean and structure your data for analysis.

4

Run and Schedule the Glue Job

Run the ETL job manually to test it, then set up a schedule (e.g., nightly) or an event trigger to run it automatically when new raw data arrives. This ensures your curated data stays up-to-date.

5

Review the Transformed Data in Athena

After the Glue job completes, the new clean data in S3 is automatically discoverable by Athena via the Data Catalog. Open Athena, write SQL queries (e.g., SELECT * FROM clean_table WHERE date = '2024-01-01'), and verify the data is correct.

6

Optimise for Performance and Cost

If queries are slow or expensive, consider converting data to columnar formats like Parquet and partitioning the table by date. These optimisations reduce the amount of data Athena scans, speeding up queries and lowering costs.

What This Looks Like on the Job

Let us walk through a concrete day in the life of a data engineer at a small e-commerce company called 'ShopStream'. The company sells electronics online. Every day, the website generates a huge amount of raw data: customer orders (CSV files), product page views (JSON logs), and customer support tickets (another CSV). All of this is dumped into a single, messy S3 bucket called 'shopstream-raw-data'. The marketing team wants to run a campaign targeting customers who have bought a laptop in the last month and also visited the 'accessories' page more than twice. They need a clean dataset of these customers by tomorrow morning.

The data engineer, Maria, starts by opening AWS Glue Studio. She creates a new ETL job. First, she drags an 'Amazon S3' data source node and points it to the raw orders CSV files in the 'shopstream-raw-data' bucket. She adds a second data source node for the page-view JSON logs. Within the visual editor, Maria drags a 'Join' transformation node – this acts like matching puzzle pieces. She connects the two data source nodes to the Join node. She configures the join to match records where the 'customer_id' in the orders file matches the 'user_id' in the logs. This combines all the information about a customer's purchases and page views into a single dataset.

Next, Maria needs to filter this combined data. She adds a 'Filter' transformation node. She types in a condition: only keep rows where 'product_purchased' equals 'laptop' and 'page_visited' is 'accessories'. She then adds a 'Select Fields' node to keep only the columns she needs: 'customer_name', 'email', and 'phone'. Finally, she drags an 'Amazon S3' destination node and configures it to save the output as a new Parquet file (a highly efficient columnar storage format) into a separate S3 bucket called 'shopstream-curated-data'. She clicks 'Run' and the job executes, transforming hundreds of megabytes of messy data into a clean, compact file in a few minutes.

Now, Maria opens Amazon Athena. The Glue Data Catalog has already been updated with a table pointing to the 'shopstream-curated-data' bucket (the crawler she runs daily handles this). She types a simple SQL query:

SELECT email, customer_name FROM shopstream_curated_data;

She quickly verifies the data looks correct. The marketing team can now use this data directly to send emails. Maria could also give them access to Athena so they can write their own queries. But more likely, Maria will create a dashboard that automatically refreshes daily using this clean data.

The key steps an IT professional must manage are:

Setting up the S3 bucket structure: raw zone, curated zone, and maybe an analytics zone.

Configuring AWS Glue Crawlers to automatically update the Data Catalog when new files arrive.

Designing transformation jobs in Glue Studio, often scheduling them to run nightly.

Monitoring job runs for failures (common issues: malformed CSV rows, mismatched data types).

Writing and optimising SQL queries in Athena to ensure they don't scan too much data (which would increase costs).

In an interview, a data engineer would explain how they automated the entire pipeline, ensuring the marketing team's campaign launched on time with accurate data, all without provisioning a single server.

How DEA-C01 Actually Tests This

For the AWS Certified Data Engineer Associate DEA-C01 exam, the 'Data Transformation and Querying with AWS Glue Studio and Amazon Athena' objective is heavily tested. You need to know not just what these services do, but how they interact and what specific features solve what problems. The exam uses scenario-based multiple-choice questions where you must choose the most efficient, cost-effective, or correct service or configuration.

Here are the exact concepts the exam loves to test:

The difference between AWS Glue (ETL service) and AWS Glue Studio (visual ETL editor). Questions might describe a scenario where they need to transform data and ask which AWS service to use. Answer: AWS Glue. If they mention a visual, drag-and-drop interface, answer: AWS Glue Studio.

When to use AWS Glue crawlers vs manually defining a table in the Glue Data Catalog. The exam will test that crawlers are best for schemas that change frequently (like new columns added daily), while manual definition is fine for static schemas.

Understanding the Glue Data Catalog as a central metadata store that Athena and other query services use. A common question: 'Which service stores the table definitions that Athena queries?' Answer: AWS Glue Data Catalog.

Athena is serverless and query-based only. You pay per query based on the amount of data scanned. The exam loves tricking you with options that spin up EC2 instances or require server management. Avoid those. The correct answer is always serverless for Athena.

Athena query performance optimisation: partition your data (organise it in folders by date, country, etc.) and use columnar formats like Parquet or ORC. A typical trap: they ask you to speed up a slow Athena query. The correct answer involves partitioning the table and converting files to Parquet, not adding more CPU to a server (there is no server).

Data formats: CSV, JSON, Parquet, Avro, ORC. The exam tests that Parquet and ORC are columnar and more efficient for analytics queries, while CSV and JSON are row-based and easier for humans to read but slower to query. A question might ask: 'Which format is best for reducing Athena query costs?' Answer: Parquet, because it compresses data and only scans relevant columns.

Common traps to watch for:

Confusing Amazon Redshift (a data warehouse) with Athena. Redshift stores data in its own managed database; Athena queries data directly from S3. If the scenario says 'query data directly from S3 without loading it into a database', the answer is Athena.

Thinking Glue provides a query interface. It does not. Glue transforms data; Athena queries it.

Assuming Glue Studio requires coding. It does not – it generates code for you.

Key definitions to memorise:

- ETL: Extract, Transform, Load - Data Catalog: Metadata repository for schemas and locations - Crawler: Automatically scans data to infer schema - Job: A unit of work in Glue (ETL script) - Query: A SQL statement executed in Athena

The exam will not ask you to write SQL queries in detail, but you must understand the purpose of SELECT, WHERE, GROUP BY, and JOIN. You must also understand how partitioning works. A typical question gives you a scenario with 3TB of data in S3 and asks you to set up Athena to scan only 10GB per query. The correct answer is to partition the table by a column like 'date' and then query with a WHERE clause filtering on that partition.

Key Takeaways

AWS Glue Studio provides a visual drag-and-drop interface to build ETL jobs without writing code, making data transformation accessible to non-programmers.

Amazon Athena is a serverless query service that lets you run SQL directly on data stored in Amazon S3, with no database to manage.

The AWS Glue Data Catalog acts as a central metadata repository that stores table definitions and schemas, which both Glue and Athena use.

For optimal Athena performance and cost, store your data in columnar formats like Parquet and partition your tables by date or region.

AWS Glue jobs are not automatic; you must configure triggers (manual, scheduled, or event-based) to run them when new data arrives.

Glue transforms data (ETL) and Athena queries data – they are complementary services, not interchangeable ones.

Athena charges you based on the amount of data scanned per query, so optimising data storage directly reduces costs.

AWS Glue Crawlers automatically infer schema from your data and update the Data Catalog, saving you from manually defining table structures.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

AWS Glue Studio

Used for data transformation (ETL) via visual drag-and-drop interface

Generates and runs Python/Scala code behind the scenes

Charged per job run based on DPU (Data Processing Unit) hours

Output is a new dataset stored in S3

Amazon Athena

Used for interactive querying of data already in S3 using SQL

No code generation; you write SQL queries directly

Charged per query based on the amount of data scanned

Output is query results (temporary or saved to S3)

AWS Glue Crawler

Automatically scans data and infers schema

Ideal for dynamic schemas that change frequently

May not capture all nuances (e.g., data types can be misdetected)

Manually Defined Table (in Glue Data Catalog)

You explicitly define column names, types, and partitions

Best for static schemas that rarely change

Requires more manual effort but gives you full control over the schema

Parquet File Format

Columnar storage – only reads relevant columns for a query

Highly compressed – smaller file sizes reduce storage cost and query cost

Faster for analytics queries in Athena

Not human-readable without special tools

CSV File Format

Row-based storage – entire file is read for most queries

No built-in compression – larger file sizes increase storage and query costs

Slower for analytics queries in Athena

Human-readable in any text editor

Amazon Athena

Serverless – no infrastructure to manage

Queries data directly from S3 (no data loading required)

Best for ad-hoc, interactive queries on data lakes

Pay per query (data scanned)

Amazon Redshift

Clustered (provisioned) – requires managing nodes

Requires loading data into its own storage for best performance

Best for high-performance, complex analytical workloads on structured data

Pay per cluster hour (regardless of usage)

Watch Out for These

Mistake

AWS Glue Studio is a tool for querying and analysing data, like a database client.

Correct

AWS Glue Studio is a visual tool for building ETL (extract, transform, load) jobs; it does not let you query data. For querying, you use Amazon Athena.

The words 'Studio' and 'query' sound related, and beginners often assume a visual tool must be for exploring data, not for transforming it.

Mistake

Amazon Athena stores the data it queries inside its own managed database.

Correct

Athena does not store any data. It reads data directly from Amazon S3 and writes query results to a specified S3 bucket. There is no database to manage.

Most query tools (like MySQL Workbench or SQL Server Management Studio) work with a database that stores the data. Beginners assume Athena works the same way.

Mistake

You must write complex Python or Scala code to use AWS Glue Studio.

Correct

AWS Glue Studio provides a drag-and-drop visual interface that automatically generates the code for you. You can build ETL jobs without writing any code.

The word 'programming' is often associated with Python/Scala in Glue's documentation, so beginners miss that the Studio UI eliminates the need for manual coding.

Mistake

Once you create an AWS Glue job, it automatically runs every time new data arrives in S3.

Correct

AWS Glue jobs are triggered either manually, on a schedule (cron), or by an event (e.g., a new file uploaded to S3 via EventBridge). The trigger must be explicitly configured.

Beginners think automation means 'set and forget with no configuration', but most AWS services require explicit event rules to automate triggers.

Mistake

AWS Glue and Amazon Athena are the same service because they both work with data in S3.

Correct

They are complementary but distinct services. AWS Glue transforms (changes) the data; Amazon Athena queries (reads) the data without changing it. They use the same Data Catalog but serve different purposes.

Because both services are serverless and accessed via the AWS console, beginners conflate their purposes.

Mistake

Athena queries always return results instantly, regardless of data size.

Correct

Athena query speed depends on the amount of data scanned, file format (Parquet is faster), and whether the table is partitioned. Large, unpartitioned CSV files can take minutes and cost a lot.

Serverless services are often perceived as 'instant', but Athena's performance is directly tied to how you organise your data and write your queries.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

Do I need to provision servers for AWS Glue and Athena?

No, both AWS Glue and Amazon Athena are serverless services. AWS manages all the underlying infrastructure for you. You only pay for the resources consumed when your jobs run or your queries execute.

Can I use Athena to query data that is not in Amazon S3?

Athena is designed to query data stored in Amazon S3. It can also query data from other sources like AWS Glue Data Catalog tables that reference S3, as well as federated queries via Athena connectors to databases like Amazon Redshift or MySQL.

What is the difference between AWS Glue and AWS Glue Studio?

AWS Glue is the core ETL service that runs the actual data transformation code. AWS Glue Studio is a visual user interface (a web-based IDE) that makes it easier to build, edit, and manage Glue ETL jobs without writing code manually.

How do I reduce costs when using Amazon Athena?

Use columnar file formats like Parquet or ORC, partition your tables by a commonly filtered column (like date), compress your data, and write queries that filter as much data as possible (using WHERE clauses on partitioned columns).

Can AWS Glue and Athena work with real-time streaming data?

AWS Glue can process streaming data using AWS Glue Streaming ETL jobs, but this is more advanced. Standard Glue ETL jobs are batch-oriented. Athena is designed for ad-hoc, interactive queries on static data in S3, not real-time streams.

Do I need to write SQL to use Amazon Athena?

Yes, Athena uses standard SQL (Structured Query Language) to query data. You must be comfortable writing basic SQL commands like SELECT, WHERE, GROUP BY, and JOIN to use Athena effectively.

What happens if my raw data's schema changes (e.g., new columns added)?

You can run an AWS Glue Crawler on a schedule so it automatically detects schema changes and updates the Glue Data Catalog. Your Glue ETL jobs and Athena queries can then adapt to the new schema.

Terms Worth Knowing

Keep going

You've finished Data Transformation and Querying with AWS Glue Studio and Amazon Athena. Continue through the DEA-C01 study guide to build a complete picture of the exam.

Done with this chapter?