Posted On: Mar 6, 2018
Amazon EC2 Spot Instances receive a two-minute notification when these instances are about to be reclaimed by Amazon EC2. Starting today, the two-minute warning for Spot Instances is available via Amazon CloudWatch Events CLI and will continue to be available by accessing the Instance Metadata service.
Amazon CloudWatch Events deliver near real-time stream of system events that describe changes in Amazon Web Services resources. By setting up simple rules to match events, CloudWatch users can route these events to one or more target functions or streams. Now CloudWatch users can setup a rule that automatically sends the EC2 Spot two-minute warning to an SNS topic to get a push notification.
In 2015, Amazon Web Services launched the two-minute warning for Spot Instances, formally known as the Spot Instance Termination Notice. Until today the two-minute warning was accessible only by accessing the instance metadata service and Spot Instance users often had to run code on the instances themselves to monitor for the two-minute warning. Spot Instance users have been using the two-minute warning ever since allowing their applications to save state, upload final log files, or have instances remove themselves from an Amazon Elastic Load Balancing.