Is your feature request related to a problem? Please describe.
There's a default ASG Lifecycle Hook we don't have access to in the console (unless you use cdk escape hatches probably). I think it's used with the capacity_providers enable_managed_draining flag here:
|
## Since the instances don't live long, this doesn't do anything, and the |
|
# lambda to spin down the system would trigger TWICE when going down with this. |
|
enable_managed_draining=False, |
Ours is set to off, so the lifecycle hook isn't used. There's a few options to play with:
- (My favorite so far): Enable the flag and test how it handles with
daemon mode tasks. I bet when I last used that flag, it's when I was still on the other task mode. Since the task is tied directly to the instance, it might let the ASG spin down the tasks, then instantly kill the instance when the task exists. (It mentions the flag is for juggling tasks between instances is my only concern, but it should be similar logic, so maybe it does 1 -> 0 too).
- We can create and attach a second Lifecycle policy, with
Abandon instead of Continue. If it has less of a heartbeat, then it'll trigger and stop the instance from waiting 300 seconds. (Minimum is 30sec).
- Or write an escape hatch that deletes the lifecycle hook completely, so the instance shuts down instantly.
Describe the solution you'd like
In case people are using this with complex containers that need to cleanup (and to prevent data corruption more), I'm really hoping #1 works out.
Describe alternatives you've considered
Leave it as is I guess? It's only 300 extra seconds of being charged $$, (and counts towards you vCPU limit in that time too), since the instance is technically up.
Acknowledgements
Is your feature request related to a problem? Please describe.
There's a default
ASG Lifecycle Hookwe don't have access to in the console (unless you use cdk escape hatches probably). I think it's used with the capacity_providersenable_managed_drainingflag here:AWS-ContainerManager/ContainerManager/leaf_stack_group/NestedStacks/EcsAsg.py
Lines 170 to 172 in 05e6189
Ours is set to off, so the lifecycle hook isn't used. There's a few options to play with:
daemon modetasks. I bet when I last used that flag, it's when I was still on the other task mode. Since the task is tied directly to the instance, it might let the ASG spin down the tasks, then instantly kill the instance when the task exists. (It mentions the flag is for juggling tasks between instances is my only concern, but it should be similar logic, so maybe it does 1 -> 0 too).Abandoninstead ofContinue. If it has less of a heartbeat, then it'll trigger and stop the instance from waiting 300 seconds. (Minimum is 30sec).Describe the solution you'd like
In case people are using this with complex containers that need to cleanup (and to prevent data corruption more), I'm really hoping #1 works out.
Describe alternatives you've considered
Leave it as is I guess? It's only 300 extra seconds of being charged $$, (and counts towards you vCPU limit in that time too), since the instance is technically up.
Acknowledgements