> 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-canary-deploy.md).

# Step Library

Publish a new Lambda function version and create a weighted alias to begin routing canary traffic alongside the stable version.

The AWS Lambda Canary Deploy step publishes a new version of your Lambda function and creates or updates a weighted alias to begin splitting traffic between the previous version and the new one. Use it as the first step in a canary stage, followed by one or more Traffic Shift steps to gradually increase traffic to the new version.

***

## Step YAML

```yaml
- name: AWS Lambda Canary Deploy
  id: awsLambdaCanaryDeployStep
  template:
    uses: awsLambdaCanaryDeployStep
```

The step uses no explicit `with:` inputs — service configuration and infrastructure are resolved automatically from the stage context at runtime.

***

## Before you begin

* **A Lambda service** with an `AwsLambdaFunctionDefinition` manifest and an artifact source. Whether you also need an `AwsLambdaFunctionAliasDefinition` manifest depends on your artifact type:
  * **ZIP artifact (S3, Artifactory, Nexus):** Alias definition is required. The step reads the alias manifest to determine the alias name and fails without one.
  * **ECR container image:** Alias definition is not required. The step manages the alias automatically.
  * Go to [Lambda services](/continuous-delivery/3.0/use-deployments/overview-4/lambda-services.md).
* **A Lambda infrastructure** with an AWS connector and region. Go to [Lambda infrastructure](/continuous-delivery/3.0/use-deployments/overview-4/lambda-infrastructure.md).

***

## Configure the step

When you add the step to a canary stage, the following sections appear. All values are derived automatically from your service and infrastructure configuration.

### Service Configuration

| Field                   | Value                                                  | Description                                                                                                                                                                                          |
| ----------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Function Definition** | `${{serviceOutput.manifests.awsLambdaFunction.paths}}` | Path to the function definition manifest resolved from the service. Defines the function name, handler, runtime, memory, and timeout.                                                                |
| **Function Alias**      | `${{serviceOutput.manifests.awsLambdaAlias.paths}}`    | Path to the alias definition manifest. Populated when your service includes an `AwsLambdaFunctionAliasDefinition` manifest. Required for ZIP artifact canary; empty and unused for ECR image canary. |

### Infrastructure Configuration

| Field             | Value                     | Description                                                                                                                |
| ----------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **AWS Connector** | `${{infra.connectorRef}}` | The AWS connector resolved from the infrastructure definition. Used to authenticate to Lambda and publish the new version. |
| **AWS Region**    | `${{infra.region}}`       | The AWS region resolved from the infrastructure definition.                                                                |

{% hint style="info" %}
**ECR image functions**

When your artifact is a container image from ECR, the function definition uses `packageType: Image` — there is no `handler` or `runtime` field. Define `functionName` and `role` as service variables. The **Function Alias** field will be empty; this is expected and the canary deploy step handles alias management automatically.

When your artifact is a ZIP file, define `functionName` and `runtime` as service variables and add an alias definition manifest so the step can create the named alias.
{% endhint %}

***

## Step outputs

The following output variables are available for use in downstream Traffic Shift steps.

| Output variable | Expression                                                                     | Description                                                                                                           |
| --------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `functionName`  | `<+stage.steps.awsLambdaCanaryDeployStep.output.outputVariables.functionName>` | The name of the Lambda function that was deployed. Auto-populates the `function_name` input on Traffic Shift steps.   |
| `version`       | `<+stage.steps.awsLambdaCanaryDeployStep.output.outputVariables.version>`      | The published version number of the new function. Auto-populates the `function_version` input on Traffic Shift steps. |

***

## Advanced settings

* **Timeout duration:** Maximum time the step is allowed to run before being terminated.
* **On failure:** Define what happens if the step fails — retry, mark as success, or abort.
* **Strategy:** Configure a looping strategy to run this step over a list of values.
* **Conditional execution:** Run this step only when a specified condition is true.

***

## Next steps

* Go to [AWS Lambda Traffic Shift](/continuous-delivery/3.0/use-deployments/overview-4/lambda-canary-deploy/lambda-traffic-shift.md) to configure the step that routes traffic to the new version.
* Go to [Lambda canary deployment](/continuous-delivery/3.0/use-deployments/overview-4/canary.md) for the full canary flow walkthrough.

{% @harness-feedback/feedback %}
