Best Practice for Updating AWS ECS Service Tasks
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Updating an ECS service is usually just a task definition change followed by a deployment, but the operational quality of that deployment depends on how the service is configured. Good ECS practice is not "replace the tasks somehow". It is "create an immutable task definition revision, roll it out with health checks, and keep rollback simple".
Update by Registering a New Task Definition Revision
In ECS, you do not edit a running task in place. You register a new task definition revision and point the service to it.
That means the normal flow is:
- build and push a new image
- register a new task definition revision
- update the ECS service to use that revision
A CLI example:
This keeps deployments auditable and rollback-friendly.
Prefer Immutable Image References
Using floating tags such as latest makes ECS updates harder to reason about. It is better to publish images with immutable tags such as a Git SHA or build number and reference that tag in the task definition.
That way, task definition revision 42 always points to the exact same container image content.
Configure Rolling Deployment Settings Deliberately
For the default ECS rolling update strategy, minimumHealthyPercent and maximumPercent control how replacement happens.
Typical service settings:
- '
minimumHealthyPercent = 100' - '
maximumPercent = 200'
This lets ECS start replacement tasks before stopping healthy old ones, assuming capacity is available. It reduces downtime risk for normal stateless services.
Use Health Checks That Reflect Reality
An ECS rollout is only as good as the signal used to declare the new task healthy. Container health checks, load balancer health checks, and application startup behavior all matter.
If the application needs time to warm up, configure that explicitly rather than hoping the rollout timing lines up by accident.
This makes deployments much safer than relying on container process startup alone.
Know When Blue-Green Is Worth It
For higher-risk changes, ECS with CodeDeploy blue-green deployment can reduce impact and improve rollback behavior. That is especially useful when:
- startup is slow
- rollback must be fast
- you want traffic shifting rather than immediate replacement
For many internal stateless services, rolling deployment is enough. For high-traffic customer-facing services, blue-green is often worth the extra setup.
Force New Deployment Only for Valid Reasons
Sometimes you want ECS to replace tasks without changing the task definition, such as when pulling a newly pushed mutable image tag or refreshing environment attachment state.
This is useful, but it should not become a substitute for proper immutable task definition updates.
Keep Rollback Simple
Rollback should mean pointing the service back to the previous known-good task definition revision. That only stays easy if you:
- keep revisions traceable
- avoid mutable deployment artifacts
- monitor health during rollout
If a deployment fails, the previous task definition should already be available as the rollback target.
Common Pitfalls
- Reusing mutable image tags such as
latestin production task definitions. - Treating ECS service updates like in-place task mutation.
- Rolling out without meaningful application health checks.
- Using
force-new-deploymentas a default instead of versioned task revisions. - Forgetting to validate capacity when
maximumPercentallows extra tasks during rollout.
Summary
- Update ECS services by creating a new task definition revision and deploying that revision.
- Prefer immutable image tags so deployments and rollbacks are predictable.
- Tune rolling deployment settings and health checks deliberately.
- Use blue-green deployments when rollback speed and traffic control matter.
- Keep rollback easy by preserving clear revision history and monitoring each rollout.
Related reading
- Best strategy to deploy static site to s3 on github push?
- Best way to make Amazon AWS DynamoDB queries using Swift?
- best way to seed new machine with k8s/eks info
- Bigtable secondary indexes Best practices/Recommended-ways
- binary vs. string vs. number for storing UUID in DynamoDB partition key?
- boto3 client NoRegionError You must specify a region error only sometimes
- boto3 client NoRegionError You must specify a region error only sometimes
- boto3 equivalent to boto.utils.get_instance_metadata?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.