Preemptible instances or elastic compute enable access to additional compute resources for a short timed period at a low Service Unit (SU) cost. Preemptible instances will be a quarter (¼) of the SU cost of comparative m3 flavors. All preemptible instances will be killed after a 24 hour period, instances can be killed before 24 hours depending on current resource restraints.


Creating Preemptible Instances


You can use these, by launching an instance as normal on the Dashboard, and selecting the appropriate p3 prefix flavor, on the flavors tab. An example of the p3.xsmall flavor is shown in the screenshot below. 



The dashboard also provides a warning about the instance deleting after 24 hours. If you hover your mouse over the ! symbol, it will show the following below.



 

A full specification of all preemptible flavors is on the Nectar flavors page.


 

Will I get a notice or warning before my instance is deleted?


When your instance is deleted it will send an ACPI shutdown signal to your instance. With this you can configure your operating system to signal and do any clean up steps before your instance is shut down and deleted. When this signal is received by the operating system you will have 10 minutes to run a shutdown script before the instance is forcefully removed.


 An example on how to do this can be viewed here


NOTE: You will need to add TimeoutStopSec=600 to this systemd file too. This will give you a full 10 minutes to run the shutdown script. Otherwise, the default is only 90 seconds. 


An example of this in action:


$ cat /etc/systemd/system/run-before-shutdown.service
[Unit]
Description=Run my custom task at shutdown
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=/path/to/shutdown_script.sh
TimeoutStartSec=0
TimeoutStopSec=600

[Install]
WantedBy=shutdown.target