Google Cloud Platform 也推出了類似 Spot Instance 的產品

Google Cloud Platform 推出了類似於 Amazon EC2 的 Spot Instance 的產品,叫做 Preemptible VM:「Introducing Preemptible VMs, a new class of compute available at 70% off standard pricing」。

不同的是,沒有引入競價系統,而是固定的 discount。另外有一些限制,像是最多持續 24 小時:

The tradeoff is that Preemptible VMs are limited to a 24 hour runtime, and will sometimes be preempted (shut down) earlier than that.

而停機通知時間比 Spot Instance 短,只有 30 秒 (相較於 Spot Instance 有兩分鐘):

When Preemptible VMs are terminated, they'll receive a 30 second notice allowing you to shutdown cleanly (including saving work, if applicable).

Amazon EC2 Spot Instance 的關機通知

AWS 改善了 EC2 Spot Instance 的關機通知,在決定 terminate 前兩分鐘 instance 可以得知消息,讓 instance 可以處理「後事」,像是將計算的資料寫回 EBS 或是 S3:「New – EC2 Spot Instance Termination Notices」。

Today we are improving the reclamation process with the addition of a two-minute warning, formally known as a Spot Instance Termination Notice.

不過目前不是 trigger,而是透過 polling 的方式提供:

The Termination Notice is accessible to code running on the instance via the instance’s metadata at http://169.254.169.254/latest/meta-data/spot/termination-time. This field will become available when the instance has been marked for termination (step 3, above), and will contain the time when a shutdown signal will be sent to the instance’s operating system.

建議的 polling 時間是五秒鐘一次:

We recommend that interested applications poll for the termination notice at five-second intervals.

至少有方法得知了...