INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

Topic lessonTopic: Containers, ECS and Fargate

ECS rolling deployments: task-count limits and rollback conditions

Convert deployment percentages into task counts. A numerical slot does not guarantee that a new task can start and become healthy. Use fixed examples with desired counts of three and four to understand rounding, health checks and the limits of rollback.

What you will learn

Calculate minimum healthy and maximum task counts, investigate stalled updates, and distinguish version rollback from business recovery.

Prerequisite

Read ECS task/service fundamentals and container/ALB health checks first. The examples use a REPLICA service with ROLLING, earlySuccessCriteria disabled, all old tasks initially healthy, and no initially pending or stopping tasks. This is neither a live-AWS procedure nor a complete placement simulator.

Think in task counts during an update

MinimumHealthyPercent sets a lower healthy-task bound; maximumPercent sets an upper deployment-task bound. Multiply by desiredCount, round the minimum up and the maximum down. Different percentages can therefore produce the same whole-task count.

Calculations used in this lesson
BoundCalculationMeaning
Minimum healthyceil(desiredCount × minimumHealthyPercent / 100)Round up; helps assess room to stop healthy old tasks.
Maximum tasksfloor(desiredCount × maximumPercent / 100)Round down; helps assess room to add tasks.

Desired count three: percentages without a whole-task slot

Desired count 3, minimumHealthyPercent 75 and maximumPercent 125. The minimum is ceil(2.25)=3; the maximum is floor(3.75)=3. Starting with three healthy old tasks leaves no room either to stop one healthy task while preserving the minimum or to add one while preserving the maximum.

Fixed three-task example: both bounds equal three
Fixed three-task example: both bounds equal three1: Minimum healthy 3 — No healthy stop slot — Three old tasks, all healthy. 2: Three old tasks, all healthy — No add slot — Maximum tasks 312Minimum healthy 3Three old tasks,all healthyMaximum tasks 3Fixed three-task example: both bounds equal three1: Minimum healthy 3 — No healthy stop slot — Three old tasks, all healthy. 2: Three old tasks, all healthy — No add slot — Maximum tasks 312Minimum healthy3Three old tasks, all healthyMaximum tasks 3
  1. Minimum healthy 3 → Three old tasks, all healthyNo healthy stop slot
  2. Three old tasks, all healthy → Maximum tasks 3No add slot
Minimum healthy 3
ceil(3 × 75 / 100)
Three old tasks, all healthy
Fixed initial condition
Maximum tasks 3
floor(3 × 125 / 100)

Desired count four: a slot is not readiness

Fixed example: desired four, minimum 50%, maximum 200%
ItemValueWhat this does not establish
Minimum healthyceil(4 × 50 / 100)=2Two tasks need not meet workload or latency requirements.
Maximum tasksfloor(4 × 200 / 100)=8Eight tasks need not actually be placeable or startable.
Initial add room8 − 4 = 4Resources, IPs, quotas, startup and checks remain unverified.
Numerical room to stop healthy old tasks4 − 2 = 2This does not predict that two will stop simultaneously.

Check when newly started tasks count toward the healthy bound. Essential-container checks and load-balancer checks, when configured, affect that decision. A RUNNING count alone does not establish that reducing old tasks is safe.

EarlySuccessCriteria is disabled in these examples. When configured, read its completion criterion separately from subsequent source-task cleanup. Do not generalize a COMPLETED label into proof that every task already runs the new revision.

Separate failure detection from rollback eligibility

Checks for the deployment circuit breaker
AspectCheckAvoid assuming
Deployment scopeROLLING and enable configuration.This is not the same mechanism for every strategy.
Failure countingthresholdConfiguration, resetOnHealthyTask and related settings.One failure count does not apply to every configuration.
Automatic rollbackWhether rollback is enabled.Enabled detection is not evidence of completed recovery.
Rollback targetThe most recent eligible COMPLETED deployment.A newly created service need not have a completed target.
Recovery evidenceRevision, tasks, checks, user operations and side effects.Reverting application code does not revert all data.

Without an eligible COMPLETED target, do not expect automatic circuit-breaker rollback. The guide describes new task launching stopping and the deployment stalling in this case. An initial release therefore also needs a recovery plan.

Investigate a stalled update with matching revisions and times

  1. Identify service, strategy, desired count, source/target revisions and observation time.
  2. Convert percentages to whole-task bounds; compare actual RUNNING/PENDING/STOPPING and healthy counts.
  3. Use service events to distinguish add/stop constraints, placement, IP, quotas and startup failures.
  4. Compare new-task container and ALB checks; do not infer health from RUNNING alone.
  5. Check failure detection, rollback settings and an eligible COMPLETED target.
  6. After rollback or retry, verify actual revision, user operations, data and external effects.

Separate unhealthy-task replacement from an update to the target revision. Current guidance describes replacement using the service revision to which the unhealthy task belongs. Replacing an unhealthy source-revision task does not by itself establish completion of the target deployment.

Check the arithmetic and the evidence

Choose an option to see the result and explanation.

Desired three, minimum75%, maximum125%, initially three healthy old tasks. Which follows?
Read the answer and reason

Answer: Minimum3, maximum3; no whole add/healthy-stop slot initially · Ceiling and floor both produce three; this is not a complete placement prediction.

Desired four, minimum50%, maximum200%. What does initial add room of four establish?
Read the answer and reason

Answer: The gap to maximum8 is four; placement, startup and health need evidence · This separates numerical room from actual successful execution.

An initial deployment fails with no eligible COMPLETED target. What follows?
Read the answer and reason

Answer: Do not assume automatic recovery; inspect failures and the recovery plan · A missing target is a separate condition from whether rollback is enabled.

An old task shows STOPPING. Can you assert that one new-task slot is free?
Read the answer and reason

Answer: No; compare applicable rules, counts and service events · This avoids inferring placement success or capacity-release time from a label.

After a new revision writes to a DB, the app is reverted. What still needs checking?
Read the answer and reason

Answer: Data compatibility, existing writes, external notifications and actual user operations · A version revert does not establish reversal of data or external effects.

Check, then explain in your own words

  1. Explain why the three-task example has no whole-task room after rounding.
  2. Separate computable bounds from conditions needing real evidence in the four-task example.
  3. Explain rollback eligibility and limits including data and external effects.
Check your understanding: Do valid deployment bounds and enabled rollback guarantee uninterrupted recovery?

No. Bounds, placement/health, rollback target and business outcomes need separate evidence.

Whole-task room is only part of the conditions. Verify target eligibility, real capacity and checks, plus data compatibility and reversible effects.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.