Amazon ECS supports Automated Draining for Spot Instances running ECS Services

Automated Spot Instance Draining will automatically place Spot instances in “DRAINING” state upon the receipt of two minute interruption notice. ECS tasks running on Spot instances will automatically be triggered for shutdown before the instance terminates and replacement tasks will be scheduled elsewhere on the cluster. No new ECS service tasks will be started on the instances once the termination process has begun. ECS takes over the coordination of termination of tasks with the termination of the underlying EC2 instance using the inherent instance “DRAINING” functionality. The managed termination, scheduling of replacement tasks and graceful termination of the LB connections reduces the probability of service interruptions. This makes it easier for customers to use Spot instances as part of their ECS cluster.

You can get started with this feature for a new container instance by setting the ECS_ENABLE_SPOT_INSTANCE_DRAINING parameter to “true” in the User Data field while launching the instance. For more information about using ECS Automated Spot Instance Draining, please see the Amazon ECS documentation. This feature is now available across all regions globally.