ELB classic load balancers should have cross-zone load balancing enabled¶
Enable cross-zone load balancing for your Elastic Load Balancers (ELBs) to help maintain adequate capacity and availability. The cross-zone load balancing reduces the need to maintain equivalent numbers of instances in each enabled availability zone.
How to fix¶
Attribute cross_zone_load_balancing of aws_elb must be true.
Implementation options¶
Choose the option that matches how you manage Terraform. All options satisfy this control.
Option 1: Compliance.tf module (recommended)¶
Use the compliance.tf registry module to get this control enforced by default. This control is mapped to the frameworks shown in the tabs above. To begin, see get started with compliance.tf.
module "elb" {
source = "cfrpart11.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "cisacyberessentials.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "eugmpannex11.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "fedramplow.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "fedrampmoderate.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "ffiec.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "hipaa.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "nist800171.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "nist80053rev4.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "nist80053.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "nistcsfv11.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "nydfs23.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
module "elb" {
source = "rbiitfnbfc.compliance.tf/terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
}
Option 2: Open source module (terraform-aws-modules)¶
If you use terraform-aws-modules/elb/aws, configure the required module inputs to satisfy this control. You can later migrate to the compliance.tf module with minimal changes because it is compatible by design.
module "elb" {
source = "terraform-aws-modules/elb/aws"
version = ">=4.0.0,<5.0.0"
health_check = {
healthy_threshold = 2
interval = 30
target = "HTTP:80/"
timeout = 5
unhealthy_threshold = 2
}
listener = [
{
instance_port = 80
instance_protocol = "HTTP"
lb_port = 80
lb_protocol = "HTTP"
}
]
name = "my-elb"
security_groups = ["sg-12345678"]
subnets = ["subnet-12345678"]
cross_zone_load_balancing = true
}
Option 3: Terraform AWS provider resources¶
If you manage resources directly, configure the relevant Terraform AWS provider resources to meet this control. See docs for the resources involved: aws_elb.
resource "aws_elb" "this" {
availability_zones = ["us-east-1a", "us-east-1b"]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
cross_zone_load_balancing = true
}
Which option should I choose?
- Compliance.tf module (recommended): controls enforced by default and mapped to frameworks.
- Open source module (
terraform-aws-modules): compatible by design with compliance.tf. Same variable names for an easy, low-change migration path when you are ready. - Terraform AWS provider resources: manage Terraform resources directly.
Tool mappings¶
Use these identifiers to cross-reference this control across tools, reports, and evidence.
Compliance.tf (CTF) Control:
elb_classic_lb_cross_zone_load_balancing_enabledAWS Config Managed Rule:
ELB_CROSS_ZONE_LOAD_BALANCING_ENABLEDCheckov Check:
CKV_AWS_138Powerpipe Control:
aws_compliance.control.elb_classic_lb_cross_zone_load_balancing_enabled