> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/resilience-testing/chaos-engineering/use-chaos-engineering/probes/probe-templates/aws/aws-load-balancer-az-check.md).

# Aws Load Balancer Az Check

Validates the availability of target availability zone(s) in the given ALB or CLB.

## Infrastructure type <a href="#infrastructure-type" id="infrastructure-type"></a>

* **Kubernetes**

## Use cases <a href="#use-cases" id="use-cases"></a>

AWS Load Balancer AZ Check probe helps you:

* Verify load balancer AZ configuration during AZ failures
* Validate traffic distribution across availability zones
* Monitor load balancer health during network chaos experiments
* Ensure multi-AZ redundancy is maintained

***

## Overview <a href="#overview" id="overview"></a>

This probe uses the AWS CLI to query load balancer configuration and validates that the specified availability zones are properly configured and available. It supports both Application Load Balancers (ALB) and Classic Load Balancers (CLB).

### Probe type <a href="#probe-type" id="probe-type"></a>

**Command Probe**

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* Kubernetes cluster with chaos infrastructure installed
* AWS credentials configured with appropriate IAM permissions:
  * `elasticloadbalancing:DescribeLoadBalancers`
  * `elasticloadbalancing:DescribeLoadBalancerAttributes`
  * `elasticloadbalancing:DescribeTargetHealth` (for ALB)
* Network connectivity to AWS API endpoints
* Target load balancer should exist in the specified region

***

## Probe properties <a href="#probe-properties" id="probe-properties"></a>

### Command <a href="#command" id="command"></a>

```
healthchecks -name aws-lb-az
```

### Comparator <a href="#comparator" id="comparator"></a>

| Type   | Criteria | Value   |
| ------ | -------- | ------- |
| string | contains | \[Pass] |

The probe passes when the command output contains `[Pass]`, indicating the specified availability zones are configured in the load balancer.

### Environment variables <a href="#environment-variables" id="environment-variables"></a>

| Variable             | Description                                                                                                                                       | Required | Default |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
| `LOAD_BALANCER_ARN`  | ARN of the ALB to check (e.g., `arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-alb/1234567890abcdef`). Required for ALB. | No\*     | -       |
| `LOAD_BALANCER_NAME` | Name of the CLB to check (e.g., `my-classic-lb`). Required for CLB.                                                                               | No\*     | -       |
| `REGION`             | AWS region where the load balancer is located (e.g., `us-east-1`, `eu-west-2`).                                                                   | Yes      | -       |
| `ZONES`              | Comma-separated list of Availability Zones to check (e.g., `us-east-1a,us-east-1b,us-east-1c`).                                                   | Yes      | -       |

**Note:** Either `LOAD_BALANCER_ARN` (for ALB) or `LOAD_BALANCER_NAME` (for CLB) must be provided.

***

## Run properties <a href="#run-properties" id="run-properties"></a>

| Property          | Description                                                              | Type    | Default |
| ----------------- | ------------------------------------------------------------------------ | ------- | ------- |
| `timeout`         | Maximum time to wait for the probe to complete (e.g., `30s`, `1m`, `5m`) | String  | 300s    |
| `interval`        | Time between probe executions (e.g., `5s`, `30s`, `1m`)                  | String  | 10s     |
| `attempt`         | Number of retry attempts before marking the probe as failed              | Integer | 1       |
| `pollingInterval` | Time between retry attempts (e.g., `1s`, `5s`, `10s`)                    | String  | -       |
| `initialDelay`    | Initial delay before starting the probe (e.g., `0s`, `10s`, `30s`)       | String  | -       |
| `stopOnFailure`   | Stop the experiment if the probe fails                                   | Boolean | false   |
| `verbosity`       | Log verbosity level (`info`, `debug`, `trace`)                           | String  | -       |

***

## Probe definition <a href="#probe-definition" id="probe-definition"></a>

You can define this probe in your chaos experiment as follows:

### For Application Load Balancer (ALB) <a href="#for-application-load-balancer-alb" id="for-application-load-balancer-alb"></a>

```yaml
probe:
  - name: "alb-az-availability-check"
    type: "cmdProbe"
    mode: "Continuous"
    cmdProbe/inputs:
      command: "healthchecks -name aws-lb-az"
      comparator:
        type: "string"
        criteria: "contains"
        value: "[Pass]"
      env:
        - name: LOAD_BALANCER_ARN
          value: "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-alb/1234567890abcdef"
        - name: REGION
          value: "us-east-1"
        - name: ZONES
          value: "us-east-1a,us-east-1b,us-east-1c"
    runProperties:
      timeout: 300s
      interval: 10s
      attempt: 1
      stopOnFailure: false
```

### For Classic Load Balancer (CLB) <a href="#for-classic-load-balancer-clb" id="for-classic-load-balancer-clb"></a>

```yaml
probe:
  - name: "clb-az-availability-check"
    type: "cmdProbe"
    mode: "Edge"
    cmdProbe/inputs:
      command: "healthchecks -name aws-lb-az"
      comparator:
        type: "string"
        criteria: "contains"
        value: "[Pass]"
      env:
        - name: LOAD_BALANCER_NAME
          value: "my-classic-load-balancer"
        - name: REGION
          value: "eu-west-1"
        - name: ZONES
          value: "eu-west-1a,eu-west-1b"
    runProperties:
      timeout: 60s
      interval: 5s
      attempt: 3
      pollingInterval: 2s
```
