Amazon Web Services finally adds one of its most useful features to Auto Scaling Groups: the Instance Termination Protection.
For regular AWS EC2 instances, this prevented users to accidentally terminate useful instances by forcing them to disengage the protection prior to terminate the instance. Until today, this feature was not available on EC2 instances launched in Auto Scaling Groups and in this case, termination was not even user-initiated, but automated, with the “oldest” (=the first launched and often most important) instances being terminated first by default in case of a scale-in (reduction of resources).
The only way to mitigate the risk was to carefully set the minimum instances number for the ASG, set the termination policy to
NewestInstance and run the critical services (long-running tasks, master nodes and state controllers) on the instances launched as “minimum” group. Being the “oldest” instances, those ones were somehow (but not totally) protected from (automated) termination.
Starting today, a new procedure to enable termination protection in Auto Scaling Group EC2 Instances is available.
From the official announcement:
You can now protect specific instances in an Auto Scaling group from termination during a scale in event, in case those instances are performing a long-running task, or fulfilling a stateful role such as a master node in a Hadoop cluster.