Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in AWS by (12.9k points)

I would like to prevent EC2 instance termination by Auto Scaling feature if that instance is in the middle of some sort of processing.

Background:

Suppose I have an Auto Scaling group that currently has 5 instances running. I create an alarm on average CPU usage... Suppose 4 of the instances are idle and one is doing some heavy processing... The average CPU load will trigger the alarm and as a result the scale-down policy will execute.

How do I get Auto Scaling to terminate one of the idle instances and not the one that is in the middle of the processing?

closed

1 Answer

+1 vote
by (18.2k points)
selected by
 
Best answer

AWS provides an instance protection feature to control whether the autoscaling can terminate an instance when scaling in or not. 

According to the official documentation:

You can enable the instance protection setting on an autoscaling group or on a single autoscaling instance. if you have enabled it on an autoscaling group and a new instance gets launched then it will inherit the protection setting of the autoscaling group.

You can enable this feature using your AWS console as well as AMW CLI.

Refer to the following link for more information:

https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingBehavior.InstanceTermination.html#instance-protection

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...