Lesson 1 of 3 Amazon EMR

Choosing an Amazon EMR Deployment Option

This lesson explains how Amazon EMR runs open-source big data frameworks such as Apache Spark, Hive, Presto, Trino, HBase, Flink and Hudi, and how its three deployment options balance control against management effort.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish EMR on EC2, EMR on EKS and EMR Serverless.
  • Describe the primary, core and task node types.
  • Choose between transient and long-running clusters.

The three options

Amazon EMR runs big data frameworks such as Spark and Hive in three ways. EMR on EC2 runs clusters of EC2 instances that you configure, which gives full control of the frameworks, their versions and configuration. EMR on EKS runs Spark jobs on an existing Kubernetes cluster, through virtual clusters mapped to Kubernetes namespaces, so a team can share one container platform for Spark and other workloads.

EMR Serverless has no clusters at all: you submit Spark or Hive jobs to an application, workers scale automatically, and you pay for the resources the jobs use. Pre-initialised capacity keeps some workers warm so that jobs start quickly. It suits intermittent jobs and teams that do not want to manage clusters. The following table summarises the options.

OptionHow it worksChoose when
EMR on EC2Clusters of EC2 instances you configureYou need full control of frameworks, versions and configuration
EMR on EKSSpark jobs on an existing EKS cluster, through virtual clusters mapped to namespacesYou want to share a Kubernetes platform
EMR ServerlessSubmit Spark or Hive jobs to an application; workers scale automatically; pay for resources used; pre-initialised capacity keeps workers warmYou want no clusters to manage, e.g. intermittent jobs

The following diagram compares the three deployment options.

The three EMR deployment options. EMR on EC2 runs clusters of EC2 instances that you configure, with full control. EMR on EKS runs Spark jobs on an existing Kubernetes cluster through virtual clusters mapped to namespaces. EMR Serverless runs submitted jobs on workers that scale automatically, with no cluster at all.
All three run the same EMR runtime for Spark.
Sort into groups

Which EMR option?

Exam skills 1.2.5 · 3.2.5 · 4.1.6

Choose the EMR deployment option for each team.

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

EMR on EC2 node types

An EMR on EC2 cluster contains three types of node. The primary node runs the services that manage the cluster and schedule work, so losing it ends the cluster; it should never run on Spot Instances. Core nodes run tasks and also store data in the cluster's Hadoop Distributed File System (HDFS), so losing one can lose data and fail jobs; they normally run On-Demand. Task nodes only run tasks and store no HDFS data, so they can be added for extra processing power and removed at any time. Interruptions cost only some rework, which makes them the right place for Spot Instances. The following table summarises the node types.

NodeRoleSpot-safe?
PrimaryManages the clusterNo
CoreRuns tasks and stores HDFS dataNo
TaskRuns tasks only, no HDFS; can be added or removedYes

The following list describes how instances are grouped and configured.

  • Instance groups use one type per node type; instance fleets mix types and On-Demand and Spot for better availability and price.
  • Bootstrap actions install software at start-up.

The following diagram shows the node types and the effect of losing each one.

The node types of an EMR on EC2 cluster. The primary node manages the cluster, so losing it ends the cluster. Core nodes run tasks and store HDFS data, so they run On-Demand. Task nodes only run tasks and store no HDFS data, so a reclaimed Spot task node costs only the work in progress.
The node counts are illustrative.

Transient vs long-running clusters

An EMR cluster can be started for one piece of work or kept running. A transient cluster starts, runs its jobs and terminates automatically, so you pay only while work is being done. This is the lowest-cost pattern for scheduled batch processing, such as a nightly ETL run. A long-running cluster stays up to serve work that never stops or cannot wait for a cluster to start, such as analysts running interactive queries or a streaming job. The following table summarises the two patterns.

ClusterPatternBest for
TransientStart, run a job, terminateScheduled batch work, at lowest cost
Long-runningStays upInteractive users or streaming

Keeping data in Amazon S3 through EMRFS, rather than HDFS, means clusters can be terminated without losing data.

Sort into groups

Transient or long-running?

Exam skills 1.2.4

Choose the cluster pattern for each workload.

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

Shared features

Whichever deployment option is chosen, Amazon EMR provides the same supporting features. EMR Studio offers notebooks for interactive development and tools for debugging jobs. The AWS Glue Data Catalog can serve as the Hive metastore, so tables defined for EMR are shared with Athena, Glue and Redshift Spectrum rather than kept in a separate metastore.

Logs are archived to Amazon S3, where they remain after clusters terminate, and security configurations define encryption at rest and in transit and authentication settings once, for reuse across clusters and applications.

Match the pairs

EMR supporting features

Exam skills 1.2.5 · 2.2.2

Match each need with the EMR feature.

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

Choosing how to run Spark

Spark workloads may be run on several EMR deployment options. The following table identifies the appropriate option for each situation.

SituationChoice
A nightly Spark job, no wish to manage clustersEMR Serverless (or a Glue Spark job)
The company already runs everything on KubernetesEMR on EKS
Custom software, HBase, or full control over the clusterEMR on EC2
A 2-hour daily job on EMR on EC2Transient cluster that terminates when the job finishes
Interactive notebooks used all day by data scientistsLong-running cluster or EMR Studio with auto-termination

On EMR on EC2, data that must outlive the cluster lives in S3 (EMRFS), not HDFS, so transient clusters lose nothing when they shut down.

Check yourself

When is EMR on EKS the right choice?

Show answer

When Spark should share an existing Kubernetes platform with other workloads.

Exam Tips

Remember for the exam

  • Intermittent Spark jobs without managing clusters suit EMR Serverless.
  • Full control of frameworks, versions and configuration calls for EMR on EC2.
  • To share an existing Kubernetes platform, use EMR on EKS.
  • Task nodes have no HDFS, so they are safe to run on Spot.
  • Store data in S3 through EMRFS so that clusters can be transient.
  • To share tables with Athena, use the Glue Data Catalog as the Hive metastore.