🐘 Amazon EMR
Amazon EMR (Elastic MapReduce) is a managed big data platform that runs Apache Spark, Hadoop, HBase, Presto, and other frameworks for processing massive datasets. It's the AWS service for large-scale data processing and analytics.
🔑 Covers: EMR Basics · Apache Spark/Hadoop · S3 Integration · Use Cases · Cost OptimizationWhat is Amazon EMR?
🔧 Core Frameworks EMR Supports
⚡ Apache Spark
The most popular big data processing engine. In-memory processing makes it 100x faster than Hadoop MapReduce for iterative algorithms. Used for: ETL, machine learning (MLlib), graph processing, streaming (Spark Streaming).
🐘 Apache Hadoop MapReduce
The original big data framework. Processes data in two phases: Map (transform each record) and Reduce (aggregate results). Disk-based processing — slower than Spark but handles datasets larger than memory.
🔍 Apache Hive / Presto
SQL-like query interfaces on top of big data. Hive translates SQL to MapReduce/Spark jobs. Presto is a fast SQL query engine for interactive analytics on large datasets in S3.
🏗️ EMR Cluster Architecture
📦 S3 Integration — The Key Optimization Pattern
Instead of storing data in HDFS (on EC2 disks), store data in S3. This is the most important EMR optimization pattern for cost:
✅ With S3 (Recommended)
- Data persists after cluster terminates
- No storage cost during idle time
- Spin up/down clusters as needed
- Multiple clusters can share the same data
- S3 scales infinitely
HDFS (Only for temp data)
- Data stored on EC2 disks (lost when cluster stops)
- Faster for iterative algorithms (data is local)
- Use HDFS only for intermediate processing results
- Store final results and source data in S3
💰 EMR Cost Optimization
- Spot Instances for Task Nodes: Task nodes don't store data → safe to use Spot (cheap). Can reduce cost by 70-90%.
- Transient clusters: Spin up only when needed, terminate after job completes. No cost when idle.
- Right-sizing: Use Compute Optimizer recommendations for EC2 instance types.
- EMR Serverless: Newer option — no cluster management, pay only for compute used during job runs.