Posted On: Nov 15, 2022

Today, Amazon Elastic Container Service (Amazon ECS) has announced the availability of ECS task scale-in protection, a new feature that enables customers to protect long-running tasks from being terminated by scale-in events and deployments.

Amazon ECS has an inbuilt Service auto scaling feature that lets you set policies to adjust the desired count of tasks of an ECS service in response to changes in traffic patterns. This enables customers to build applications that are highly scalable for peak traffic conditions, and reduce compute costs during periods of low utilization. Customers have told us that certain applications require a mechanism to safeguard mission-critical tasks from termination by scale-in events during times of low utilization or during service deployments. For instance, queue-processing asynchronous applications such as a video transcoding jobs wherein some tasks may be running for hours even when cumulative service utilization is low, or in case of a gaming application that runs game servers as ECS tasks that need to continue running even if all users have logged-out to reduce startup latency of a server reboot, or when a new code version is being deployed while some tasks have not yet finished completing ongoing work that would be expensive to reprocess.

With ECS task scale-in protection, customers can now use a new attribute - protectionEnabled – to protect tasks belonging to their ECS services from termination by service deployment or auto scaling scale-in events. Customers can use a new Amazon ECS Agent endpoint to set the protectionEnabled attribute from within a container, or use the new Amazon ECS API UpdateTaskProtection. ECS will ensure that tasks having scale-in protection set are not terminated by service auto scaling or deployment events. Once a task finishes its requisite work, customers can unset the property, enabling the task to be terminated by subsequent scale-in events. Customers can thus use ECS for orchestrating their long-running applications, while also benefiting from the performance and cost-savings of service auto scaling, without needing to invest in custom tooling.

Amazon ECS task scale-in protection is now available to all Amazon ECS customers in Amazon Web Services China (Beijing) Region, operated by Sinnet and Amazon Web Services China (Ningxia) Region, operated by NWCD. To learn more, refer to task scale-in protection user guide.