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

# ECS Rolling Deploy step

The ECS Rolling Deploy step updates an ECS service in place with the new task definition, waits for steady state, and applies auto-scaling configuration.

The ECS Rolling Deploy step performs an in-place update of an ECS service. It registers a new task definition revision, creates or updates the service, waits for steady state, and applies scalable targets and scaling policies. It is used as the final step in the canary strategy and as the sole deploy step in the rolling strategy.

**Step Template ID:** `ecsRollingDeployStep`

***

## ECS Rolling Deploy step YAML

Minimal form, uses all defaults:

```yaml
- name: ECS Rolling Deploy
  id: ecsRollingDeployStep
  template:
    uses: ecsRollingDeployStep
```

With explicit fields:

```yaml
- name: ECS Rolling Deploy
  id: ecsRollingDeployStep
  template:
    uses: ecsRollingDeployStep
    with:
      match_running_instances: false
      force_new_deployment: false
      modify_tags: false
      skip_app_scaling: false
      steady_state_timeout: 10m
      log_level: info
```

{% hint style="info" %}
**Template version pinning**

You can pin a specific template version with `uses: ecsRollingDeployStep@<version>`, for example `ecsRollingDeployStep@1.0.5`. Omitting the version resolves the latest available template.
{% endhint %}

***

## 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 Rolling Deploy step fields

| Field                       | YAML key                  | Required | Default | Description                                                                                                                                                      |
| --------------------------- | ------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Match Running Instances** | `match_running_instances` | No       | `false` | When `true`, Harness sets the new service desired count to match the current running instance count.                                                             |
| **Force New Deployment**    | `force_new_deployment`    | No       | `false` | When `true`, forces a new deployment of the service even if the task definition has not changed. Equivalent to the `--force-new-deployment` flag in the AWS CLI. |
| **Modify Tags**             | `modify_tags`             | No       | `false` | When `true`, Harness applies tag modifications to the service during deployment.                                                                                 |
| **Skip App Scaling**        | `skip_app_scaling`        | No       | `false` | When `true`, Harness skips registering scalable targets and scaling policies during deployment.                                                                  |

### Service configuration

Auto-resolved from the service and artifact configuration.

| Field                  | YAML key             | Default value                                             | Description                             |
| ---------------------- | -------------------- | --------------------------------------------------------- | --------------------------------------- |
| **Task Definition**    | `task_definition`    | `${{serviceOutput.manifests.ecsTaskDefinition.paths}}`    | Path to the task definition file.       |
| **Service Definition** | `service_definition` | `${{serviceOutput.manifests.ecsServiceDefinition.paths}}` | Path to the service definition file.    |
| **Scalable Targets**   | `scalable_targets`   | `${{serviceOutput.manifests.ecsScalableTarget.paths}}`    | Path to the scalable target definition. |
| **Scaling Policies**   | `scaling_policies`   | `${{serviceOutput.manifests.ecsScalingPolicy.paths}}`     | Path to the scaling policy definition.  |

### Infrastructure configuration

Auto-resolved from the infrastructure definition.

| Field         | YAML key    | Default value             | Description                                       |
| ------------- | ----------- | ------------------------- | ------------------------------------------------- |
| **Connector** | `connector` | `${{infra.connectorRef}}` | AWS connector from the infrastructure definition. |
| **Region**    | `region`    | `${{infra.region}}`       | AWS region from the infrastructure definition.    |
| **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 reach steady state. |
| **Log Level**            | `log_level`            | `info`  | Log verbosity for the step execution.                         |

***

## How the ECS Rolling Deploy step works

When the step runs, Harness executes the following actions in order:

1. Captures rollback data: the current task definition ARN, service configuration, scalable targets, and scaling policies of the existing service.
2. Registers a new ECS task definition revision from the task definition manifest.
3. If the service exists, updates it with the new task definition and desired count. If the service does not exist (first deployment), creates it.
4. Waits for the service to reach steady state.
5. Registers scalable targets and scaling policies from the service manifests, unless **Skip App Scaling** is enabled.
6. Emits the `currService`, `firstDeployment`, and `scalingSkipped` output variables for use by ECS Rolling Rollback.

***

## Step outputs

The ECS Rolling Deploy step emits the following output variables. The [ECS Rolling Rollback step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-rolling-rollback.md) wires these into its own `with:` inputs.

| Output variable   | Description                                                        |
| ----------------- | ------------------------------------------------------------------ |
| `currService`     | The ECS service configuration captured before this deployment ran. |
| `firstDeployment` | Whether this was the first deployment of the service.              |
| `scalingSkipped`  | Whether **Skip App Scaling** was enabled for this deployment.      |

Reference an output variable as `${{stage.steps.ecsRollingDeployStep.output.outputVariables.currService}}`.

***

## Next steps

* Go to [ECS Rolling Rollback step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-rolling-rollback.md) for the rollback step paired with this step.
* Go to [ECS Canary Deploy step](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/step-library/ecs-canary-deploy.md) to see how this step is used after a canary phase.
* 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.
