This page describes preemptible virtual machine (VM) instances. To learn how to create a preemptible instance, read Create and use preemptible VMs. To learn more about instances in general, read the Virtual machine instances documentation.
What is a preemptible instance?
Preemptible VM instances are available at much lower price—a 60-91% discount—compared to the price of standard VMs. However, Compute Engine might stop (preempt) these instances if it needs to reclaim the compute capacity for allocation to other VMs. Preemptible instances use excess Compute Engine capacity, so their availability varies with usage.
If your apps are fault-tolerant and can withstand possible instance preemptions, then preemptible instances can reduce your Compute Engine costs significantly. For example, batch processing jobs can run on preemptible instances. If some of those instances stop during processing, the job slows but does not completely stop. Preemptible instances complete your batch processing tasks without placing additional workload on your existing instances and without requiring you to pay full price for additional normal instances.
Preemptible instance limitations
Preemptible instances function like normal instances but have the following limitations:
- Compute Engine might stop preemptible instances at any time due to system events. The probability that Compute Engine stops a preemptible instance for a system event is generally low, but might vary from day to day and from zone to zone depending on current conditions.
- Compute Engine always stops preemptible instances after they run for 24 hours. Certain actions reset this 24-hour counter.
- Preemptible instances are finite Compute Engine resources, so they might not always be available.
- Preemptible instances can't live migrate to a regular VM instance, or be set to automatically restart when there is a maintenance event.
- Due to the preceding limitations, preemptible instances are not covered by any Service Level Agreement and are excluded from the Compute Engine SLA.
- The Google Cloud Free Tier credits for Compute Engine do not apply to preemptible instances.
Preemption of preemptible VMs
This section describes how preemptible VMs are preempted by Compute Engine and which VMs are selected for preemption.
Compute Engine performs the following steps to preempt an instance:
- Compute Engine sends a preemption notice to the instance in the form of an ACPI G2 Soft Off signal. You can use a shutdown script to handle the preemption notice and complete cleanup actions before the instance stops.
- If the instance does not stop after 30 seconds, Compute Engine sends an ACPI G3 Mechanical Off signal to the operating system.
- Compute Engine transitions the instance to a
You can simulate an instance preemption by stopping the instance.
Preempted instances still appear in your project, but you are not charged for
the instance hours while it remains in a
TERMINATED state. You can access and
recover data from any persistent disks that are attached to the instance, but
those disks still incur storage charges until you delete them. As with normal
instances, persistent disks that are marked for auto-delete are deleted when you
delete the preemptible instance. You can restart a preempted instance as many
times as you would like, as long as there is capacity. Restarting a preemptible
instance resets the preemptible process.
If Compute Engine stops a preemptible instance less than one minute after it is created, you are not billed for the use of that VM instance. This ensures that you don't pay for preemptible instances unless they have had time to complete a significant amount of work. However, the charges for premium operating systems are still calculated as normal.
See our best practices for suggestions on reducing your preemption rate. Note that Compute Engine doesn't charge you for instances if they are preempted in the first minute after they start running.
Certain actions reset the 24-hour counter for preemptible instances.
Specifically, if you
an instance, Compute Engine resets the counter because the
instance transitions into a
TERMINATED state. However, other actions, where the
instance remains in
RUNNING state, do not reset the counter, for example,
an instance or running
sudo reboot from within the VM.
Preemptible VMs use spot prices, the same pricing model as Spot VMs. For more information about the pricing of preemptible VMs, see pricing for Spot VMs. For current prices, refer to the Compute Engine pricing pages.
Using preemptible VMs with Compute Engine
This section provides notable information about using preemptible VMs with other Compute Engine offerings. Learn about using preemptible VMs with managed instance groups, premium operating systems, local SSDs, and GPUs. Additionally, understand how preemptible VMs affect your quotas for Compute Engine resources.
Preemptible instances in a managed instance group
Managed instance groups can create or add new preemptible instances only when additional Compute Engine resources are available. If these resources are limited, managed instance groups are unable to resize or automatically scale the number of preemptible instances in the group.
Managed instance groups always attempt to maintain their target size or the size specified by the autoscaler for that group. If Compute Engine stops a preemptible instance in a managed instance group, the group repeatedly tries to recreate that instance using the specified instance template. If the necessary resources become available again, the group recreates the instance and maintains the target group size.
Premium operating systems on preemptible instances
Preemptible instances don't reduce the cost of premium operating systems and don't change the way that you're billed for the use of those operating systems. If Compute Engine stops a preemptible instance that runs a premium operating system, you are billed for that operating system as if you stopped the instance yourself. The charges for minimum usage still apply, and bills for premium operating systems are still calculated by rounding up to the nearest usage increment.
The machine types on preemptible instances that run premium operating systems are always billed by the second, and follow the prices listed on the VM instance pricing page.
Local SSDs on preemptible instances
If you start a Spot VM or preemptible VM with a Local SSD disk, Compute Engine charges discounted spot prices for the Local SSD usage. Local SSD disks that are attached to Spot VMs or preemptible VMs work like normal Local SSD disks, retain the same data persistence characteristics, and remain attached for the life of the VM.
Compute Engine doesn't charge you for Local SSD disk usage on a Spot VM or preemptible VM if the VM is preempted within a minute after it starts running.
GPUs on preemptible instances
You can add GPUs to your preemptible VM instances at lower spot prices for the GPUs. GPUs attached to preemptible instances work like normal GPUs but persist only for the life of the instance. Preemptible instances with GPUs follow the same preemption process as all preemptible instances.
Consider requesting dedicated
Preemptible GPU quota to use for GPUs on
preemptible instances. For more information, see
Quotas for preemptible VM instances.
During maintenance events, preemptible instances with GPUs are preempted by default and cannot be automatically restarted. If you want to recreate your instances after they have been preempted, use a managed instance group. Managed instance groups recreate your instances if the vCPU, memory, and GPU resources are available.
If you want a warning before your instance is preempted, or want to configure your instance to automatically restart after a maintenance event, use a standard instance with a GPU. For standard instances with GPUs, Google provides one hour advance notice before preemption.
Compute Engine does not charge you for GPUs if their instances are preempted in the first minute after they start running.
For steps to automatically restart a standard instance, see Updating options for an instance.
To learn how to create preemptible instances with GPUs attached, read Create a VM with attached GPUs.
Quotas for preemptible VM instances
Like other VMs, preemptible VMs require available CPU quotas. Additionally, if you plan to use preemptible VMs with local SSDs or with GPUs, preemptible VMs also require disk quota and GPU quota respectively.
If you use preemptible VMs with these resources with and have not requested preemptible quota, then preemptible VMs consume your standard quota for these resources. If you plan to use preemptible VMs, consider requesting preemptible quota for those resources to prevent preemptible VMs from consuming your quotas.
After Compute Engine grants you preemptible quota in a region, all preemptible VMs (and any Spot VMs) in that region count against that quota. All standard VMs in that region continue to count against the standard quota. In regions where you don't have preemptible quota, you can use standard quota to launch preemptible VMs.
Preemptible quota is not visible in the gcloud CLI or Google Cloud console quota pages unless Compute Engine has granted the quota.
Learn how to request preemptible quota.
Try it for yourself
If you're new to Google Cloud, create an account to evaluate how Compute Engine performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.Try Compute Engine free