You are designing a solution for a startup company, the proposed solution is like this You suggest they use ECS instances to process requests from mobile App clients, and use SLB to distribute data traffic and ensure the load across each backend ECS instance is balanced.
Moreover to deal with volatile fluctuations in business volume (page views are much higher on the weekends), you also suggest they use Auto Scaling to dynamically increase or reduce computing resources.
The company is satisfied with the solution you proposed. However, they have one concern that when removing an idle instance from the scaling group: if Auto Scaling shuts the instance down directly, the service running on that instance will be abruptly terminated, resulting in poor user experience.
In order to eliminate your customer's concern, which of the following solutions should you recommend them?
A. Find the ECS instance that is going to be removed from the backend server pool of the SLB instance, and manually remove this instance from the backend server pool Applications running on this ECS instance will normally return results, but this instance will not be assigned with new requests.
B. Find the ECS instance that is going to be removed from the backend server pool of the SLB instancer and automatically set the weight of this ECS instance to 0. This instance will not be assigned with new requests, and will be automatically removed from the backend server pool after existing tasks are completed.
C. Use the Lifecycle Hook function embedded m Auto Scaling Define a suitable timeout and a web hook to do the necessary work before the instance is removed.
D. First, insert a script into the image for creating the ECS instance Second, make the script run automatically when the operating system in this ECS instances is about to shut down. This script contains the processing logic that can ensure the instance finish all the remaining tasks before shutting down.