> 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-canary-delete.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# ECS Canary Delete step

The ECS Canary Delete step deletes the canary version of an ECS service after validation is complete, before the full rolling deployment runs.

The ECS Canary Delete step deletes the canary service created by ECS Canary Deploy. It runs as the second step in the canary strategy (after any optional approval or validation steps), clearing the canary before the ECS Rolling Deploy step runs the full rollout. The same step template is also used in the rollback group to remove the canary service if the deployment fails.

**Step Template ID:** `ecsCanaryDeleteStep`

***

## ECS Canary Delete step YAML

In deployment steps (service name from ECS Canary Deploy output):

```yaml
- name: ECS Canary Delete
  id: ecsCanaryDeleteStep
  template:
    uses: ecsCanaryDeleteStep
    with:
      service: ${{stage.steps.ecsCanaryDeployStep.output.outputVariables.canaryService}}
```

In the rollback group (same service name expression, since it does not change between the deploy flow and rollback):

```yaml
- name: ECS Canary Delete Rollback
  id: ecsCanaryDeleteRollback
  template:
    uses: ecsCanaryDeleteStep
    with:
      service: ${{stage.steps.ecsCanaryDeployStep.output.outputVariables.canaryService}}
```

***

## 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.

***

## ECS Canary Delete step fields

| Field                            | YAML key  | Required | Default                                                                     | Description                                                                                                                                                                                                                                          |
| -------------------------------- | --------- | -------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ECS Canary Service to Delete** | `service` | Yes      | `${{stage.steps.ecsCanaryDeployStep.output.outputVariables.canaryService}}` | The name of the canary service to delete. Defaults to the output of the ECS Canary Deploy step. In the rollback group, Harness wires the same output expression, since the canary service name does not change between the deploy flow and rollback. |

### Infrastructure configuration

Auto-resolved from the infrastructure definition.

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

### Other configuration

| Field                    | YAML key               | Default | Description                                                        |
| ------------------------ | ---------------------- | ------- | ------------------------------------------------------------------ |
| **Steady State Timeout** | `steady_state_timeout` | `10m`   | How long Harness waits for the service to drain before timing out. |
| **Log Level**            | `log_level`            | `info`  | Log verbosity for the step execution.                              |

***

## How the ECS Canary Delete step works

When the step runs, Harness executes the following actions:

1. Checks whether the specified canary service exists in the cluster.
2. Deletes the canary service.
3. Waits for the service to drain (DRAINING status) and become fully inactive.

If the canary service does not exist (for example, it was already deleted), the step completes without error.

***

## Next steps

* Go to [ECS Canary Deploy step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-canary-deploy.md) for the step that creates the canary service.
* Go to [ECS Rolling Deploy step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-rolling-deploy.md) for the full rollout step that runs after canary deletion.
* 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.
