Hello! Welcome back to our final module, Exam Preparation and Scenario Analysis.
In our previous lesson, we covered the first crucial step in a data pipeline: ingestion. We learned how to select the right service—like Kinesis, MSK, or DMS—by analyzing the data's velocity, volume, and variety. Once that data is successfully ingested and landed in our S3 data lake, the real work begins: transformation.
This lesson directly addresses that next step, focusing on the learning outcome: Select the appropriate transformation service (e.g., Glue, EMR, Lambda) based on data scale, complexity, and latency. Just like with ingestion, the AWS Certified Data Engineer - Associate exam will expect you to analyze a scenario and justify your choice of transformation tool. We'll break down the key decision factors:
- Data Scale: How much data are you processing? Kilobytes, gigabytes, or petabytes?
- Complexity: What kind of logic is required? Simple filtering, or complex multi-stage joins and aggregations?
- Latency: How quickly does the job need to start and finish? Are you transforming events in seconds or running a nightly batch job over hours?
- Operational Overhead & Cost: How much effort are you willing to put into managing infrastructure, and what is the cost model?
Let's dive into the three main contenders for data transformation in the AWS ecosystem.
An Overview of Transformation Services
First, let's get a high-level overview of where AWS Lambda, AWS Glue, and Amazon EMR fit into the data engineering landscape.
Top AWS Services A Data Engineer Should Know
This clip from the 'DataEng Uncomplicated' channel provides a quick introduction to Lambda, Glue, and EMR in the context of a data pipeline. It frames the initial choice based on data volume and job duration.
Please watch these two short segments: Batch Ingestion Services (01:19 - 03:08): Pay attention to the initial sizing recommendations: Lambda for small, quick jobs; Glue for large serverless jobs; and EMR for cluster-based processing. Data Transformation in S3 (04:56 - 05:38): This part reinforces that these same three services are used for the transformation stage within the data lake.
As the video illustrates, these services are not mutually exclusive; they are tools in your toolbox, each suited for a different type of job. Let's analyze each one in more detail.
1. AWS Lambda: For Lightweight, Event-Driven Transformations
Given your background, you've likely encountered Lambda functions. In data engineering, they serve as the perfect tool for small-scale, event-triggered transformations.
- Compute Model: Serverless functions. No infrastructure to manage.
- Best For: Simple, short-running tasks.
- Key Characteristics:
- Event-Driven: Often triggered by an S3
PutObjectevent. A new file arrives, and Lambda processes it instantly. - Short Execution Time: Has a hard limit of 15 minutes. This is a critical constraint.
- Limited Resources: You configure the memory, which also determines the CPU allocation. It's not designed for heavy computational tasks.
- Event-Driven: Often triggered by an S3
- Common Use Cases:
- Converting a small file from one format to another (e.g., CSV to JSON).
- Enriching a single record with data from an API call.
- Validating and moving files from a "landing" zone to a "raw" zone in S3.
- Triggering a larger AWS Glue job.
To see a direct comparison of when to use Lambda versus a more powerful service like Glue, please review the following resource.
AWS Glue, Lambda, S3, EMR, Athena and IAM
This article from Medium provides excellent, detailed explanations of the core data services. We'll focus on the sections covering Lambda and the direct comparison table.
Please read the following sections: AWS Lambda: Read the introduction, key features, and common use cases to solidify its role in data pipelines. When to Use AWS Glue vs. AWS Lambda: Study this comparison table carefully. It's a perfect summary of the trade-offs.
Anti-Pattern: A common mistake is trying to perform large-scale ETL (e.g., processing a 100 GB file or performing complex joins) within a Lambda function. If your job might take more than 15 minutes or requires the distributed processing power of Spark, Lambda is the wrong tool.
2. AWS Glue: The Serverless ETL Powerhouse
When your data volume and complexity grow beyond what Lambda can handle, AWS Glue is typically the next service to consider. It provides the power of Apache Spark in a fully managed, serverless package.
- Compute Model: Serverless Apache Spark. You provision capacity in Data Processing Units (DPUs) for the duration of the job.
- Best For: Most standard batch ETL workloads, from hundreds of gigabytes to terabytes.
- Key Characteristics:
- Serverless: No clusters to manage, patch, or secure. AWS handles the infrastructure.
- Scalable: You can allocate up to 100 DPUs by default, providing significant processing power.
- Integrated: Works seamlessly with the Glue Data Catalog, S3, and other AWS data stores.
- Common Use Cases:
- Nightly batch jobs to transform and aggregate raw data.
- Converting large datasets into analytics-friendly columnar formats like Parquet or ORC.
- Joining multiple large datasets together.
- Cleaning and partitioning data for optimal query performance in Athena.
3. Amazon EMR: Maximum Flexibility and Scale
For the largest and most complex big data workloads, or when you need more control than Glue provides, you turn to Amazon EMR (Elastic MapReduce).
- Compute Model: Managed clusters of EC2 instances. You have full control over the cluster configuration.
- Best For: Massive-scale data processing (petabytes), machine learning, and when you need frameworks beyond Spark.
- Key Characteristics:
- Flexibility: You can install a wide range of open-source frameworks like Spark, Hadoop, Hive, Presto, and Flink. You also have root access to the nodes for custom software installation.
- Control: You choose the instance types, configure scaling policies, and manage the software versions.
- Cost: Can be more cost-effective than Glue for long-running, stable workloads, especially when using Spot Instances. However, there's a cost even when the cluster is idle.
- Common Use Cases:
- Processing petabyte-scale datasets.
- Running complex machine learning model training at scale with Spark MLlib.
- Interactive SQL queries on massive datasets using Presto or Hive.
- When you have specific security or software requirements that Glue's environment cannot meet.
Glue vs. EMR: The Core Decision
Choosing between Glue and EMR is a classic exam scenario. It boils down to a trade-off between serverless convenience (Glue) and granular control (EMR).
AWS Glue ETL Vs EMR - Which one should I use?
This video by Johnny Chivers is dedicated entirely to comparing AWS Glue and EMR. It provides an excellent breakdown of the use cases, administrative overhead, and cost implications.
Please watch the entire video (approximately 7.5 minutes). Focus on: The fundamental difference: Glue as a serverless ETL tool vs. EMR as a big data platform. The administrative overhead and human resource cost associated with EMR. The cost comparison, including why Glue can be cheaper despite a higher per-unit cost. The specific scenarios where EMR is the only or better choice (e.g., needing more than Glue's max capacity, using non-Spark frameworks).
The Decision Matrix: A Summary
Let's consolidate everything into a clear comparison. This image provides an excellent visual summary for choosing between the three services.

To further solidify your mental model, you can think of it as a decision tree.
Picking the Right AWS Tool: Lambda vs Step Functions ...
This article offers a practical, scenario-based approach to choosing AWS services. We'll focus on its summary sections, which provide a great mental model for the exam.
Please review the following sections: EMR-based Approach (and Glue): Read this for a concise summary of when to use these heavy-lifters. Anti-Patterns (Smell Checks): This is extremely valuable for the exam. Knowing when not to use a service is as important as knowing when to use it. A Practical Decision Tree (mental model): Review this numbered list. It's a fast and effective way to approach scenario questions.
Test your understanding!
You are presented with three different data transformation scenarios. For each one, choose the most appropriate service (Lambda, Glue, or EMR) and briefly justify your choice.
Scenario A:
Every 5 minutes, a new 50 KB JSON file containing sensor readings is uploaded to an S3 bucket. You need to read the file, add a processed_timestamp field with the current time, and save the output as another JSON file in a different S3 prefix.
Scenario B:
A partner company sends a 300 GB compressed CSV file to your S3 bucket every night. Your task is to run a job that reads this file, joins it with a 50 GB customer dimension table also in S3, calculates new sales metrics, and writes the output in Parquet format, partitioned by date. The entire process needs to be automated and run without manual intervention.
Scenario C:
A data science team has developed a custom fraud detection model using the Flink framework. They need to run this model on a continuous stream of transaction data ingested via Kinesis. They require fine-grained control over the cluster environment to install specific Python libraries and monitor memory usage closely.
Show answer
Scenario A: AWS Lambda
- Justification: The data volume is very small (50 KB), the transformation logic is simple (adding a timestamp), and the task is event-driven (triggered by a new file). This is a perfect use case for Lambda. It's cost-effective, fast, and has zero operational overhead. Using Glue or EMR would be massive overkill.
Scenario B: AWS Glue
- Justification: This is a classic batch ETL job. The data volume is significant (300 GB + 50 GB), requiring the distributed processing power of Spark to perform the join efficiently. Since it's a standard Spark ETL job with no exotic requirements, AWS Glue is the ideal choice. It provides the necessary power in a serverless model, eliminating the need to manage a cluster for a job that runs only once a day. This is more cost-effective and operationally simpler than provisioning an EMR cluster.
Scenario C: Amazon EMR
- Justification: The key requirements here are the specific framework (Flink) and the need for fine-grained control over the cluster environment (installing custom libraries, monitoring). AWS Glue only supports Spark and Python shell jobs. Amazon EMR is the only service of the three that supports Flink and provides the necessary control and flexibility to create a custom runtime environment for the data science team.
Conclusion
You now have a robust framework for selecting the right AWS transformation service. By evaluating the scale, complexity, latency, and operational requirements of a task, you can confidently choose the most efficient and cost-effective tool for the job.
Key Takeaways:
- AWS Lambda: Use for small-scale, event-driven, and short-running (<15 mins) transformations.
- AWS Glue: Your default choice for serverless, scalable, batch ETL using Apache Spark. Ideal for most standard transformation jobs.
- Amazon EMR: Use when you need maximum flexibility, frameworks other than Spark (like Flink, Presto), or have massive-scale workloads that require fine-grained cluster control.
Next Up:
We've ingested our data and transformed it into a clean, usable format. The final step in our pipeline before analysis is to store it in a way that enables efficient querying. In our next lesson, we will tackle the final selection scenario: Select the appropriate storage and query service (e.g., Redshift, Athena, S3) based on query patterns, performance, and cost.