Amazon ECS Deployment Best Practices
Safety, Speed, and Visibility for ECS Deployments
Key Takeaways
Safety
- Define application health criteria and use container health checks and load balancer health checks to ensure safe deployments
- Ensure application can handle voluntary disruptions during deployments (SIGTERM handling)
- Leverage task placement constraints and strategies to spread tasks across availability zones for high availability
- Use task scale-in protection for worker-based applications to prevent interruption during deployments
Speed
- Optimize deployment speed by tuning min healthy percent and max percent settings
- Use techniques like lazy loading (SOCI) and Checkpoint Restore to speed up task launches
- Reduce load balancer deactivation timeout to speed up task shutdown
Visibility
- Leverage ECS deployment history and service revisions to gain visibility into deployments
- Use ECS circuit breaker and CloudWatch alarms to detect and automatically roll back failed deployments
- Monitor deployment velocity using container insights metrics
Recommended Actions
- Review your rolling deployment configuration and tune min healthy percent and max percent settings based on your environment (dev vs. production).
- Ensure your application health checks are properly defined and can accurately determine when the application is ready to receive traffic.
- Validate that your application can gracefully handle voluntary disruptions during deployments (SIGTERM handling).
- Explore the use of ECS circuit breaker and CloudWatch alarms to automate deployment rollbacks on failure.
- Leverage the resources provided (workshops, blogs, documentation) to continue learning about ECS deployment best practices.
Remember, the goal is to balance safety, speed, and visibility to achieve high deployment velocity without compromising application availability or stability.