TransWikia.com

AWS autoscaling and ELB, use different health checking mechanism

Server Fault Asked by zsolt.k on January 1, 2022

I need some advice about AWS autoscaling, loadbalancers and health checks:

is it possible to distinguish two health checking mechanism, one is when to send or do not send traffic to an instance (but do not terminate/replace it), and the another is when to terminate/replace that instance.

Scenarios:

  • I have two instances behind a loadbalancer and I use autoscale. I want to perform some maintencance tasks on one of the instances so I do not want the loadbalancer
    send any traffic to it. But later I want to put it back to service.
  • Same as above, two instances behind a loadbalancer and using autoscale. One of the instances have an unrecoverable issue, so I want the autoscale terminate it
    and replace with an another instance.

Thanks in advance for the answers.

One Answer

It's not clear if you're using EC2 or ECS, and what type of ELB you're using and depends as well on type of app you're running. Please provide those details and little bit about your application stack if you want better answer.

In general when the client request hits the ELB it determines on which instance it "routes/send" the traffic (based on configuration let's say round-robin), when you remove the instance from ELB it doesn't mean the currently established connections are automagically routed to the remaining instance(s). You shall wait or monitor active connections on removed instance to get details, and when you see there aren't any active connections perform the maintenance (i.e. reboot the instance after upgarde).

One of the key factors is what holds the information about the current established sessions. If each instance is holding sessions separately "half of logged in users will be logged out". What you need to do is to store the session "somewhere else" often in ElastiCache or in DB/RDS, so when you remove the instance session remain connected (no logged out users). If you hold your sessions separately, when you remove the instance from ELB you can nuke it nearly immediately (but again, this depends on the app you're running)

There is very good information in AWS documentation:

ELB how it works

Detach EC2 from autoscaling group

Temporary remove instace from autoscaling group

Register or deregister instance in ELB

ELB health checks

Answered by Geeky Masters on January 1, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP