# AWS: Update an ECS Service

Update an Amazon ECS service's task definition or desired count, or force a new deployment, in a single call.


> **Availability:** See the [Incident Workflow Actions Overview table](/workflow-actions) for the plans this workflow is available on.

> **Premium Workflow:** This is a Premium Workflow billed separately from your PagerDuty plan. In the workflow action picker, this action appears as **ECS: Update Service**.

## Description

Update an Amazon ECS service's task definition or desired count, or force a new deployment, in any combination in a single call. You must provide at least one of **Task Definition**, **Desired Count**, or **Force New Deployment**.

This action is useful for:

- **Rollback**: Point the service at a previous task definition to roll back a bad release.
- **Scaling**: Increase or decrease the desired task count in response to load or capacity needs.
- **Restart**: Force a new deployment to replace all running tasks, even when the task definition has not changed (for example, to pick up new secrets or configuration, or to clear a stuck task).

## Instructions

1. If you have not done so, follow the instructions to [Create an Incident Workflow](/ai-automation/automation/incident-workflows#create-an-incident-workflow).
2. When the instructions prompt you to [add actions](/ai-automation/automation/incident-workflows#add-actions), select **this action**.
3. Enter the following **Inputs** and click **Save**.
4. Continue following instructions to **Publish** the Workflow.
5. When the action runs, you will see the **Outputs** listed below.

## Inputs

> **Field References:** Fields with the **\{+\}** icon accept [Field References](/ai-automation/automation/incident-workflows#field-references), which can be useful for referencing incident data or outputs created in prior workflow steps. To add Field References, click **\{+\}**, or enter `{{`, and select relevant fields. Refer to the [Field References](/ai-automation/automation/incident-workflows#field-references) article for more information.

| Name                    | Description                                                                                                             |
| :------------------------ | :--------------------------------------------------------------------------------------------------------------------- |
| Integration (Required)  | Select a [Workflow Integration](/ai-automation/automation/incident-workflows/workflow-integrations) or click **New AWS Connection** to establish a new one. |
| AWS Region              | The AWS region where the ECS cluster is located (for example, `us-west-2`). If left blank, the action uses `us-east-1`. |
| Cluster (Required)      | The ECS cluster name or ARN.                                                                                            |
| Service Name (Required) | The name of the ECS service to update.                                                                                  |
| Task Definition         | The new task definition, as `family:revision` or a full ARN. Leave blank to keep the current task definition.          |
| Desired Count           | The new desired task count. Must be non-negative. Leave blank to keep the current count.                                |
| Force New Deployment    | Force replacement of all running tasks, even if the task definition has not changed. Default: `false`.                 |

## Outputs

| Name              | Description                                                                         |
| :------------------ | :-------------------------------------------------------------------------------- |
| Service Name      | The service that was updated.                                                       |
| Task Definition   | The task definition ARN now active on the service.                                  |
| Desired Count     | The desired count after the update.                                                 |
| Running Count     | The running task count at the time of the response.                                 |
| Deployment Status | The status of the primary deployment (for example, `PRIMARY`).                      |
| Result            | Value that shows if the action was successful or not. Either "Success" or "Failed." |
| Result Summary    | Brief description of what the action did or if it failed.                           |
| Error             | Brief description that is populated if the action failed.                           |

> **Tips:** - **Rollback runbook**: Use **Describe Task Definition** or your CI/CD records to identify the last-known-good task definition ARN, then enter it in **Task Definition** to roll back.
> - **Running Count is a snapshot**: A deployment triggered by this action, whether from a new task definition or a forced deployment, takes time to complete. **Running Count** and **Deployment Status** reflect the state immediately after the API call returns, not the final steady state. To confirm that the rollout finished, add a [Logic: Delay](/workflow-actions/logic/delay) step and a follow-up check to the workflow.
> - **Combine parameters**: You can set a new **Task Definition** and a new **Desired Count** in the same call. You can combine **Force New Deployment** with either, or use it alone to restart tasks without changing anything else.
