| Security group | Variable suffix | Purpose |
|---|---|---|
| Master | -master | Controls traffic to and from master nodes |
| Slave | -slave | Controls traffic to and from core and task nodes |
| Service | -service | Enables the EMR service to communicate with nodes in private clusters |
{ "for-use-with-amazon-emr-managed-policies" = true } so that the AmazonEMRServicePolicy_v2 managed policy can manage their rules.
If you set
create_managed_security_groups = false and do not supply security group IDs via ec2_attributes, EMR will attempt to create its own default security groups. For this to work, your VPC must be tagged with { "for-use-with-amazon-emr-managed-policies" = true }. See the AWS managed security groups documentation for details.Enabling and naming
Set to
false to skip creation of all three managed security groups.Base name for the security groups. The module appends
-master, -slave, and -service to this value. Defaults to the cluster name.When
true, the security group name is used as a prefix and AWS appends a unique suffix.Additional tags to merge onto all three security groups.
ID of the VPC in which to create the security groups.
Master security group rules
Map of ingress rules to add to the master security group. Each rule object supports:
cidr_ipv4— Source IPv4 CIDR block.cidr_ipv6— Source IPv6 CIDR block.description— Human-readable description.from_port— Start of port range.to_port— End of port range. Defaults tofrom_portwhen omitted.ip_protocol— Protocol. Default:"tcp". Use"-1"for all traffic.prefix_list_id— ID of a managed prefix list.referenced_security_group_id— ID of a security group to reference as the source.reference_slave_security_group— Whentrue, the slave security group is automatically used as the source. Default:false.tags— Rule-level tags.
Map of egress rules to add to the master security group. Accepts the same fields as
master_security_group_ingress_rules, with reference_slave_security_group substituted for cross-group references.The default rule allows all outbound traffic:Slave security group rules
The slave security group is shared by both core and task nodes.Map of ingress rules for the slave security group. Accepts the same fields as the master rules, with
reference_master_security_group available to reference the master group as the source.Map of egress rules for the slave security group. The default allows all outbound traffic:
Service security group rules
The service security group is only created for private clusters (is_private_cluster = true). It allows the EMR cluster manager to reach nodes over port 8443 and accepts inbound connections from master nodes on port 9443.
These built-in rules are always present when the service group is created. You can add more rules on top of them:
Additional ingress rules for the service security group. Supports
reference_master_security_group for cross-group rules.Additional egress rules for the service security group. The module always adds port-
8443 egress rules to the master and slave groups; this variable adds further rules on top.Private vs public clusters
Set to
false for clusters deployed in public subnets. When false, the service security group is not created because public clusters do not require the EMR service access path.is_private_cluster = false:
Cross-group rules
Bothreference_slave_security_group and reference_master_security_group are convenience booleans that let you reference the sibling security group without knowing its ID ahead of time. The module resolves the actual security group ID at apply time.
Disabling managed security groups
To manage security groups outside of this module, disable creation and supply the IDs viaec2_attributes: