What happens with EC2 Instance when It fails status check fail and it has termination protection ON

0

I want to understand this scenario like if I have termination protection ON against EC2 instance which has been created through autoscaling group. What happens if the status check fails or due to some reason instance got crashes will it be swap the instance (terminate and recreate new one). Is it recommend to enable termination protection on for EC2 instance which has autoscaling group

3 Answers
3
Accepted Answer

Termination protection for AWS EC2 instances does not prevent termination due to scheduled maintenance, Auto Scaling actions (like during scale-in events or for unhealthy instances), and cannot be applied to Spot Instances. It mainly protects against accidental deletions.

Resources:

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed a month ago
profile picture
EXPERT
reviewed 2 months ago
profile pictureAWS
EXPERT
reviewed 2 months ago
0

Hi,

In the scenario where the instance fails the status checks or crashes, the Auto Scaling group will attempt to recover the instance according to its configured settings. This might involve performing actions like stopping and starting the instance, or terminating and replacing the instance if it cannot be recovered. However, if termination protection is enabled on the instance, the Auto Scaling group will not be able to terminate it directly.

  1. Criticality of Instances: If the instances in your Auto Scaling group are critical to your application's availability and you want to minimize the risk of accidental termination, enabling termination protection can provide an additional layer of safety.
2)Automation and Monitoring: You should have robust automation and monitoring in place to handle instances that fail status checks or encounter issues. This ensures that any issues are detected and addressed promptly, even if termination protection is enabled.
3)Manual Interventions: Enabling termination protection means that manual interventions to terminate instances will not work. If you need the ability to manually terminate instances for maintenance or troubleshooting purposes, you may need to disable termination protection temporarily.

4)Cost Considerations: Keeping instances running indefinitely due to termination protection can incur costs. Ensure that you have processes in place to review and manage instances effectively to avoid unnecessary costs.
profile picture
answered 2 months ago
0

This scenario, where an instance that has been launched by an auto-scaling group then fails an instance check, is described in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstances.html#InitialSteps

  • If your instance is in an Auto Scaling group, the Amazon EC2 Auto Scaling service automatically launches a replacement instance. For more information, see Health Checks for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide.

Not the same as Termination Protection, but still worth mentioning here, is Scale-In Protection which can prevent an instance being terminated by an auto-scaling group https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html

profile picture
EXPERT
Steve_M
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions