> 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/lambda-canary-rollback.md).

# AWS Lambda Canary Rollback

Reset a Lambda function alias to route all traffic back to the previous version after a failed canary deployment.

The AWS Lambda Canary Rollback step resets the weighted alias to route 100% of traffic back to the previous function version and removes the newly published version. Harness adds this step automatically to the rollback section of a canary stage. It runs automatically when any step in the stage fails.

***

## Step YAML

```yaml
- name: AWS Lambda Canary Rollback
  id: awsLambdaCanaryRollbackStep
  template:
    uses: awsLambdaCanaryRollbackStep
```

The step uses no explicit `with:` inputs — infrastructure is resolved automatically from the stage context.

***

## Before you begin

* This step is automatically added to canary stages. You do not need to add it manually unless you are building a custom rollback flow.
* **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

### Infrastructure Configuration

All values are derived from the infrastructure definition. You do not need to change them when the step is wired to a correctly configured infrastructure.

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

***

## What the step does

The rollback step reads state from the **last successful execution** of this stage — not from the failed run. When it runs:

1. Reads the function name and previous version number from the last successful stage execution.
2. Resets the weighted alias to route 100% of traffic back to the previous version.
3. Deletes the newly published version that was created by the Canary Deploy step.

After rollback, the alias points exclusively to the last known good version and all traffic is fully restored to it.

This behavior applies to both ZIP artifact and ECR image canary deployments. For ECR functions where no alias manifest was declared in the service, the canary deploy step still created a managed alias internally — the rollback step resets that alias using the same mechanism.

***

## Advanced settings

* **Timeout duration:** Maximum time the step is allowed to run before being terminated.
* **On failure:** Define what happens if the rollback step itself fails.
* **Strategy:** Configure a looping strategy.
* **Conditional execution:** Run this step only when a condition is true.

***

## Next steps

* Go to [Lambda canary deployment](/continuous-delivery/3.0/use-deployments/overview-4/canary.md) for the full canary flow, including when rollback triggers.
* Go to [AWS Lambda Canary Deploy](/continuous-delivery/3.0/use-deployments/overview-4/lambda-canary-deploy.md) for the deploy step that this step rolls back.

{% @harness-feedback/feedback %}
