2

I have connection draining enabled for a ELB. According to the documentation at http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#conn-drain, a deregistering or unhealthy instance will keep existing connections open:

Connection draining causes the ELB load balancer to stop sending new requests to a deregistering instance or an unhealthy instance, while keeping the existing connections open.

I'd like to perform some maintenance on EC2 nodes in the ELB. It would be nice to gracefully take them out of rotation manually. I have tried failing the health checks and manually removing the EC2 instance from the ELB. Both of these actions kill existing connections to the instance.

How can I manually set a EC2 instance to deregistering or unhealthy state so that it will continue to serve existing connections but not accept new ones?

  • 2
    Manually removing it via the ELB console counts as deregistering per the docs. You may want to contact support if it isn't working right. – ceejayoz Sep 26 '14 at 15:08
1

You could perhaps set up a new security group which rejects inbound connections from the ELB but allows outbound connections back.

When you need to perform maintenance, you can switch the affected EC2 instance to this new security group and wait for the remaining connections to drop off.

The only thing I'm not sure on is if changing the security group will kill existing connections. I don't believe it will but I haven't tested to be sure.

  • This is an interesting idea. I'll try this and will be happy to accept if it works. – Andy Shinn Sep 26 '14 at 17:32
  • Hi Andy, am interested to know if that works? =) – ngzhongcai Mar 20 '15 at 1:53
0

Connection draining only applies at network level, ELB doesn't know your session state. Please see this old answer. Is ELB draining tcp based?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.