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

# ECS rolling deployment

Deploy an ECS service using the rolling strategy, which updates the service in place with a new task definition and waits for steady state.

The rolling strategy updates the existing ECS service in place with the new task definition. There is no canary phase and no versioned service naming. Harness registers a new task definition, updates (or creates) the service, and waits for it to stabilize. Use this strategy when you want a straightforward update without managing parallel service versions.

***

## What you will learn from this topic

* How Harness performs an in-place rolling update on an ECS service.
* How to configure the ECS Rolling Deploy and ECS Rolling Rollback steps.

***

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

***

## Stage YAML

```yaml
pipeline:
  stages:
    - name: Deploy ECS
      id: deployEcs
      service:
        type: ecs
        items:
          - <service-id>
      environment:
        items:
          - id: <environment-id>
            deploy-to: all
      runtime: cloud
      steps:
        - name: ECS Rolling Deploy
          id: ecsRollingDeployStep
          template:
            uses: ecsRollingDeployStep
      rollback:
        - group:
            id: ecsRollingRollbackStep
            name: ECS Rolling Rollback
            steps:
              - name: ECS Rolling Rollback
                id: ecsRollingRollbackStep
                template:
                  uses: ecsRollingRollbackStep
                  with:
                    curr_service: ${{stage.steps.ecsRollingDeployStep.output.outputVariables.currService}}
                    first_deployment: ${{stage.steps.ecsRollingDeployStep.output.outputVariables.firstDeployment}}
                    skip_app_scaling: ${{stage.steps.ecsRollingDeployStep.output.outputVariables.scalingSkipped}}
      on-failure:
        errors: all
        action: stage-rollback
```

***

## How this deployment works

When you select the rolling strategy, Harness adds the following steps to your stage execution:

1. **ECS Rolling Deploy**: Registers a new task definition revision, creates or updates the ECS service, waits for steady state, applies scalable targets and scaling policies, and emits output variables used by the rollback step.

The rollback group runs automatically if the stage failure strategy triggers:

* **ECS Rolling Rollback**: Restores the service to the task definition and scaling configuration, wired from ECS Rolling Deploy's output variables.

***

## Configure the ECS Rolling Deploy step

The ECS Rolling Deploy step is the only step in this strategy. All of its fields are optional, but the following are the ones you are most likely to adjust.

| Field                       | Required | Description                                                                |
| --------------------------- | -------- | -------------------------------------------------------------------------- |
| **Force New Deployment**    | No       | Forces a redeployment even when the task definition has not changed.       |
| **Match Running Instances** | No       | Sets the new desired count to match the current running instance count.    |
| **Skip App Scaling**        | No       | Skips registering scalable targets and scaling policies during deployment. |

All service configuration and infrastructure configuration fields are auto-resolved from the stage service and infrastructure definition by default, but you can override any of them, for example to set an explicit **Connector**.

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 field reference.

***

## Rollback behavior

When the stage failure strategy triggers rollback, **ECS Rolling Rollback** runs and restores the service using **Current Service**, **First Deployment**, and **Skip App Scaling**, wired from the ECS Rolling Deploy step's output variables.

* **First deployment:** There is no previous service to restore. Harness deletes the service that was created by ECS Rolling Deploy and waits for it to drain.
* **Subsequent deployments:** Harness restores the previous task definition, desired count, and scaling configuration.

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 full field reference.

***

## Next steps

* Go to [ECS canary deployment](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/ecs-deployment-strategies/canary.md) to add a canary validation phase before the rolling update.
* Go to [ECS basic deployment](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/ecs-deployment-strategies/basic.md) for a strategy that creates a new versioned service on each deployment.
* Go to [ECS BlueGreen Deploy With Swap Strategy](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/ecs-deployment-strategies/blue-green-swap.md) or [ECS BlueGreen Deploy With Traffic Shift Strategy](https://developer.harness.io/continuous-delivery/new-experience/use-deployments/ecs-deployments/ecs-deployment-strategies/blue-green-traffic-shift.md) for a zero-downtime swap between two target groups.
