Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.98 minutes in June 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

EC2 Control instance termination during Auto Scaling

by | Jul 10, 2021

Wondering about EC2 Control instance termination during Auto Scaling? Let us discuss.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us discuss EC2 Control instance termination.

 

EC2 Control instance termination during Auto Scaling

With the Auto Scaling group, we can control when it adds instances or removes instances from the network architecture.

Manually, we can adjust the desired capacity to scale the size of the group. Or, we can automate the process through scheduled scaling or a scaling policy.

 

Customize the termination policy

Moving ahead, let us see the steps our Support Techs employ to customize the termination policy.

Via console:

  1. Initially, we need to open the Amazon EC2 Auto Scaling console.
  2. Then we select the check box next to the Auto Scaling group, it will open a split-pane with information about the group we select.
  3. On the Details tab, we choose Advanced configurations >> Edit.
  4. For Termination policies, we can choose one or more termination policies.
    In case we select multiple policies, we list them in the order they should apply. If we use the Default policy, we make it the last one on the list.
  5. Finally, we select Update.

Via AWS CLI:

Here, we can use one of the following commands:

  • create-auto-scaling-group
  • update-auto-scaling-group

We can use them either individually or combine them into a list of policies.

For example, we use the command below to update an Auto Scaling group to use the OldestLaunchConfiguration policy first and then use the ClosestToNextInstanceHour policy.

aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --termination-policies "OldestLaunchConfiguration" "ClosestToNextInstanceHour"

Make sure that for the Default termination policy, make it the last one.

For example,

 --termination-policies "OldestLaunchConfiguration" "Default".

 

Enable instance scale-in protection for a group

We can enable instance scale-in protection when we create an Auto Scaling group. By default, instance scale-in protection is disabled.

Via console:

We go to the Configure Group Size and Scaling Policies page, under Instance Scale-in Protection, we select Enable Instance scale-in Protection.

Via AWS CLI: 

To enable instance scale-in protection, we use the following command:

aws autoscaling create-auto-scaling-group --auto-scaling-group-name my-asg --new-instances-protected-from-scale-in ...

 

Modify the instance scale-in protection setting for a group

When we enable the instance scale-in protection, all new instances we launch after it will have instance scale-in protection enabled.

However, the instances before that are not protected from scale-in unless we enable it for each instance individually.

Via console:

  1. Firstly, we open the Amazon EC2 Auto Scaling console.
  2. We select the check box next to the Auto Scaling group, which will then give us information about the group we select.
  3. Then we go to the Details tab >> Advanced configurations >> Edit.
  4. In the Instance scale-in protection, we select Enable instance scale-in protection.
  5. After that, we select Update.

Via AWS CLI:

To enable instance scale-in protection for the specified Auto Scaling group, we run:

aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --new-instances-protected-from-scale-in

On the other hand, to disable instance scale-in protection for the specified group, we run:

aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --no-new-instances-protected-from-scale-in

 

Modify the instance scale-in protection setting for an instance

By default, an instance gets its instance scale-in protection setting from its Auto Scaling group.

However, we can enable or disable this protection for an instance at any time.

Via console:

  1. We open the Amazon EC2 Auto Scaling console.
  2. Here, we select the check box next to the Auto Scaling group.
  3. On the Instance management >> Instances, we select an instance.
  4. To enable, we select Actions >> Set scale-in protection. When prompted, we choose Set scale-in protection.
  5. To disable, we select Actions >> Remove scale-in protection. When prompted, we select Remove scale-in protection.

Via AWS CLI:

To enable instance scale-in protection for an instance, we use:

aws autoscaling set-instance-protection --instance-ids i-5f2e8a0d --auto-scaling-group-name my-asg --protected-from-scale-in

Then to disable instance scale-in protection for an instance, we use:

aws autoscaling set-instance-protection --instance-ids i-5f2e8a0d --auto-scaling-group-name my-asg --no-protected-from-scale-in

[Need help with the procedures? We are here for you]

 

Conclusion

In short, we saw how our Support Techs go about EC2 Control instance termination.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

AWS Support

Use your time to build great apps. Leave your servers to us.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.
AWS Support

Use your time to build great apps. Leave your servers to us.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.

Categories:

Tags:

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF