Lesson 5 of 7 Analytics: Data Lakes, Athena, Glue, EMR, Redshift and QuickSight

Running Big Data Frameworks with Amazon EMR

This lesson explains how Amazon EMR runs open-source big data frameworks, such as Apache Spark, Hive, Presto and HBase, at scale on managed clusters or serverless capacity.

Learning outcomes

After completing this lesson, you will be able to:

  • Choose between EMR on EC2, EMR on EKS and EMR Serverless.
  • Describe the primary, core and task nodes of an EMR on EC2 cluster.

Deployment options

Amazon EMR can run in three ways, which trade control against management. EMR on EC2 runs clusters of instances in three roles: a primary node that coordinates the cluster, core nodes that run tasks and store data, and task nodes that only run tasks and suit Spot Instances. It gives full control of instances and configuration. EMR on EKS runs Spark jobs on an existing Kubernetes cluster, sharing it with other workloads. EMR Serverless has no clusters: capacity is provided for each job and scales automatically. The following table summarises the options.

OptionCharacteristics
EMR on EC2Clusters of primary, core and task nodes; full control of instances and configuration
EMR on EKSSpark jobs on an existing Kubernetes cluster
EMR ServerlessNo clusters; capacity scales per job

Cluster design on EC2

An Amazon EMR cluster on EC2 has three node types. The primary node manages the cluster, core nodes run tasks and store HDFS data, and task nodes only run tasks. Because task nodes hold no data, they suit Spot Instances: losing one costs only the work in progress.

With EMRFS, clusters read and write data in Amazon S3 rather than HDFS, so the data outlives the cluster. Clusters can then be transient: started for a job, used to process data and terminated, so the customer pays only while work runs. Long-running clusters can cover their core nodes with Reserved Instances or Savings Plans.

The following diagram shows the three node types and where the data lives.

Amazon EMR node types and purchasing. The primary node manages the cluster. Core nodes run tasks and store HDFS data, so they suit On-Demand or Reserved capacity. Task nodes only run tasks and hold no data, so they suit Spot Instances. With EMRFS, data lives in S3, so a transient cluster can be terminated after each job.
The node counts are illustrative. Losing a Spot task node costs only its work in progress.
Scenario questions

EMR cluster design

Exam skills 3.5.5 · 4.2.3

Design cost-effective EMR clusters.

Log in to try this activity Interactive activities are free with an account.
Worked example

Cutting the cost of nightly Spark jobs

A long-running EMR cluster of 40 On-Demand instances runs Spark jobs for three hours each night and sits idle the rest of the day.

ChangeEffect
Keep data in S3 through EMRFSThe cluster holds no data that must be kept
Launch a transient cluster each night and terminate itNo idle cost for 21 hours a day
Use Spot Instances for task nodesLarge discount; losing a task node loses no data
Or move to EMR ServerlessNo cluster to size or manage at all

The jobs run unchanged, at a fraction of the cost.

Check yourself

What is the difference between EMR on EC2 and EMR Serverless?

Show answer

EMR on EC2 runs clusters that you size and configure. EMR Serverless runs Spark and Hive jobs without clusters and scales resources for each job.

Exam Tips

Remember for the exam

  • For existing Spark or Hadoop jobs, use EMR.
  • To reduce EMR cost, run task nodes on Spot Instances.
  • To avoid running clusters between jobs, keep data in S3 and use transient clusters or EMR Serverless.