Your deployment job finishes. The load balancer is healthy. The application answers HTTP 200.
But the new version never reached users.
One way this can happen: ECS attempts a release, the new tasks fail, and an enabled deployment circuit breaker rolls the service back to the previous working deployment. Availability recovers. The requested release still failed.
That distinction belongs in your deployment verification.
Health answers one question
A health endpoint answers the question you designed it to answer: perhaps “can this process respond?” or “can this instance serve traffic?”
It does not automatically establish which image is responding, which task-definition revision is active, or whether the release you requested completed.
Imagine this sequence:
| Step | Service state | Requested release |
|---|---|---|
| Revision 41 serves traffic | Healthy | Not started |
| Revision 42 starts | Transitioning | In progress |
| Revision 42 fails its checks | Recovering | Failed |
| ECS restores revision 41 | Healthy again | Still failed |
AWS documents how the deployment circuit breaker can restore a previously completed deployment. That recovery is valuable. Reporting revision 42 as successful would hide the failure from the person shipping it.
“Stable” is not “the release I requested succeeded”
The AWS CLI offers a useful waiter:
aws ecs wait services-stable --cluster "$CLUSTER" --services "$SERVICE" Its documented condition checks for a single deployment and matching running and desired counts. It does not accept the task-definition ARN your release intended to deploy.
So use it as a convergence signal, not your entire release-success contract. A service that has recovered to the previous revision can satisfy stability without delivering the new release. A deliberately scaled-to-zero service also needs a different success definition from a running web application.
For the ordinary ECS rolling service discussed here, verification should connect three kinds of evidence:
- Identity: the active revision is the exact task-definition ARN returned for this release.
- Convergence: that rollout completed, with the intended nonzero task count and no pending tasks.
- Behavior: the application answers the checks that matter for this version.
If your deployment controller or strategy differs, adapt the verification to that lifecycle rather than assuming these fields cover it.
Record the expected revision before you wait
Capture the full task-definition ARN when your release registers it. Do not discover “expected” by asking the service what happens to be active later. That would make a rollback look correct by definition.
Also record the image digest. A tag is a convenient name; a digest identifies the image content. Pinning the task definition to the intended digest makes the release record useful when investigating what actually ran.
Here is a read-only inspection command for an existing service. Run it in Bash with AWS CLI credentials that can describe that service, and set your actual region, cluster, and service first:
export AWS_REGION='us-east-1' export CLUSTER='your-cluster' export SERVICE='your-service' aws ecs describe-services --region "$AWS_REGION" --cluster "$CLUSTER" --services "$SERVICE" --query '{failures:failures,services:services[].{taskDefinition:taskDefinition,desired:desiredCount,running:runningCount,pending:pendingCount,deployments:deployments[].{id:id,status:status,taskDefinition:taskDefinition,rolloutState:rolloutState,reason:rolloutStateReason}}}' --output json Compare that result with the ARN captured by your deployment job. Inspect API failures too; an empty service result is not success. The command only reads state. It does not deploy, scale, or change resources.
Make the verifier fail for the right reasons
A useful verifier polls the requested revision with a bounded deadline. It should distinguish these cases:
| Observation | Interpretation |
|---|---|
| Initial snapshot still shows the old revision | May be a stale observation; keep polling within the deadline |
| Target revision is IN_PROGRESS | Keep waiting, even if task counts already match |
| Target revision is FAILED | Fail the release |
| Target was observed, then replaced by another revision | Fail verification and investigate rollback or a concurrent deployment |
| Expected rollout completes with matching nonzero counts | Continue to application checks |
| Deadline expires | Fail; do not turn “still waiting” into success |
These are verification rules, not a complete ECS deployment implementation. Error handling, throttling, your desired count, and deployment-strategy details still need deliberate treatment.
After the application check, read the active revision again. If another deploy replaced it during verification, you cannot claim that the earlier observation proves the final state.
Serialize deploy and rollback jobs where possible. A CI concurrency group helps within that workflow system; it does not automatically coordinate someone deploying from a laptop.
A green /health response is the start of application verification
Keep readiness checks fast and purposeful. Add a separate release check when you need stronger evidence.
For example, a version endpoint can return a commit or build identifier that the deployment job compares with its expected value. A bounded smoke test can exercise an important read path. Neither proves every business workflow works, but each states a clearer claim than “HTTP answered.”
When multiple replicas, caches, or traffic shifting are involved, one request may reach only one version. Choose checks that reflect your topology and avoid exposing secrets in diagnostic responses.
Test the failure path before you depend on it
Mocked snapshots are useful for testing verifier decisions: stable counts with an incomplete rollout, a failed target, a restored old revision, zero desired tasks, timeout, or a revision change during health checking.
A separate acceptance exercise in an isolated AWS sandbox tests the real integration. Begin with a known-good deployment, deliberately ship a controlled health-check failure, and verify all three outcomes:
- The deployment command reports the new release as failed.
- The service recovers to the recorded known-good revision when automatic rollback is configured and available.
- The recovered application passes its health check.
That exercise creates or uses billable infrastructure. Plan cleanup and retain the logs. The first deployment has no earlier successful application deployment to restore.
Application rollback also does not reverse database migrations, messages already delivered, or payments already made. Those need their own compatibility and recovery design.
How this relates to my Release Kit
Disclosure: I run MGCJ Labs. My DevOps Release Kit is an editable starting point for one stateless Docker application on ECS Fargate, priced at $149 USD once.
The current v1.2.4 kit brings Terraform, GitHub Actions with OIDC, digest-pinned images, requested-revision rollout verification, health checks, and rollback guidance into one documented workflow. You can inspect the free GitHub preview before buying.
The default is one task and is not a high-availability design. The base kit does not include databases or migrations. AWS usage and domains cost extra. Its published testing evidence distinguishes local checks from live deployment validation; you should run acceptance checks in your own environment.
Whether you use the kit or write the workflow yourself, retain separate outcomes for service recovered and requested release succeeded. That gives an operator useful information when a healthy old version is the reason the system is still serving traffic.
AI disclosure: This article was generated by an AI agent using the Release Kit documentation, source tests, and linked AWS documentation, with no human editing before publication.