AWS Glue vs Lambda for ETL: When to Use Which (And When Neither Is Right)
Last updated: October 2026
Quick answer: Use AWS Glue for batch ETL jobs over 1GB that need Spark, joins, or the Data Catalog. Use Lambda for event-driven transforms on files under about 1GB that finish in under 15 minutes. Use neither for sustained streaming (pick Amazon Managed Service for Apache Flink) or complex multi-step orchestration (pick Step Functions with either service).
The Real Question Nobody Asks
Use AWS Glue for batch ETL jobs processing over 1GB of data with complex transformations, because it handles the Spark infrastructure, job bookmarks and schema evolution for you. Use Lambda for lightweight, event-driven ETL under 1GB where low latency matters, such as S3 triggers, API transformations and small file processing. Use neither for sustained streaming, where Amazon Managed Service for Apache Flink or Amazon MSK is the better fit. AWS markets both services for ETL without explaining clearly where each one stops working. We've built production pipelines with both, and the answer almost always comes down to three things: data volume, execution pattern, and whether you need the Glue Data Catalog.
AWS Glue: The Spark-Powered Workhorse
Glue is Apache Spark under the hood. When you run a Glue ETL job, you're spinning up a Spark cluster managed by AWS. That means you get distributed processing, built-in support for reading/writing Parquet, ORC, JSON, and CSV, and the ability to handle datasets that don't fit in memory on a single machine. AWS Glue 5.1 (Spark 3.5) is the default for new jobs, AWS Glue 6.0 (Spark 4.1) is the newest version, and Glue 0.9, 1.0 and 2.0 reached end of life on 1 April 2026.
When Glue Makes Sense
- Batch processing over 1GB. Spark's distributed engine shines here. A 50GB CSV-to-Parquet conversion that'd take 45 minutes in Lambda (if it even fit) runs in 8 minutes on a Glue G.2X worker with 10 DPUs.
- Complex joins across multiple datasets. If you're joining a 200M-row fact table with dimension tables, Glue handles the shuffle and sort-merge join automatically.
- Data Catalog integration. Glue Crawlers automatically discover schemas from S3, and the Data Catalog becomes the metadata layer for Athena, Redshift Spectrum, and EMR. If you need a shared schema registry, Glue is the native choice.
- Spark SQL workloads. Your team writes SQL? Glue supports Spark SQL natively. Write your transforms in SQL, and Glue compiles them to Spark execution plans.
- PySpark or Scala custom transforms. When you need UDFs, window functions, or custom partition logic that goes beyond what Lambda can handle.
Glue Gotchas You'll Hit
- Cold start is 30-90 seconds - even for tiny jobs. You're waiting for a Spark cluster to spin up. For a job that processes 50 rows, you'll spend more time starting Glue than running the actual transform. Glue Flex jobs help (cheaper, but longer cold starts of 2-5 minutes).
- Glue auto-scaling doesn't always scale down fast enough. You set
--enable-auto-scalingand max workers at 20, but if your job has an initial burst followed by light processing, you might pay for 20 workers for 3 minutes when you only needed them for 30 seconds. - Debugging is painful. Spark error messages are notoriously cryptic. A
Py4JJavaErrorwrapping anAnalysisExceptionwrapping aNullPointerExceptiontells you almost nothing. Enable--enable-continuous-cloudwatch-logand--enable-spark-uifrom day one. - The Glue Crawler isn't magic. It guesses schemas, and it guesses wrong more often than you'd expect. Nested JSON with mixed types? It'll create a schema with
struct<string>where you wanted an array. Define schemas explicitly in the Data Catalog instead of relying on crawlers for production workloads.
AWS Lambda: The Event-Driven Scalpel
Lambda is a single-machine, single-invocation compute function. No clusters, no Spark, no distributed processing. It starts in milliseconds (after the first cold start), runs your code, and shuts down. You pay only for the milliseconds it runs.
When Lambda Makes Sense
- Small file processing. A new CSV lands in S3 at 50MB. Lambda picks it up, converts it to Parquet, writes it to a processed bucket. Done in 12 seconds. Cost: fractions of a cent.
- Real-time triggers from S3, SQS, or Kinesis. An S3
PutObjectevent fires Lambda within seconds. SQS messages arrive in batches of up to 10,000 records per invocation from a standard queue (10 from a FIFO queue), and any batch size above 10 needs a batching window of at least 1 second. Kinesis records stream through Lambda in near-real-time. - API response transformation. An API Gateway endpoint receives a request, Lambda transforms the payload and writes to DynamoDB or S3. Sub-second latency, no infrastructure to manage.
- File format conversion. JSON to Parquet, CSV to JSON, XML to flattened CSV. For files under 500MB, Lambda with the
pyarroworpandaslayer handles this faster and cheaper than Glue. - Lightweight enrichment. Add a timestamp, geocode an address via API, validate a schema. Quick transforms that don't need distributed processing.
Lambda Gotchas You'll Hit
- 15-minute timeout. A standard Lambda function can run for at most 15 minutes, so a longer ETL job has to be split into smaller chunks. Functions on Lambda Managed Instances can run for up to 90 minutes when invoked asynchronously or through most event source mappings, and Lambda durable functions can checkpoint long multi-step work, but both are set up differently from an ordinary function.
- 10GB memory limit. Your function plus its data must fit in 10GB. A 3GB CSV loaded into a pandas DataFrame with joins and aggregations can easily blow past this. The
/tmpdirectory defaults to 512MB and can be configured up to 10GB, with storage above 512MB billed separately. - Cold starts with large deployment packages. If your Lambda uses heavy libraries like
pandas,pyarrow, andnumpy, the first invocation (cold start) can take 3-8 seconds. Use Lambda Layers or container images to mitigate. - Concurrency limits can bite. Default account concurrency is 1,000 concurrent executions, and new AWS accounts start lower until AWS raises the quota with usage. If you have 200 S3 files landing simultaneously, each triggering a Lambda, and each Lambda calls an API with rate limits, you'll hit throttling fast. Set reserved concurrency per function.
- No built-in schema registry. Lambda doesn't know about the Glue Data Catalog unless you explicitly call it. There's no automatic schema discovery or metadata management.
Building this out on your own stack? We build data platforms end to end: ingestion, transformation, orchestration, and the alerting that catches a broken load before your users find it. You get running pipelines and the runbook to operate them, not a reference architecture.
Book a platform call Data engineering servicesWhen Neither Is Right
This is the part most comparison articles skip. There are workloads where both Glue and Lambda are the wrong answer:
- Sustained streaming (sub-second latency). Neither Glue nor Lambda is designed for continuous stream processing. Use Amazon Managed Service for Apache Flink (the service previously called Kinesis Data Analytics) or Amazon Managed Streaming for Apache Kafka (MSK) with Flink consumers. Glue streaming jobs have traditionally run as Spark micro-batches. AWS Glue 6.0 adds a real-time mode for stateless streaming with millisecond-level latency, which is worth testing if your streaming logic keeps no state.
- Complex multi-step orchestration. If your pipeline has 15 steps with conditional branching, retries, and human approval gates, don't try to chain Lambdas or sequence Glue jobs manually. Use AWS Step Functions to orchestrate either (or both) services. See our guide on building pipelines in ADF for a comparison with Azure's orchestration approach.
- Heavy ML feature engineering. If you're building feature pipelines for ML models, you'll outgrow both. Look at Amazon SageMaker Processing or Databricks for feature engineering at scale.
Cost Comparison: DPU-Hours vs GB-Seconds
This is where the decision often gets made. Here's how the math works:
The prices below are US East (N. Virginia) list prices on 15 October 2026.
Glue: $0.44 per DPU-hour, or $0.29 per DPU-hour for Flex jobs, and Spark jobs use at least 2 DPUs. A 10-minute job with 2 DPUs costs about $0.15. A 2-hour job with 10 DPUs costs $8.80. Glue bills per second with a 1-minute minimum, which has applied since Glue 2.0 (Glue 0.9 and 1.0 had a 10-minute minimum).
Lambda: $0.0000166667 per GB-second (x86, first pricing tier). A function with 1GB memory running for 60 seconds costs $0.001. Running that 1,000 times per day costs $1/day. But bump to 10GB memory and 900 seconds (15 min), and you're at $0.15 per invocation - suddenly comparable to Glue.
Rule of thumb: For jobs that run less than 5 minutes and need less than 3GB memory, Lambda is almost always cheaper. For jobs that process more than 5GB of data or run longer than 10 minutes, Glue is typically more cost-effective per GB processed because Spark's distributed processing finishes faster.
Decision Flowchart (Text Version)
- Is your data over 10GB per job? Yes → Glue. Lambda physically can't handle it.
- Does the job need to finish in under 2 seconds? Yes → Lambda (warm) or neither (consider DynamoDB Streams + Lambda).
- Do you need continuous streaming? Yes → Neither. Use Amazon Managed Service for Apache Flink, or Flink consumers on MSK.
- Is it triggered by an event (S3, SQS, API Gateway)? Yes + data under 1GB → Lambda. Yes + data over 1GB → Lambda triggers Glue.
- Do you need the Glue Data Catalog? Yes → Glue (or Lambda + Glue Catalog API calls, but that's extra work).
- Is it a scheduled batch job over 1GB with joins? Yes → Glue.
- Is it a simple file transform under 500MB? Yes → Lambda.
- Still not sure? Start with Lambda. It's easier to prototype. Migrate to Glue when you hit Lambda's limits.
Key Takeaways
- Glue = Spark cluster for heavy batch ETL. Lambda = single-machine function for lightweight, event-driven transforms.
- Glue's cold start (30-90s) makes it wrong for low-latency workloads. Lambda's 15-min timeout makes it wrong for large batch jobs.
- For sustained streaming, skip both and use Amazon Managed Service for Apache Flink.
- Cost crossover point is roughly 5 minutes / 3GB - below that, Lambda wins; above that, Glue wins.
- The best architecture often uses both: Lambda for event handling and triggering, Glue for the heavy processing.
Frequently Asked Questions
Q: Is AWS Glue better than Lambda for ETL?
It depends on data volume and workload pattern. Glue is better for batch processing over 1GB with complex joins and Spark SQL. Lambda is better for event-driven, lightweight transforms on files under about 1GB with sub-minute latency requirements. Neither is universally better.
Q: What is the maximum timeout for AWS Lambda?
A standard Lambda function has a maximum timeout of 15 minutes and a memory limit of 10GB. Functions on Lambda Managed Instances can run for up to 90 minutes when invoked asynchronously or through most event source mappings. If your ETL job regularly exceeds these limits, Glue or Step Functions with Glue is a better fit.
Q: How much does AWS Glue cost compared to Lambda?
Glue charges per DPU-hour (roughly $0.44/DPU-hour). Lambda charges per GB-second of compute ($0.0000166667/GB-second). For small, frequent jobs Lambda is cheaper. For large batch jobs running 30+ minutes, Glue often costs less per GB processed.
Q: Can I use both Glue and Lambda together for ETL?
Yes, and many teams do. A common pattern is Lambda for lightweight event-driven triggers (file arrival, API calls) that orchestrate or kick off Glue jobs for heavy processing. Step Functions can coordinate both.
Related Articles
Still have questions?
Get AssistanceReady? Let's Talk!
Get expert insights and answers tailored to your business requirements and transformation.
Get Assistance