Possible to have AWS take a snapshot of a spot instance just prior to it's unplanned termination?
I've setup a lifecycle manager to reboot a spot instance and create an AMI of the instance once every 24 hours.
It would be ideal if it could do the same just prior to an unplanned termination event.
Is this possible?
Spot instances can be notified 2 minutes before termination - you can hook up your snapshotting script onto that event.
Alternatively you may choose to hibernate the instance instead of termination.
For more info about spot termination process check out the official docs on Spot instance interruptions
Hope that helps :)