Amazon EC2 autoscaling down with graceful shutdown?

后端 未结 3 1650
鱼传尺愫
鱼传尺愫 2020-12-23 17:10

We\'re looking at using EC2 autoscaling to deal with spikes in load. In our case we want to scale up instances based on an SQS queue size and then down scale with the queue

3条回答
  •  攒了一身酷
    2020-12-23 17:42

    In mid 2014 AWS introduced 'lifecycle hooks' which allows for full control of the termination process.

    Our high level down scale process is:

    • Auto Scaling sends a message to a SQS queue with an instance ID
    • Controller app picks up the message
    • Controller app issues a 'stop instance' request
    • Controller app re-queues the SQS message while the instance is stopping
    • Controller app picks up the message again, checks if the instance has stopped (or re-queues the message to try again later)
    • Controller app notifies Auto Scaling to 'PROCEED' with the termination
    • Controller app deletes the message from the SQS queue

    More details: http://docs.aws.amazon.com/autoscaling/latest/userguide/lifecycle-hooks.html

提交回复
热议问题