Amazon EMR Cluster Segmentation Schemes
One of the main benefits of Amazon EMR is that it makes it easy to start and terminate clusters. This gives you flexibility that a single long-running cluster cannot provide, and opportunities to save costs with Amazon EC2 Spot Instances. This chapter covers approaches to splitting a single permanently running cluster into smaller clusters, and the benefits of doing so. The approach depends on your use case and existing workflows, and AWS can help you choose.
Cluster characteristics
You can split clusters from different perspectives, depending on what you want to address.
Instance types and cluster sizes
Different workflows bottleneck on different resources, such as CPUs, memory, network bandwidth, or latency. Smaller, purpose-built clusters let you select the instance types that fit each workload. As a best practice, use instance fleets instead of instance groups. With instance fleets, you specify multiple instance types for each fleet with allocation strategies: capacity-optimized for Spot Instances and lowest-price for On-Demand Instances. This reduces the need for separate clusters for different hardware.
The following examples match instance families to workloads.
-
Memory-optimized (r6i, r6g, r7g) — Apache Spark machine learning, large shuffles, and in-memory caching.
-
Compute-optimized (c6i, c6g, c7g) — Trino or Presto query engines, or CPU-intensive transformations.
-
Storage-optimized (i3, i4i, d3) — Apache HBase or high local I/O.
-
GPU instances (p4d, g5) — distributed deep learning with Spark and GPU frameworks.
-
Graviton-based (m7g, r7g, c7g) — up to 40% better price-performance on general workloads.
Applications, application versions, and configuration
You can deploy different configurations and applications on each cluster. You can run blue-green testing during version upgrades, and test new Amazon EMR releases before you promote them to production. EMR Studio workspaces attach to clusters dynamically, so a shared cluster with EMR Studio provides per-user notebook isolation while the users share compute.
Security
Security is often the primary driver for segmentation. However, modern Amazon EMR capabilities provide fine-grained isolation within a single cluster. The following table shows these mechanisms and what they replace.
| Mechanism | What it provides | Replaces |
|---|---|---|
| Runtime Roles (Amazon EMR 6.x and later) | Different IAM roles for each job or step on the same cluster. Each step runs with its own credentials. | Separate clusters for each IAM role |
| Lake Formation Fine-Grained Access Control | Table, column, row, and cell-level permissions for each user or group, enforced within a shared cluster | Separate clusters for each data access boundary |
| Trusted Identity Propagation (TIP) | Corporate identity, through IAM Identity Center, flows through to Apache Spark sessions with no manual Kerberos setup | Separate clusters for each identity domain |
| S3 Access Grants | Prefix-level Amazon S3 access mapped to IAM Identity Center users and groups | Separate clusters for each Amazon S3 bucket access |
With Runtime Roles, Lake Formation Fine-Grained Access Control, and Trusted Identity Propagation, you can support multiple teams with different data access requirements on a single cluster.
IAM roles specific to each cluster
Each Amazon EMR cluster uses an Amazon EC2 instance profile role. You can assign different roles for scoped access to Amazon S3, Amazon Kinesis Data Streams, or Amazon MSK. With Runtime Roles (Amazon EMR 6.x and later), you can assign different IAM roles at the step or job level on the same cluster. For more information, see Configure runtime roles for Amazon EMR steps in the Amazon EMR Management Guide.
Security controls
Match the isolation mechanism to the cluster type.
-
Interactive clusters — we recommend Amazon SageMaker Unified Studio, or Amazon EMR Studio notebooks. Configure Trusted Identity Propagation with IAM Identity Center for per-user workspace isolation.
-
Batch and ETL clusters — step-level Runtime Roles provide workload isolation. For more information, see Security in Amazon EMR in the Amazon EMR Management Guide.
Network controls
You can assign clusters to different security groups or subnets.
Disaster recovery
Multiple clusters provide redundancy. The following cases show when redundancy helps.
-
A cluster becomes unhealthy because of a software bug, a network issue, or an external dependency.
-
A cluster needs maintenance, such as a software upgrade, a patching reboot, or an application bounce.
For disaster recovery across Regions, replicate your Amazon S3 data and AWS Glue Data Catalog metadata to a secondary Region with standby clusters.
How deployment options affect segmentation
The preceding patterns assume Amazon EMR on Amazon EC2. Amazon EMR Serverless and Amazon EMR on Amazon EKS can reduce or eliminate the need for segmentation.
Decision framework
The following table compares how each deployment option addresses the common drivers for segmentation.
| Segmentation driver | Amazon EMR on Amazon EC2 (cluster segmentation) | Amazon EMR Serverless | Amazon EMR on Amazon EKS |
|---|---|---|---|
| Workload isolation | Separate clusters for each team or workload | Built in: each application runs in its own isolated environment | Namespace-level isolation with pod resource limits |
| Security boundaries | Separate clusters with different IAM roles and security configurations | Per-application IAM role, with no shared cluster to compromise | Kubernetes RBAC and IAM Roles for Service Accounts (IRSA) |
| Resource contention | Separate clusters prevent noisy-neighbor effects | No contention: resources are provisioned for each application | Resource quotas and limit ranges for each namespace |
| Version and configuration differences | Different Amazon EMR releases or application configurations for each cluster | Per-application Apache Spark or Apache Hive version and configuration | Per-job Spark image and configuration |
| Cost attribution | Tag clusters for each team; primary node overhead for each cluster | Per-application billing with no idle cost | Amazon EKS namespace-level cost attribution; shared node pool |
When EMR Serverless eliminates segmentation
Amazon EMR Serverless runs each application in a fully isolated, auto-scaling environment. It provides the following benefits.
-
No cluster to segment. Each
StartJobRuncreates an isolated execution with its own compute, memory, and IAM role. -
No noisy-neighbor risk.
-
No primary node overhead.
-
Per-application IAM roles.
Use Amazon EMR Serverless instead of cluster segmentation when the following conditions apply.
-
Your workloads are Apache Spark or Apache Hive batch jobs without custom cluster configurations.
-
Teams need isolation but not interactive access or Apache HBase.
-
You want to eliminate cluster lifecycle management.
-
Your workloads have variable or unpredictable schedules.
Amazon EMR Serverless is not a fit when the following conditions apply.
-
You need Apache HBase, Apache Flink, or other frameworks that Serverless does not support.
-
Your workloads require custom AMIs, bootstrap actions, or operating-system-level configurations.
-
You need sub-second startup, because there is cold-start latency unless you use pre-initialized capacity.
-
Persistent interactive query engines, such as Trino, are required.
When Amazon EMR on Amazon EKS provides isolation without segmentation
Amazon EMR on Amazon EKS runs Apache Spark jobs as Kubernetes pods on an existing Amazon EKS cluster. It provides the following benefits.
-
Namespace isolation for each team or workload, with resource quotas, network policies, and RBAC.
-
Pod-level resource limits.
-
IAM Roles for Service Accounts (IRSA).
-
Shared node pool efficiency.
Use Amazon EMR on Amazon EKS when the following conditions apply.
-
You already operate Amazon EKS and want to consolidate container workloads.
-
You need Kubernetes-native isolation.
-
Multiple teams run Apache Spark and you want shared node pools with per-namespace quotas.
Amazon EMR on Amazon EKS is not a fit when the following conditions apply.
-
Teams lack Kubernetes expertise.
-
You need frameworks beyond Apache Spark, such as Apache Hive, Apache HBase, Apache Flink, or Trino.
-
Your security model requires physical cluster-level isolation.
When Amazon EC2 cluster segmentation is still required
Cluster segmentation on Amazon EMR on Amazon EC2 is still required for the following workloads.
-
Apache HBase serving workloads.
-
Multi-framework clusters, such as Apache Spark, Apache Hive, Trino, and Apache Flink with a shared metastore.
-
Custom AMI or operating-system requirements.
-
Compliance-mandated physical isolation.
-
Interactive query engines, such as persistent Trino or Apache Hive LLAP.
-
HDFS-dependent workloads. We recommend migrating to Amazon S3 for the long term.
Common cluster segmentation schemes
For detailed Silo, Shared, and Hybrid tenancy models, which cover user, data, and resource isolation, see Multitenancy on EMR.
Lifecycle stages
Use dedicated clusters for separate stages, such as testing, beta, and production, so that non-production jobs do not compete with production jobs. This approach lets you test application-version upgrades before beta and production. Apply a separate instance role so that beta jobs cannot write to production Amazon S3 locations.
Workload types
Different workload types suit different cluster designs.
-
Interactive workloads — these workloads benefit from identity-aware controls and interactive tooling. Use Amazon EMR Studio or Amazon SageMaker Unified Studio with IAM Identity Center. Usage peaks during business hours.
-
Batch and ETL workloads — these workloads benefit from Managed Scaling and Spot Instances with instance fleets, and they scale task nodes to zero during idle periods.
-
Streaming workloads — these workloads run Apache Flink or Spark Structured Streaming against Amazon MSK or Amazon Kinesis Data Streams. They are always on and have distinct resource profiles.
For more information, see Using EMR Managed Scaling in the Amazon EMR Management Guide.
Time-sensitive jobs
Use separate clusters for jobs whose completion time must be consistent. You can give these clusters more powerful hardware if needed.
Job length
Separate long-running jobs from short-running jobs to prevent resource starvation.
-
Short-running jobs complete faster on dedicated clusters and are less affected by Spot reclamation.
-
Long-running jobs can use Spot Instances more effectively with Managed Scaling and Spot diversification across instance fleets.
Group and organization types
Some organizations create clusters for each team or business unit. The following table shows when each approach fits.
| Approach | When to use |
|---|---|
| Separate clusters for each team | Teams have fundamentally different compute or application requirements. |
| Single cluster with Runtime Roles and Lake Formation Fine-Grained Access Control | Teams share similar compute needs but require data isolation. |
For cost allocation, use resource tagging for cluster-level attribution, and use AWS Cost Categories for automated grouping across multiple Amazon EMR resources.
Additional considerations for segmentation
As you plan segmentation, consider the following factors.
Cost implications
Segmenting adds primary node overhead, because each cluster runs one primary node. Managed Scaling offsets underutilization by right-sizing the cluster.
Orchestration and lifecycle management
Managing multiple clusters requires automation.
-
Use Amazon Managed Workflows for Apache Airflow for DAG-based orchestration of provisioning, submission, and teardown.
-
Use AWS Step Functions for event-driven lifecycle management.
-
EMR Managed Scaling reduces custom idle-termination logic.
Instance efficiency
Multiple smaller clusters reduce instance-sharing efficiency. Mitigate this with Managed Scaling that scales task nodes to zero, and with instance fleets that use capacity-optimized Spot allocation.