Creates an EMR cluster and applies a managed scaling policy to automatically adjust the cluster size based on workload.

Terraform Template

resource "aws_emr_cluster" "sample" {

  core_instance_group {
    instance_type = "c4.large"
  }

  master_instance_group {
    instance_type = "m4.large"
  }
  name = "emr-sample-cluster"
  release_label = "emr-5.30.0"
}

resource "aws_emr_managed_scaling_policy" "samplepolicy" {
  cluster_id = aws_emr_cluster.sample.id

  compute_limits {
    maximum_capacity_units = 10
    maximum_core_capacity_units = 10
    maximum_ondemand_capacity_units = 2
    minimum_capacity_units = 2
    unit_type = "Instances"
  }
}