Home » Computer » Network » Cloud » AWS » 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 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.


Leave a Reply

Your email address will not be published. Required fields are marked *