VAYULearn
Colour theme
Investigate a failure
VAYU Learn

AWS Data Engineering

AWS Glue vs EMR vs Athena: Choosing the Right Compute for the Job

DataForge AWS Data Engineering Series - Blog 7 of 20

AWS Data Engineering

The team had been running the same daily aggregation job on Glue for a year. 2TB of data, transformed and written to S3, taking about 40 minutes and costing roughly $35 per run. Someone finally asked why it wasn’t just an Athena query with a CREATE TABLE AS SELECT — the same transformation, no Spark cluster, no DPU allocation, no job to maintain.

The answer, once they tried it: the Athena version ran in 90 seconds and cost $1.20.

Nobody had made a wrong decision a year ago — Glue was a reasonable default when the pipeline was first built, and the team that built it didn’t know Athena’s CTAS pattern could replace an entire class of Glue jobs. The cost of that gap wasn’t a single bad choice. It was twelve months of $35 runs that should have been $1.20 runs, compounding quietly because nobody revisited the decision once the pipeline was “working.”

This is the recurring theme across AWS’s compute layer: Glue, EMR, and Athena all solve overlapping problems, and the wrong choice doesn’t fail loudly — it just costs more or takes longer than it should, indefinitely, until someone happens to compare it against the alternative.

Let’s go deep.


TL;DR

Glue, EMR, and Athena all process data, but they occupy genuinely different points on the control-vs-convenience spectrum, and the correct choice depends on data volume, job frequency, transformation complexity, and how much Spark configuration control you actually need. Defaulting to whichever service you learned first — rather than the one the workload calls for — is the single most common source of AWS data engineering cost waste.

By the end of this article you’ll be able to:

  • Apply a concrete decision framework instead of defaulting to a familiar service
  • Calculate real cost comparisons across all three services for the same workload
  • Recognize the specific signals that indicate you’ve outgrown Glue and need EMR, or that you’re overusing Glue when Athena would suffice
  • Understand where the boundaries genuinely blur and both choices are defensible

Series context: This article assumes you’ve read Blog 5 (Glue) and Blog 6 (Redshift, which shares query characteristics with Athena). It completes the compute-layer picture from Blog 1 before Blog 12 goes deep on Athena specifically.

Same 2TB daily job, three services, three costs - $35 on Glue, $1.20 on Athena, ~$4 on EMR spot. The wrong choice doesn’t fail. It just costs 10-30x more, indefinitely, until someone compares it against the alternative.

The Three Services, Positioned Correctly

Before any decision framework, the services need to be understood as occupying different positions on a single spectrum — not as three unrelated tools.

          Control                          Convenience
<──────────────────────────────────────────>
     EMR                      Glue                    Athena
| | |
Full Spark config Managed Spark, No cluster,
control, spot some config no infra,
instances, control, DPU pay per
persistent or billing, cold query,
transient start overhead SQL-only
clusters

What this spectrum actually represents: EMR gives you a Spark cluster you fully control — every configuration parameter available, at the cost of managing that cluster’s lifecycle. Glue gives you Spark without cluster management, at the cost of some configuration flexibility and a cold-start tax on every run. Athena gives you a query engine with zero infrastructure at all, at the cost of only supporting SQL — no arbitrary transformation logic, no custom Python libraries, no complex multi-stage pipelines within a single job.

The mistake that costs teams money: treating this as “pick one and use it for everything” rather than “pick the right point on this spectrum for each specific workload.” A mature AWS data platform uses all three, deliberately, for different jobs.


The Decision Framework

Question 1: Is this a SQL-expressible transformation on
data already in S3 or a supported source?
YES -> Athena is likely the answer. Continue to Question 2.
NO -> You need Spark (Glue or EMR). Skip to Question 3.
Question 2: Does the query need to run frequently
(many times per day) or does result caching
not help (constantly changing data)?
Frequent + repeatable -> Athena, possibly with CTAS to
materialize results
Ad hoc, occasional -> Athena, straightforward
(Athena is very rarely the WRONG choice for pure SQL
transformations - the main risk is cost from scanning
unoptimized data, covered in Blog 2 and Blog 12)
Question 3: What's the data volume per job run, and how
often does it run?
< 100GB, periodic (hourly/daily) -> Glue
100GB - low TBs, periodic -> Glue, evaluate EMR if slow
> 10TB, periodic -> EMR (spot instances for cost control)
Continuous/streaming -> EMR (persistent) or a streaming
service (Blog 8/9), not Glue
Question 4: Does the job need Spark configuration control
beyond what Glue exposes - custom shuffle
tuning, specific instance types, GPU nodes,
non-standard library versions?
YES -> EMR, regardless of data volume
NO -> Glue remains appropriate

How the Same Workload Costs Differently: The Mechanism

This is the calculation worth running for real, because the opening scenario’s $35-vs-$1.20 gap is not an edge case — it’s a structural consequence of what each service is actually built to do.

Workload: aggregate 2TB of Parquet events data in S3,
grouped by date and region, write result to
a new S3 location. Runs once daily.
Option A: Glue job
Realistic configuration for 2TB (accounting for actual
memory needs, shuffle overhead, and safety margin most
teams add): 30 workers, G.2X (2 DPU each) = 60 DPU
Runtime: ~35 minutes
Cost: 60 x (35/60) x $0.44 = $15.40 per run
Add: crawler runs before/after (~$0.50-1.00),
CloudWatch Logs, occasional retries
Realistic total: $18-35/month range depending on
exact configuration and retry frequency
Option B: Athena CTAS
CREATE TABLE gold.daily_summary
WITH (format = 'PARQUET', external_location = 's3://...')
AS
SELECT event_date, region, SUM(revenue) as total_revenue
FROM silver.events
WHERE event_date = CURRENT_DATE - INTERVAL '1' DAY
GROUP BY event_date, region;
Data scanned: with proper partitioning (Blog 2),
only ONE day's partition is scanned,
not the full 2TB historical table
Scanned volume: ~7GB (one day's partition, Parquet,
compressed)
Cost: 7GB x $5/TB = $0.035, rounded up to Athena's
minimum billing granularity
Realistic total: under $1.20/run including minimums
Option C: EMR (for comparison, at this data volume)
Cluster: 5 x m5.xlarge spot instances
Startup: ~8-10 minutes (EC2 provisioning + Spark init)
Runtime: ~25 minutes processing (spot instances,
optimized Spark config)
Cost: instance-hours x spot price + EMR surcharge
= roughly $3-5 per run at spot pricing
EMR is competitive with Glue at this volume when using
spot instances, but the cluster management overhead
isn't justified unless this job is one of MANY similar
jobs sharing a persistent or frequently-reused cluster.

The lesson embedded in this calculation: the workload in the opening scenario was never a Spark transformation problem — it was a SQL aggregation problem that Glue was solving with a full Spark cluster spin-up every single day. Athena’s CTAS pattern does the identical SQL operation without any cluster at all, and because the source data was partitioned by date (Blog 2’s principles paying off again), it only scans the relevant partition instead of the full table.


When Glue Is Actually the Right Answer

Glue earns its place when the workload genuinely needs Spark’s transformation capabilities beyond what SQL expresses cleanly, but doesn’t need EMR’s configuration depth.

Signals that Glue is correct:
- Transformation logic involves complex Python/Scala code,
not expressible as a single SQL statement
- Data has schema inconsistency requiring DynamicFrame
handling (Blog 5's ResolveChoice pattern)
- Job needs incremental processing via bookmarks
(Blog 5's bookmark mechanism)
- Job runs periodically (not continuously) at moderate
volume (up to a few TB per run)
- Team doesn't have deep Spark tuning expertise and
values not managing cluster infrastructure
- Job needs native integration with Glue Data Catalog
for schema management

The concrete example where Glue beats both alternatives: a Bronze-to-Silver transformation that needs to deduplicate records using a window function, apply complex conditional business logic across a dozen columns, handle inconsistent nested JSON structures, and update the Glue Catalog with the resulting schema — none of this maps cleanly to a single Athena SQL statement, and none of it requires EMR’s level of Spark configuration control.


When EMR Is Actually the Right Answer

EMR earns its place when data volume, job frequency, or configuration requirements exceed what Glue’s abstraction comfortably provides.

Signals that EMR is correct:
- Data volume per job exceeds several TB, where Glue's
cold-start overhead becomes a small fraction of total
time but DPU costs at that scale exceed EMR spot
instance costs
- Multiple related jobs can share a persistent or
long-running transient cluster, amortizing startup
cost across many jobs instead of paying it per job
- Job needs specific Spark configuration (custom shuffle
partition tuning, specific executor memory ratios,
non-default garbage collection settings) that Glue's
abstraction doesn't expose directly
- Workload needs Presto/Hive/other engines in the same
cluster alongside Spark
- Cost optimization via spot instances matters more than
operational simplicity for this specific workload

The concrete example where EMR beats Glue: a data platform running 15 different transformation jobs nightly, all needing similar Spark configuration, processing a combined 50TB. A persistent EMR cluster (or a long-running transient cluster spanning the batch window) amortizes the cluster startup cost across all 15 jobs instead of paying Glue’s cold-start tax 15 separate times, and spot instance pricing on EMR at this volume typically undercuts Glue’s DPU-hour pricing significantly.


When Athena Is Actually the Right Answer

Athena earns its place whenever the transformation is expressible in SQL and the source data is reasonably well-organized — which is a larger fraction of real workloads than most teams initially assume.

Signals that Athena is correct:
- The transformation is a SELECT, GROUP BY, JOIN, or
window function - nothing requiring general-purpose
programming logic
- Source data is partitioned and in a columnar format
(Blog 2's principles) - Athena's cost scales with
what's actually scanned, not total table size
- The output can be materialized via CTAS or INSERT INTO,
replacing what would otherwise be a scheduled ETL job
- Ad hoc or infrequent analysis where standing up any
persistent infrastructure is wasteful
Signals that Athena is the WRONG choice:
- Source data is NOT partitioned or is in row-based
format (CSV/JSON) - the same query that costs $1.20
against Parquet can cost $40+ against unoptimized CSV
- Very high query concurrency with complex joins -
Redshift (Blog 6) handles this pattern better
- Query complexity genuinely exceeds SQL's expressiveness

The overlooked Athena capability that replaces entire Glue pipelines: CREATE TABLE AS SELECT (CTAS) and INSERT INTO ... SELECT let Athena materialize query results as new tables — meaning any Glue job that's fundamentally "read from Catalog, run a SQL-expressible aggregation, write back to S3, update Catalog" can often be replaced entirely by a scheduled Athena query, orchestrated via EventBridge or Step Functions instead of a Glue job definition.


The Boundary Cases Where Reasonable Engineers Disagree

Not every decision is clean. Some workloads genuinely sit at the boundary, and the “right” answer depends on factors beyond pure technical fit.

Boundary 1: Moderate-complexity SQL-expressible
transformation, but the team is already
deeply invested in Glue tooling and CI/CD
Technically: Athena might be cheaper and faster
Practically: if the team has mature Glue deployment
pipelines, monitoring, and expertise,
the migration cost to Athena might not
be worth it for one job - but IS worth
it if this pattern repeats across many jobs
Boundary 2: Data volume around 1-3TB, periodic job
This is squarely in the range where Glue and EMR
cost roughly the same, and the deciding factor becomes
team expertise and whether other jobs can share
infrastructure - not a clear technical winner
Boundary 3: A transformation that's 90% SQL-expressible
but needs one complex custom function
Athena supports some UDF capability and Lambda-backed
functions, which may close this gap without needing
to fall back to Glue entirely - worth checking before
assuming Spark is required

The honest engineering position: these boundary cases don’t have a universally correct answer, and pretending otherwise produces cargo-cult decision-making. What matters is that the decision is made deliberately, with the cost and complexity trade-offs understood — not defaulted to out of familiarity.


Architecture Flow: A Platform Using All Three Deliberately

Data arrives in S3 (Bronze)
|
+-- Complex transformation, schema inconsistency,
| needs bookmarks
| |
| v
| Glue Job -> S3 (Silver)
|
+-- Simple SQL aggregation, data already
| partitioned and columnar
| |
| v
| Athena CTAS -> S3 (Silver/Gold)
|
+-- Very large volume (10TB+), or shares
infrastructure with many similar jobs
|
v
EMR (persistent or transient
cluster, spot instances) -> S3
All three converge on:
|
v
S3 Silver/Gold (Blog 2's layout principles)
|
v
Serving layer: Athena (ad hoc) or Redshift
(high-concurrency, Blog 6)

Failure Modes You’ll See in Production

The Glue job that should have been an Athena query. The opening scenario. A SQL-expressible aggregation runs as a Glue job indefinitely because nobody revisited the original service choice after the team learned Athena’s CTAS pattern. The cost gap compounds silently, invisible because the Glue job “works” and nobody has a side-by-side comparison to notice the waste.

EMR adopted prematurely for a workload Glue could handle. A team anticipating future scale builds EMR infrastructure — cluster provisioning, spot instance configuration, custom AMIs — for a workload that’s currently 200GB/day and growing slowly. The operational overhead of managing EMR (patching, monitoring cluster health, tuning Spark configuration) isn’t justified by the current or near-term data volume, and the team spends more engineering time on infrastructure than the workload warrants.

Athena used against unpartitioned data, appearing to “fail” at cost efficiency. A team tries Athena for a workload, finds it expensive, and concludes “Athena doesn’t work for us” — without realizing the underlying data was unpartitioned CSV (Blog 2’s failure mode), not a fundamental limitation of Athena itself. They migrate back to Glue, paying more than necessary for infrastructure that was never the actual problem.

Glue jobs and Athena queries both hitting the same table with no coordination. A Glue job writes to a Silver table on a schedule while Athena CTAS queries also write to overlapping paths for ad hoc analysis. Without clear ownership boundaries, the two processes occasionally clash — a Glue job partially overwrites data an Athena query was mid-read on, producing inconsistent results with no error indicating the cause.

Choosing EMR for cost savings but underestimating the operational cost. A team migrates several Glue jobs to EMR specifically to leverage spot instance pricing, achieving a genuine reduction in compute cost — but doesn’t account for the engineering time now required to manage cluster bootstrap scripts, monitor spot instance interruptions, and handle Spark configuration tuning that Glue previously abstracted away. The total cost of ownership, including engineering time, isn’t clearly better.


Trade-offs: The Meta-Trade-off Across All Three

What this comparison reveals structurally:

Every AWS compute service trades operational control for operational simplicity, at a specific point on the spectrum. There is no service that is unconditionally “best” — there’s only the service that matches a specific workload’s volume, frequency, complexity, and team expertise.

The trade-off data engineers actually manage:

  • Glue trades some Spark control for zero cluster management — correct for the majority of periodic ETL
  • EMR trades operational simplicity for full control and better economics at scale — correct when volume or configuration needs justify it
  • Athena trades transformation flexibility (SQL only) for zero infrastructure and pay-per-query economics — correct far more often than teams initially assume, specifically because most data transformations are fundamentally SQL operations

The honest trade-off: the “right” choice changes as a workload’s volume and requirements evolve. A job correctly built on Glue at launch may deserve migration to Athena once the team understands CTAS, or to EMR once volume justifies dedicated infrastructure. Treating the initial choice as permanent is itself the mistake — the decision deserves periodic revisiting, not just an initial correct answer.


Real-World Constraints

Migration cost is real and should be weighed against savings. Moving a working Glue job to Athena or EMR isn’t free — it requires rewriting transformation logic, updating orchestration (Blog 11), and testing for behavioral parity. For a job costing $5/month more than the optimal alternative, migration effort may not be worth it. For a job costing $35/month against a $1.20/month alternative, running for years, the math changes substantially.

Team expertise is a legitimate constraint, not just a preference. A team with deep SQL expertise and no Spark experience will be more productive and make fewer mistakes on Athena-based pipelines than forcing themselves into Glue or EMR for workloads that could go either way. Technical optimality and team capability both matter in the real decision.

Athena’s SQL dialect and Presto/Trino engine have specific limitations. Not every SQL pattern that works in Redshift or a traditional database translates directly to Athena’s engine. Certain complex window function patterns, specific date/time handling, and some join optimization behaviors differ — worth validating early rather than assuming full SQL portability.


What This Means for the Rest of the Series

Blog 12 (Athena): goes deep on the partitioning,
workgroups, and cost optimization
techniques that make Athena the
right default for SQL-expressible
workloads
Blog 13 (Medallion on AWS): shows a concrete architecture
using Glue for Bronze-to-Silver
transformation and Athena for
Silver-to-Gold aggregation -
applying this article's
framework in practice
Blog 18 (Cost optimization): revisits this comparison
specifically through a cost
audit lens, with a checklist
for identifying Glue jobs
that should be Athena queries

Summary: The Engineering Lesson

Glue, EMR, and Athena are not competitors where one wins universally. They’re three points on a control-versus-convenience spectrum, and the correct engineering practice is choosing deliberately based on the workload’s actual characteristics — not defaulting to whichever service the team learned first and never revisiting that choice as understanding grows.

The year of $35 Glue runs that should have been $1.20 Athena queries wasn’t a failure of technical skill. It was a failure to revisit an early, reasonable decision once new information (the CTAS pattern) made a cheaper alternative available. That gap — between “this decision was reasonable when made” and “this decision remains correct today” — is where most AWS compute cost waste actually lives.

The framework in this article isn’t a one-time decision tool. It’s a periodic audit question: for every recurring job in your pipeline, does the service it’s running on still match what the workload actually needs?


Next in Series

Blog 8 - Amazon Kinesis: Real-Time Streaming on AWS

Everything covered so far — Glue, EMR, Athena, Redshift — operates on data that’s already landed somewhere. Blog 8 moves to the front of the pipeline: getting data into the system in real time, and the specific mechanics of Kinesis shards, consumer checkpointing, and the Firehose delivery pattern that most streaming-to-S3 pipelines actually use.

We’ll go deep on where Kinesis genuinely earns its place over simpler batch alternatives, and where teams reach for streaming infrastructure they don’t actually need — the same “right tool for the workload” discipline from this article, applied to the ingestion layer.


Comment Below

What’s the most expensive “wrong service” decision you’ve caught in an AWS data pipeline — yours or someone else’s?

Was it a Glue job that should have been a simple Athena CTAS query, quietly costing 10–30x more for a year before anyone compared the alternatives? An EMR cluster built for anticipated scale that never materialized, while the team paid for operational complexity they didn’t need? A workload that outgrew Glue’s DPU economics but nobody noticed until the bill did?

And — what made someone finally go back and check?


Tags: aws-data-engineering, aws-glue, amazon-emr, amazon-athena, cost-optimization, compute-comparison, ctas, spark, dataforge