Time between AWS Notifying of Scale Down and Terminating instance
- by SteveEdson
Here is the scenario, there are multiple EC2 instances behind a load balancer. When traffic dies down, the SCALE_DOWN policy is triggered from a CloudWatch alarm. What I would like, is for the instance that is going to be terminated, or a separate server altogether, to be able to run a quick script that will execute a few commands to ensure all data has been transferred.
My initial question was going to be how can I send a notification when an instance is going to be terminated by an auto scale, SCALE_DOWN policy. But then I saw this question Amazon EC2 notifying the instance when the autoscale service terminates it.
If the notification is sent, how much time is there before the instance actually gets terminated? Are there any parameters to specify this time?
Would it be a better idea to notify an instance that it is no longer needed, and get the instance to terminate itself once it has finished running the final script?
Or, am I making this into a bigger problem than it actually is, and theres a far simpler solution?