New AWS ECS feature: Managed draining of EC2 instances!


1 min


Since January 19, 2024, a new feature has been available on ECS: automated instance draining. This feature allows for the secure and scheduled shutdown of workloads (containers) deployed on EC2 instances.

As a reminder, AWS ECS offers two modes for executing container tasks: Fargate or EC2.

EC2 Managed instances draining

This feature facilitates the gradual shutdown of workloads deployed on EC2 instances by safely stopping and rescheduling workloads on other instances.

This simplifies infrastructure maintenance operations, such as deploying a new AMI version. Automated draining covers various use cases:

To benefit from this new feature

              - Manually in the AWS console (flag)
              - Using the command line

Or, like our clients who efficiently managed their infrastructure with Terraform:

Terraform registry: ecs capacity provider

Managed draining was a highly anticipated feature missing from this orchestrator. Previously, if smooth draining was desired, one had to implement a complex system based on event listening for scaling with Lambda functions to check certain states and trigger actions accordingly.

Source : Amazon ECS : managed instance draining

Thank you for reading this article. We hope you enjoyed it!

Contact us for more information about our accompaniment and expertise !