Posted On: Jan 19, 2024

Today, Amazon Elastic Container Services (Amazon ECS) announced managed instance draining, a new capability that facilitates graceful shutdown of workloads deployed on Amazon Elastic Compute Cloud (Amazon EC2) instances by safely stopping and rescheduling workloads to other, non-terminating instances. This capability enables customers to simplify infrastructure maintenance workflows, such as rolling out a new Amazon Machine Image (AMI) version, without needing to build custom solutions to gracefully shutdown instances without disrupting their workloads.

Amazon ECS customers can deploy their workloads on serverless compute with AWS Fargate or on Amazon EC2 instances for greater control over infrastructure provisioning. With Fargate, customers can just focus on building and deploying their workloads, however, deploying workloads on Amazon EC2 requires customers to manage infrastructure operations, such as scaling capacity, performing OS and security updates, configuring instance mix, and monitoring instance health. Amazon ECS Capacity Providers manage automatic scaling of instances in response to workload requirements by leveraging Auto Scaling groups (ASG). With today’s launch, capacity providers facilitate graceful instance termination by safely stopping running tasks, launching replacement tasks on non-terminating instances, and delaying instance termination until all tasks have stopped gracefully (up to 48 hours). Customers can now simplify infrastructure updates using ASG Instance Refresh to roll out a new AMI version, or maximum instance lifetime for periodic instance replacement, or any custom implementation without needing to build a solution to gracefully shutdown instances without disrupting workloads.

This capability is now available in all AWS Regions. To get started, see our documentation and blog.