Reputation: 165
I have a autoscalling in AWS, that basically do:
script.py
My autoscalling is configured to start/terminate instance based on # of avaliables messages in queue. But sometimes when i processing something in machines and my # of messages, my autoscaling trigger to terminate instances, so i end losting message in the middle of processing.
I starting trying to handler signals but does not seem to be working.
My main goal is:
Is there anyway to archive this? I'm not using load balancing because i manually get the messages from queue.
Upvotes: 2
Views: 338
Reputation: 1897
you can use AWS autoscaling lifecycle hooks, they will put your ec2 instance in wait state before terminating it and deliver a message to SNS or cloudwatch that your instance is ready to terminate you can finish your already processed message in the mean time, i found an interesting blog post explaining the use case similar to yours .
AWS autoscaling lifecycle hooks
Upvotes: 4