Patching in Amazon ECS Managed Instances
In Amazon ECS Managed Instances, patching is a critical maintenance process where AWS automatically manages and updates software on managed container instances to ensure security and compliance while maintaining workload availability through a controlled, configurable process.
Instance lifecycle
By default, Amazon ECS managed container instances operate on a standardized 14–21 day lifecycle. Amazon ECS initiates graceful workload draining at day 14 from instance launch, with final termination occurring no later than day 21. Amazon ECS accommodates early draining under specific circumstances:
-
Detection of security vulnerabilities on the software
-
Hardware health degradation
-
To honor customer-configured event windows
This approach maintains system compliance while respecting customer-defined maintenance requirements.
Event windows and maintenance scheduling
AWS manages a managed container instance lifecycle through automated background processes that monitor a node's creation timestamp and maintenance schedules. Upon instance launch, AWS sets a default 14-day draining schedule and evaluates any customer-configured event windows.
Customers can schedule maintenance activities for their managed container instances by configuring event windows with appropriate tags. When an event window is tagged with a specific value, Amazon ECS maps these tags to the corresponding managed container instances of corresponding clusters and schedules instance maintenance during the defined time periods on a best effort basis.
If event windows exist, AWS adjusts the draining schedule to align with these windows, which may result in earlier draining than the default 14-day period to honor the specified event window. Event window modifications only affect newly launched managed container instances, ensuring predictable maintenance scheduling.
Until the scheduled draining time, Amazon ECS continues normal task placement operations on the managed container instances as per the customer's configuration.
Maintenance sequence
At the designated maintenance time, Amazon ECS begins its maintenance sequence by invoking the UpdateContainerInstancesState
API to initiate graceful workload draining. During the graceful termination period, Amazon ECS attempts to stop the workload on the instance marked for draining.
Amazon ECS employs a start-before-stop strategy for service tasks (or as per the Amazon ECS service configuration), ensuring replacement tasks are launched before stopping existing ones, minimizing service disruption. Throughout this process, Amazon ECS services honor all service deployment configurations while continuing draining attempts until day 21 from the instance launch.
If draining has not completed by day 21, Amazon ECS executes the DeregisterContainerInstance
API to stop the managed container instance and its remaining workloads to maintain compliance and patch the managed instance with the latest software.