> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/networking/appsec-aws-138.md).

# AWS Elastic Load Balancer (Classic) with cross-zone load balancing disabled misconfiguration detecte

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_138                     |
| Category - Subcategory | Public Exposure - Load Balancing     |
| Provider               | AWS                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 194dc989-ec4c-426c-826f-d7365d9a59ed |

## Impact

Cross-zone load balancing reduces the need to maintain equivalent numbers of instances in each enabled Availability Zone, and improves your application's ability to handle the loss of one or more instances. This would also guarantee better fault tolerance and more consistent traffic flow. If one of the availability zones registered with the ELB fails (as result of network outage or power loss), the load balancer with the Cross-Zone Load Balancing activated would act as a traffic guard, stopping any request being sent to the unhealthy zone and routing it to the other zones.

## How to Fix

*Resource:* xyz

* *Arguments:* xyz \[this will be for composite checks and will indicate a specific resource] \[source,go]

***

resource "aws\_elb" "test\_success" { name = "foobar-terraform-elb" availability\_zones = \["us-west-2a", "us-west-2b", "us-west-2c"] access\_logs { bucket = "foo" bucket\_prefix = "bar" interval = 60 } listener { instance\_port = 8000 instance\_protocol = "http" lb\_port = 80 lb\_protocol = "http" } listener { instance\_port = 8000 instance\_protocol = "http" lb\_port = 443 lb\_protocol = "https" ssl\_certificate\_id = "arn:aws:iam::123456789012:server-certificate/certName" } health\_check { healthy\_threshold = 2 unhealthy\_threshold = 2 timeout = 3 target = "HTTP:8000/" interval = 30 } instances = \[aws\_instance.foo.id] idle\_timeout = 400 connection\_draining = true connection\_draining\_timeout = 400 } """) resource\_conf = hcl\_res\['resource']\[0]\['aws\_elb']\['test\_success'] scan\_result = check.scan\_resource\_conf(conf=resource\_conf) self.assertEqual(CheckResult.PASSED, scan\_result)

def test\_success(self): hcl\_res = hcl2.loads(""" resource "aws\_elb" "test\_success" { name = "foobar-terraform-elb" availability\_zones = \["us-west-2a", "us-west-2b", "us-west-2c"] access\_logs { bucket = "foo" bucket\_prefix = "bar" interval = 60 } listener { instance\_port = 8000 instance\_protocol = "http" lb\_port = 80 lb\_protocol = "http" } listener { instance\_port = 8000 instance\_protocol = "http" lb\_port = 443 lb\_protocol = "https" ssl\_certificate\_id = "arn:aws:iam::123456789012:server-certificate/certName" } health\_check { healthy\_threshold = 2 unhealthy\_threshold = 2 timeout = 3 target = "HTTP:8000/" interval = 30 } instances = \[aws\_instance.foo.id]

* cross\_zone\_load\_balancing = true idle\_timeout = 400 connection\_draining = true connection\_draining\_timeout = 400 }

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/networking/appsec-aws-138.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
