Learning center

ECS unable to stop or start tasks: deployment configuration bounds

Compute the task ceiling and floor from desiredCount, maximumPercent and minimumHealthyPercent. If both equal the desired count, ECS has no room to move. The ceiling rounds down and the floor rounds up, so settings that work at one desired count can lock the service at another.

The signature#

A rolling deployment of an ECS service makes no progress, no new task starts, and the service events repeat:

service (service-name) was unable to stop or start tasks during a deployment because of the service deployment configuration. Update the minimumHealthyPercent or maximumPercent value and try again.

This event comes from arithmetic. ECS has not tried to place a task and failed; the deployment configuration forbids both starting an extra task and stopping an existing one. Nearby events look similar but name a placement failure, such as insufficient CPU or memory, a port in use, or an account limit, and those need capacity rather than new percentages. Service event messages · Placement events in the signature table

The two bounds#

For a service with the rolling update (ECS) deployment type:

  • Ceiling. maximumPercent is the upper limit on the service's tasks in the RUNNING or PENDING state during a deployment, as a percentage of desiredCount, rounded down to the nearest integer. The default for a replica service is 200.
  • Floor. minimumHealthyPercent is the lower limit on tasks that must remain RUNNING during a deployment, as a percentage of desiredCount, rounded up. The default for a replica service is 100.

ECS can start a new task only while the running and pending count is below the ceiling, and it can stop an old one only while the healthy count stays at or above the floor. If ceiling = desiredCount and floor = desiredCount, it can do neither. AWS gives two examples: at a minimum of 75% and a desired count of two, the floor is still two, so no task can stop; at a maximum of 125% and a desired count of three, the ceiling is still three, so no task can start. Deployment configuration · Rolling update deployments

Read the service's numbers#

Use a read-only profile and replace the uppercase placeholders.

aws ecs describe-services \
  --profile PROFILE --region REGION --cluster CLUSTER --services SERVICE \
  --query 'services[0].{desired:desiredCount,running:runningCount,scheduling:schedulingStrategy,controller:deploymentController.type,max:deploymentConfiguration.maximumPercent,min:deploymentConfiguration.minimumHealthyPercent,deployments:deployments[].{status:status,definition:taskDefinition,desired:desiredCount,running:runningCount,pending:pendingCount},events:events[:5].[createdAt,message]}' \
  --output json --no-cli-pager

Then compute both bounds from desired:

ceiling = floor(desired × max / 100)
floor   = ceil(desired × min / 100)

A deployment can move if ceiling > desired (ECS starts a new task first) or floor < desired (ECS stops an old task first). Check controller too. For a service that uses the CODE_DEPLOY or EXTERNAL deployment controller with the EC2 launch type, ECS sets both values to their defaults and you cannot set custom ones; with Fargate it does not use them, although it still returns them. Deployment configuration

Worked bounds#

desiredCountmaximumPercentminimumHealthyPercentCeilingFloorCan the deployment move?
110010011No
115010011No: 1.5 rounds down to 1
120010021Yes, start first
1100010Yes, stop first; the service has no task for a moment
21007522No: 1.5 rounds up to 2
215010032Yes, one at a time
312510033No: 3.75 rounds down to 3
412510054Yes, one at a time
1010090109Yes, stop one first

The rows for three and four tasks show why this event often appears with no change to the deployment configuration. If Service Auto Scaling or an operator lowered the desired count from four to three, a maximumPercent of 125 that allowed one extra task stopped allowing any. The release that triggered the deployment did nothing wrong; the percentages only worked at the old count.

To allow at least one extra task at desired count n, maximumPercent must be at least 100 × (n + 1) / n: 200 for one task, 150 for two, 134 for three. To allow at least one stop, minimumHealthyPercent must be at most 100 × (n − 1) / n: 0 for one task, 50 for two, 66 for three.

An illustrative fixture#

This fixture is fictional. The service orders has a desired count of 2 and was created with maximumPercent 100 and minimumHealthyPercent 100 to avoid using extra capacity. The deployment of orders:58 starts at 09:58:

TimeRecordValue
09:58Deploymentecs-svc/2211 created for orders:58, desired 2, running 0
09:58Deploymentecs-svc/1987 (old), running 2
09:59Service eventThe deployment configuration message above
10:30DeploymentNo change

Ceiling and floor are both 2, so ECS cannot start a third task or stop one of the two. No task failed or stopped, so there is no stopped task to read. If this service runs on a cluster with room for a third task, set maximumPercent to 150: the ceiling becomes 3 and ECS replaces one task at a time. If the cluster has no room, set minimumHealthyPercent to 50 instead: the floor becomes 1, and ECS runs on one task while it replaces the other.

Choose which bound to open#

Each direction has a cost, and the cluster decides which one you can pay.

Raising maximumPercent makes ECS start tasks before stopping old ones, so the service needs spare capacity for the overlap. On EC2 the extra task can then fail placement on CPU, memory or a static host port, and on Fargate it can reach the account's vCPU quota. CPU or memory shortage · Static host port · Fargate vCPU limit

Lowering minimumHealthyPercent makes ECS stop old tasks first, so the service serves traffic with fewer tasks during the rollout. A replacement counts toward the floor only once it is healthy. With a load balancer, that means its target group health check passes. Without one, and with no container health check, ECS waits 40 seconds after the task reaches RUNNING. A slow-starting replacement therefore keeps the service below its desired count for longer. minimumHealthyPercent health rules

Changing either value with update-service is a change to the service, and so is a matching edit in infrastructure code. Make the edit where the service is defined, or the next infrastructure apply restores the old values. update-service

Confirm on the replacement#

Run the same describe-services command after the change. The new deployment's running count should rise while the old one's falls, within the bounds you computed, and the events should end with service (service-name) has reached a steady state. Recompute the bounds for the desired counts the service can scale to, including its scaling minimum, so the next deployment at a lower count does not stop at the same message. Service event messages

Where the arithmetic stops#

These bounds apply to the rolling update deployment type. The current API also describes blue/green, linear and canary strategies in deploymentConfiguration.strategy; read their own settings rather than assuming these bounds. A service with the DAEMON scheduling strategy defaults minimumHealthyPercent to 0 in the CLI, SDKs and API, and to 50 in the console. Deployment configuration

Room within the bounds does not mean the deployment will finish. Once ECS can start or stop a task, the deployment can still stall on placement, on tasks that fail to start, or on health checks, and each leaves a different record. If tasks of the new revision are stopping, group them by stop code.

Questions#

What do maximumPercent and minimumHealthyPercent mean in ECS?

maximumPercent caps how many of the service's tasks may be running or pending during a deployment, as a percentage of the desired count rounded down. minimumHealthyPercent sets how many must stay running, rounded up. Together they decide whether ECS starts new tasks first, stops old ones first, or cannot move.

Why does a single-task ECS service never deploy with maximumPercent 150?

1 × 150% is 1.5, which rounds down to 1, so ECS cannot run a second task. Use 200 to start the new task first, or set minimumHealthyPercent to 0 to stop the old task first and accept a gap.

Why did the deployment configuration error appear without any config change?

The bounds depend on the desired count. A scale-in from four tasks to three turns a maximumPercent of 125 from one extra task into none, so the next deployment stops with this event.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading