> 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-rolling-rollback.md).

# AWS Lambda Rolling Rollback

Restore a Lambda function to its previous version after a failed rolling deployment.

The AWS Lambda Rolling Rollback step redeploys the previous function version after a failed rolling deployment. Harness adds this step automatically to the rollback section of a rolling stage. It runs automatically when the Rolling Deploy step fails.

***

## Step YAML

```yaml
- name: AWS Lambda Rolling Rollback
  id: awsLambdaRollingRollbackStep
  template:
    uses: awsLambdaRollingRollbackStep
```

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

***

## Before you begin

* This step is automatically added to rolling 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.

| Field             | Value                     | Description                                                                                                                     |
| ----------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **AWS Connector** | `${{infra.connectorRef}}` | The AWS connector resolved from the infrastructure definition. Used to authenticate to Lambda and restore the previous 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. Re-deploys the function to that version.
3. If the service included an alias definition (`AwsLambdaFunctionAliasDefinition`), also repoints the alias back to the restored version at 100% weight. If no alias was involved, only the function version is restored.

***

## 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 rolling deployment](/continuous-delivery/3.0/use-deployments/overview-4/canary/rolling.md) for the full rolling flow, including when rollback triggers.
* Go to [AWS Lambda Rolling Deploy](/continuous-delivery/3.0/use-deployments/overview-4/lambda-canary-deploy/lambda-rolling-deploy.md) for the deploy step that this step rolls back.

{% @harness-feedback/feedback %}
