> 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/new-experience/use-deployments/ecs-deployments/step-library/ecs-bluegreen-traffic-shift-rollback.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# ECS BlueGreen Traffic Shift Rollback step

The ECS BlueGreen Traffic Shift Rollback step returns all ALB traffic to the previous ECS service after a traffic shift deployment fails.

The ECS BlueGreen Traffic Shift Rollback step runs automatically in the rollback section when the stage failure strategy triggers after the traffic shift variant. It restores the ALB listener's forward configuration to what it was before the traffic shift, using `${{rollback.data.*}}` expressions that reflect the state Harness persisted from the stage's last successful deployment, not output variables from the current run.

**Step Template ID:** `ecsBluegreenTrafficShiftRollbackStep`

***

## ECS BlueGreen Traffic Shift Rollback step YAML

With explicit override:

```yaml
- name: rollback
  id: rollback
  deploy:
    uses: ecsBluegreenTrafficShiftRollbackStep
    with:
      steady_state_timeout: 10m
      traffic_shift_data: ${{rollback.data.TRAFFIC_SHIFT_DATA}}
      connector: ${{infra.connectorRef}}
      region: ${{infra.region}}
      cluster: ${{infra.cluster}}
      log_level: info
```

Minimal form, relying on auto-resolved rollback state:

```yaml
- name: ECS BlueGreen Traffic Shift Rollback
  id: ecsBluegreenTrafficShiftRollbackStep
  deploy:
    uses: ecsBluegreenTrafficShiftRollbackStep
```

***

## Before you begin

* **An ECS service:** Go to [ECS services](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/ecs-services.md) to set up a service with a task definition and artifact source.
* **An ECS infrastructure definition:** Go to [ECS infrastructure](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/ecs-infrastructure.md) to connect an AWS account and configure authentication.

***

{% hint style="info" %}
**Fields are optional and auto-resolve**

The **Traffic Shift Data** field is optional. When the `with:` block is omitted entirely, Harness auto-resolves the forward configuration to restore using a `${{rollback.data.*}}` expression, which reflects the state Harness persisted from the stage's last successful deployment, not a value from the current run.
{% endhint %}

***

## ECS BlueGreen Traffic Shift Rollback step fields

| Field                  | YAML key             | Value                                   | Description                                                                                                                  |
| ---------------------- | -------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **Traffic Shift Data** | `traffic_shift_data` | `${{rollback.data.TRAFFIC_SHIFT_DATA}}` | The forward configuration captured before the traffic shift, used to restore the listener rule's prior traffic distribution. |

### Other configuration

| Field                    | YAML key               | Default | Description                                                                             |
| ------------------------ | ---------------------- | ------- | --------------------------------------------------------------------------------------- |
| **Steady State Timeout** | `steady_state_timeout` | `10m`   | How long Harness waits for the service to reach steady state after traffic is restored. |
| **Log Level**            | `log_level`            | `info`  | Log verbosity for the step execution.                                                   |

### Infrastructure configuration

These fields are derived from the infrastructure definition. Harness resolves them automatically.

| Field         | YAML key    | Default value             | Description                                              |
| ------------- | ----------- | ------------------------- | -------------------------------------------------------- |
| **Connector** | `connector` | `${{infra.connectorRef}}` | The AWS connector from the infrastructure definition.    |
| **Region**    | `region`    | `${{infra.region}}`       | The AWS region from the infrastructure definition.       |
| **Cluster**   | `cluster`   | `${{infra.cluster}}`      | The ECS cluster name from the infrastructure definition. |

***

## How the ECS BlueGreen Traffic Shift Rollback step works

When the step runs, Harness updates the ALB listener (or listener rule) to reapply the forward configuration captured before the traffic shift, returning traffic to its prior distribution. Harness then waits for the service to reach steady state, up to **Steady State Timeout**.

***

## Next steps

* Go to [ECS BlueGreen Traffic Shift step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-bluegreen-traffic-shift.md) for the deploy step that this step rolls back.
* Go to [ECS BlueGreen Deploy step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-bluegreen-deploy.md) for the first step in the traffic shift variant.
* Go to [ECS step library](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library.md) for the full list of available steps.
