Review EMR cluster subnet selection

Place EMR in the intended VPC subnet.

Description

Select the subnet where EMR will run the processing nodes.

Potential impact

The wrong subnet may leave nodes reachable from unintended networks or unable to connect to required AWS services.

Remediation

Set subnet_id in ec2_attributes. Check that the subnet routes and security groups allow the connections EMR and your jobs need.

Examples

The example uses aws_subnet.main.id. Supply a supported release_label, service role and instance profile in the full configuration.

Before

hcl
resource "aws_emr_cluster" "example" {
  name          = "emr-test-arn"
  release_label = var.release_label
}

After

hcl
resource "aws_emr_cluster" "example" {
  name          = "emr-test-arn"
  release_label = var.release_label
  ec2_attributes {
    subnet_id = aws_subnet.main.id
  }
}

References