Demonstrates a minimal configuration for booting an EMR cluster with essential settings and security configurations.

Terraform Template

resource "aws_emr_cluster" "cluster" {
  applications = ["Spark"]

  bootstrap_action {
    args = ["instance.isMaster=true", "echo running on master node"]
    name = "runif"
    path = "s3://elasticmapreduce/bootstrap-actions/run-if"
  }
  configurations_json = <<-EOF
     [
     {
     "Classification": "hadoop-env",
     "Configurations": [
     {
     "Classification": "export",
     "Properties": {
     "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
     }
     }
     ],
     "Properties": {}
     },
     {
     "Classification": "spark-env",
     "Configurations": [
     {
     "Classification": "export",
     "Properties": {
     "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
     }
     }
     ],
     "Properties": {}
     }
     ]
    
  EOF

  core_instance_group {
    instance_count = 1
    instance_type = "m5.xlarge"
  }

  ec2_attributes {
    emr_managed_master_security_group = "aws_security_group.allow_access.id"
    emr_managed_slave_security_group = "aws_security_group.allow_access.id"
    instance_profile = "aws_iam_instance_profile.emr_profile.arn"
    subnet_id = "aws_subnet.main.id"
  }

  master_instance_group {
    instance_type = "m5.xlarge"
  }
  name = "emr-test-arn"
  release_label = "emr-4.6.0"
  service_role = "aws_iam_role.iam_emr_service_role.arn"

  tags = {
    dns_zone = "env_zone"
    env = "env"
    name = "name-env"
    role = "rolename"
  }
  configurations = [" [
 {
 "Classification": "hadoop-env",
 "Configurations": [
 {
 "Classification": "export",
 "Properties": {
 "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
 }
 }
 ],
 "Properties": {}
 },
 {
 "Classification": "spark-env",
 "Configurations": [
 {
 "Classification": "export",
 "Properties": {
 "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
 }
 }
 ],
 "Properties": {}
 }
 ]
"]
}