> 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-lambda-function-status-check.md).

# Aws Lambda Function Status Check

This probe checks if a Lambda function exists and is in the 'Active' state.

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

* **Kubernetes**

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

AWS Lambda Function Status Check probe helps you:

* Verify Lambda functions remain active during chaos experiments
* Validate function availability after configuration changes
* Monitor serverless application health and readiness
* Ensure functions are deployable and invocable

***

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

This probe uses the AWS CLI to query Lambda function status and validates that the function is in the 'Active' state. It's particularly useful for serverless architectures where function availability is critical.

### 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:
  * `lambda:GetFunction`
  * `lambda:GetFunctionConfiguration`
* Network connectivity to AWS API endpoints
* Target Lambda function 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 lambda-update-function
```

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

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

The probe passes when the command output contains `[Pass]`, indicating the Lambda function is in the 'Active' state.

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

| Variable        | Description                                                          | Required | Default |
| --------------- | -------------------------------------------------------------------- | -------- | ------- |
| `FUNCTION_NAME` | Name of the Lambda function to check (e.g., `my-lambda-function`).   | Yes      | -       |
| `REGION`        | AWS region where the Lambda function is located (e.g., `us-east-1`). | Yes      | -       |

***

## 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:

```yaml
probe:
  - name: "lambda-function-health-check"
    type: "cmdProbe"
    mode: "Edge"
    cmdProbe/inputs:
      command: "healthchecks -name lambda-update-function"
      comparator:
        type: "string"
        criteria: "contains"
        value: "[Pass]"
      env:
        - name: FUNCTION_NAME
          value: "my-lambda-function"
        - name: REGION
          value: "us-east-1"
    runProperties:
      timeout: 300s
      interval: 10s
      attempt: 1
      stopOnFailure: false
```
