Replies: 1 comment
-
Yes @frjonsen , there is a way to achieve this by using lifecycleHook` property of AutoScalingGroup to specify a Lambda function that will be invoked before the instance is terminated. In your lambda function, you can drain the tasks from the instance before its terminated.
Hope this helps ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an ECS cluster and an autoscaling group, which is added to the cluster using
addAsgCapacityProvider
.The autoscaling group uses a Launch Template, which includes some CfInit.
I've noticed that if I change the launch template, for example changing instance type, it will immediately kill the old instances without draining them. The instances updates are at least rolling out one instance at a time, so of course I would prefer it if the tasks were moved to a new instance before the old one is killed.
I cannot figure out how to do this though. I've seen the properties
enableManagedScaling
andenableManagedTerminationProtection
, but these already default to true and only seem to come into play during a scale-in.Is there any way to achieve this, or do I just have to live with the system being unstable if I update the launch template?
Beta Was this translation helpful? Give feedback.
All reactions