0

Our application should be "quiesced" when it is being removed from service from an ALB. I am aware that the http requests are "drained" from the terminating instance before it is removed, but we need the application to also stop handling/producing rabbitmq messages.

We already have scripts that we can ship within the application folder that an operator can execute if this needs to be done manually - they control the HTTPCode returned by the Health Check endpoint. These are useful if the application instance needs to tell the ALB to stop sending requests. But is there a way the ALB can inform the application to quiesce itself before it is terminated?

I'm also wondering if there is a way that the application can delay the terminate while it finishes up jobs or waits for requests to complete.

I'm particularly interested from the point of view of auto-scaling as there is no way in advance to know which instance will be terminated and thus an operator has no chance to run the scripts in advance

Peter McEvoy
  • 2,816
  • 19
  • 24

1 Answers1

2

This is exactly what EC2 Auto Scaling Lifecycle Hooks are for. In essence, it will stop sending traffic to the instance and notify the instance that it needs to prepare to be terminated, then wait for the instance to say it is ready to be terminated.

Mark B
  • 183,023
  • 24
  • 297
  • 295