Configure Connection Draining for Your Classic Load Balancer

To ensure that a Classic Load Balancer stops sending requests to instances that are
de-registering or unhealthy,
while keeping the existing connections open, use connection draining. This enables
the load balancer to complete in-flight requests made to instances that are de-registering
or unhealthy.

When you enable connection draining, you can specify a maximum time for the load balancer
to keep connections alive before reporting the instance as de-registered.
The maximum timeout value can be set between 1 and 3,600 seconds (the default is
300 seconds).
When the maximum time limit is reached, the load balancer forcibly closes connections
to the de-registering instance.

While in-flight requests are being served, the load balancer reports the state
of a de-registering instance as InService: Instance deregistration currently
in progress. When the de-registering instance is finished serving all
in-flight requests, or when the maximum timeout limit is reached, the load balancer
reports the instance state as OutOfService: Instance is not currently registered
with the LoadBalancer.

If an instance becomes unhealthy, the load balancer reports the instance state as
OutOfService. If there are in-flight requests made to the unhealthy
instance, they are completed. The maximum timeout limit does not apply to
connections to unhealthy instances.

If your instances are part of an Auto Scaling group and connection draining is enabled
for your load balancer, Auto Scaling waits for the in-flight requests to
complete, or for the maximum timeout to expire, before
terminating instances due to a scaling event or health check replacement.

You can disable connection draining if you want your load balancer to immediately
close
connections to the instances that are de-registering or have become unhealthy.
When connection draining is disabled, any in-flight requests made to instances
that are de-registering or unhealthy are not completed.