> 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/continuous-delivery/3.0/use-deployments/overview-4/lambda-infrastructure.md).

# Lambda infrastructure

Create Harness environments and AWS Lambda infrastructure definitions to target your AWS account and region for deployment.

An infrastructure definition links a Harness environment to the AWS account and region where Harness deploys your Lambda function. You create both at **Deployments > Environments** and reuse them across pipelines and stages.

***

## What you will learn <a href="#what-you-will-learn" id="what-you-will-learn"></a>

* How to create a Harness environment for Lambda deployments.
* How to configure an infrastructure definition with an AWS connector and region.
* How Lambda step execution and infrastructure definitions relate to each other.

***

## Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

* **AWS connector:** A connector configured with an IAM role that has the permissions listed in [AWS IAM permissions](/continuous-delivery/3.0/use-deployments/overview-4.md#aws-iam-permissions). Go to **Project Settings > Connectors** to add one.

***

## Create an environment <a href="#create-an-environment" id="create-an-environment"></a>

1. Go to **Deployments**, expand the drop-down, and select **Environments**.
2. Select **+ New Environment**.
3. Enter a name and select an environment type: **Pre-Production** or **Production**. The type affects governance policies and deployment dashboards.
4. Select **Save**.

Harness opens the environment detail page with two tabs: **Configuration** and **Infrastructure Definitions**.

***

## Create an infrastructure definition <a href="#create-an-infrastructure-definition" id="create-an-infrastructure-definition"></a>

Infrastructure definitions live inside an environment. Each definition links the environment to a specific AWS account and region.

1. Open the environment and select the **Infrastructure Definitions** tab.
2. Select **+ Create Infrastructure**.
3. In the dialog, select **AWS Lambda** as the deployment target.
4. Enter a name; Harness auto-suggests one, and you can change both the name and ID.
5. Under **Storage**, choose **Inline** or a Git repository.
6. Fill in the **Amazon Web Services details** as described below.
7. Select **Save**.

### Amazon Web Services details <a href="#amazon-web-services-details" id="amazon-web-services-details"></a>

| Field         | Required | Description                                                                                                                                                                                                                                                |
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Connector** | Yes      | A Harness AWS connector. Harness uses this to authenticate to AWS and deploy the Lambda function. The connector must have the IAM permissions listed in [AWS IAM permissions](/continuous-delivery/3.0/use-deployments/overview-4.md#aws-iam-permissions). |
| **Region**    | Yes      | The AWS region where the Lambda function is deployed, for example `us-east-1` or `us-west-1`.                                                                                                                                                              |

### Additional settings <a href="#additional-settings" id="additional-settings"></a>

| Setting                        | Default | Description                                                                                                                                                                                     |
| ------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Simultaneous deployments**   | False   | By default, Harness queues deployments to the same infrastructure to avoid conflicts. Enable this to allow multiple deployments to run concurrently against the same infrastructure definition. |
| **Scope to Specific Services** | False   | Restrict this infrastructure definition so it can only be used by the services you specify. Useful for enforcing separation of concerns across teams.                                           |

***

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

Lambda deployment steps resolve their AWS connection details automatically from the infrastructure definition at runtime. Use these expressions when you need to reference infrastructure values in custom steps or pipeline expressions.

| Value                   | CEL expression            | JEXL expression         |
| ----------------------- | ------------------------- | ----------------------- |
| AWS connector reference | `${{infra.connectorRef}}` | `<+infra.connectorRef>` |
| AWS region              | `${{infra.region}}`       | `<+infra.region>`       |

These expressions are pre-populated in the built-in Lambda step templates (Rolling Deploy, Canary Deploy, Traffic Shift, and rollback steps). You only need them when wiring custom steps or adding expressions to approval messages.

***

## Stage runtime <a href="#stage-runtime" id="stage-runtime"></a>

The AWS Lambda infrastructure definition specifies where Harness deploys your function (AWS account and region). Separately, the stage **Runtime Environment** setting specifies where the Lambda step containers execute. These are two distinct configurations.

Harness supports three runtime options for step execution:

| Runtime           | Description                                                                                                                                         |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Harness Cloud** | Steps run on Harness-hosted infrastructure. No delegate or cluster setup required.                                                                  |
| **Delegate**      | Steps run on any available installed delegate. Harness selects one automatically, or you can inherit from a delegate installed in your environment. |
| **Kubernetes**    | Steps run as containers on a Kubernetes cluster you specify. Requires a Kubernetes connector and a namespace.                                       |

Example — Kubernetes runtime block in the stage YAML:

```yaml
runtime:
  kubernetes:
    namespace: <your-delegate-namespace>
    connector: <your-k8s-connector>
    automount-service-token: true
    pull: always
```

The Kubernetes connector in the runtime block targets the cluster that runs step containers. The AWS connector in the infrastructure definition targets Lambda in your AWS account. They serve different roles and are configured independently.

***

## Next steps <a href="#next-steps" id="next-steps"></a>

* Go to [Lambda services](/continuous-delivery/3.0/use-deployments/overview-4/lambda-services.md) to configure function definitions and artifact sources.
* Go to [Overview](/continuous-delivery/3.0/use-deployments/overview-4.md#deployment-strategies) to review deployment strategy options.

{% @harness-feedback/feedback %}
