Skip to Content

Amazon EMR

Amazon EMR for running Hadoop and Spark clusters on EC2, its primary, core and task nodes, purchasing options, long-running vs transient clusters, and EMR Serverless.

What it is

Amazon EMR (formerly Elastic MapReduce) helps create Hadoop clusters (big data) to analyse and process vast amounts of data.

  • Clusters can be made of hundreds of EC2 instances.
  • EMR comes bundled with Apache Spark, Hive, HBase, Presto/Trino, Flink and other open-source tools.
  • EMR takes care of provisioning and configuration.
  • Auto scaling, and integration with Spot Instances for lower cost.
  • Reads and writes data in S3 (EMRFS) as well as the cluster's own HDFS.

Use cases: data processing, machine learning, web indexing, big data (when the open-source frameworks or control over the cluster are needed).

Besides clusters on EC2, there's EMR Serverless (run Spark and Hive jobs with no cluster to manage) and EMR on EKS (run Spark on an existing Kubernetes cluster).

Node types and purchasing

Amazon EMR node types: the primary node manages the cluster; core nodes run tasks and store HDFS data; optional task nodes only run tasks and are often Spot Instances; nodes can be On-Demand, Reserved or Spot, and clusters can be long-running or transient Amazon EMR node types: the primary node manages the cluster; core nodes run tasks and store HDFS data; optional task nodes only run tasks and are often Spot Instances; nodes can be On-Demand, Reserved or Spot, and clusters can be long-running or transient

Core nodes hold data; task nodes only compute.
  • Primary node (called the master node in the slides): manages the cluster, coordinates work and tracks health. Long-running. A cluster can run three primary nodes for high availability.
  • Core nodes: run tasks and store data (HDFS). Long-running. Removing them risks losing data.
  • Task nodes (optional): just run tasks, with no data stored. Usually Spot, because losing one only loses work in progress.

Purchasing options:

  • On-Demand: reliable, predictable, won't be terminated. Good for the primary and core nodes.
  • Reserved (1 or 3 years): cost savings; EMR uses them automatically when available.
  • Spot Instances: much cheaper, can be terminated, less reliable. Good for task nodes.

Cluster types:

  • Long-running cluster: stays up and accepts work (the default). Use Reserved Instances for its steady part.
  • Transient (temporary) cluster: starts, runs its steps, then terminates automatically. Billing applies only while the job runs.

Real-world examples

  • A media company runs a transient EMR cluster every night: Spark jobs process the day's clickstream from S3, write results back to S3, and the cluster shuts down.
  • A research team adds Spot task nodes to a long-running cluster to finish a large job faster and cheaper, keeping core nodes on On-Demand so no HDFS data is lost.

Exam tips

  • "Hadoop", "Spark", "Hive", "HBase", "big data cluster" → EMR.
  • "Cheapest compute for EMR that can be interrupted" → Spot task nodes.
  • "Don't lose data if nodes are reclaimed" → keep core nodes On-Demand (or Reserved); use Spot for task nodes.
  • "Run a nightly batch job and pay only while it runs" → transient cluster (or EMR Serverless).
  • "Spark without managing clusters" → EMR Serverless (or Glue for ETL).

Common traps

  • "Run core nodes on Spot to save money." Core nodes store HDFS data; losing them can lose data. Use Spot for task nodes.
  • "EMR is serverless." Classic EMR runs clusters of EC2 instances; only EMR Serverless removes them.

Check yourself

An EMR cluster runs at least three EC2 instances plus an EMR charge per instance, so instead:

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt