Managed scaling policy
EMR Managed Scaling automatically adjusts the number of instances in your cluster based on workload demand. Set themanaged_scaling_policy variable to enable it.
When set, the module creates an
aws_emr_managed_scaling_policy resource attached to the cluster.Minimum number of capacity units the cluster can scale down to. The unit is determined by
unit_type.Maximum total capacity units the cluster can scale up to.
Maximum capacity units allowed for core nodes only. Must be less than or equal to
maximum_capacity_units.Maximum capacity units that can be On-Demand instances. Useful for capping spend while allowing Spot to fill the rest.
Unit of capacity measurement. Valid values:
"Instances"— each EC2 instance counts as one unit."VCPU"— capacity is measured in vCPUs."InstanceFleetUnits"— capacity is measured in instance fleet weighted units.
Strategy for scaling out. Controls how EMR prioritizes adding On-Demand vs Spot instances when scaling up.
Target utilization percentage (0–100) that EMR uses when computing scale-out decisions. A lower value causes more aggressive scaling.
Example
Auto-termination policy
Auto-termination shuts the cluster down after it has been idle for a configurable period. This is useful for transient clusters that process a batch of work and then sit idle.When set, the module configures an auto-termination policy on the cluster.
Number of seconds the cluster can be idle before EMR terminates it automatically. The minimum is
60.Scale-down behavior
Controls how EC2 instances are terminated during a scale-in event or instance group resize.
"TERMINATE_AT_TASK_COMPLETION"— waits for in-progress tasks to complete before terminating the instance. This reduces job failures at the cost of slower scale-in."TERMINATE_AT_INSTANCE_HOUR"— terminates instances at the next full instance-hour boundary, which can reduce EC2 costs for On-Demand instances.
Step concurrency
Number of steps that EMR executes concurrently. Valid range:
1–256. Defaults to 1 when not set.Requires EMR release 5.28.0 or later.Cluster lifecycle flags
When
true (the EMR default), the cluster stays running after all steps complete. Set to false to automatically terminate the cluster when the step queue is empty.When
true, EMR gracefully replaces core nodes that have degraded within the cluster rather than leaving them in a degraded state.