This page describes Spot VMs: virtual machine (VM) instances that are excess Compute Engine capacity. Spot VMs have significant discounts, but Compute Engine might preemptively stop or delete (preempt) Spot VMs when it needs to reclaim that capacity. Spot VMs are the latest version of preemptible VMs.
The provisioning model of a VM affects its discounts and availability; Compute Engine VMs can use either the standard provisioning model (standard VMs) (default) or the spot provisioning model (Spot VMs). In contrast to standard VMs, Spot VMs are available at much lower prices but have lower availability because they are subject to preemption. Use Spot VMs to reduce costs for fault-tolerant workloads.
What are Spot VMs?
Spot VMs are available at much lower prices—60-91% discounts for machine types and GPUs as well as smaller discounts for local SSDs—compared to the on-demand price for standard VMs. However, Compute Engine might preempt Spot VMs if it needs to reclaim those resources for other tasks. At this uncertain preemption time, Compute Engine either stops (default) or deletes your Spot VMs depending on your specified termination action for each Spot VM. Spot VMs are excess Compute Engine capacity, so their availability varies based on Compute Engine usage. Spot VMs do not have a minimum or maximum runtime.
If your workloads are fault-tolerant and can withstand possible VM preemption, Spot VMs can reduce your Compute Engine costs significantly. For example, batch processing jobs can run on Spot VMs. If some of those VMs stop during processing, the job slows but does not completely stop. Spot VMs complete your batch processing tasks without placing additional load on your existing VMs and without requiring you to pay full price for additional standard VMs.
Spot VMs limitations
Spot VMs function like standard VMs but have the following limitations:
- Compute Engine might preempt Spot VMs at any time due to system events. The probability that Compute Engine stops Spot VMs for a system event is generally low, but might vary from day to day and from zone to zone depending on current conditions.
- Spot VMs are finite Compute Engine resources, so they might not always be available.
- Spot VMs can't live migrate to become standard VMs while they are running or be set to automatically restart when there is a host event.
- Due to the preceding limitations, Spot VMs 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 Spot VMs.
Preemption of Spot VMs
This section describes how Compute Engine preempts Spot VMs and which VMs are selected for preemption.
Compute Engine performs the following steps to preempt Spot VMs:
- Compute Engine sends a preemption notice to the VM 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 VM stops.
- If the VM does not stop after 30 seconds, Compute Engine sends an ACPI G3 Mechanical Off signal to the operating system.
- The final state of Spot VMs varies depending on your specified
termination action for each VM:
- If the termination action is set to
STOPor not specified, then Compute Engine stops the VM, transitioning the VM to a
- If the termination action is set to
DELETE, then Compute Engine deletes the VM.
- If the termination action is set to
If the preempted VM was stopped, it still appears in your project, but you are
not charged for the VM hours while it remains in a
TERMINATED state. You can
access and recover data from any persistent disks that are attached to the VM,
but those disks still incur storage charges until you delete them.
As with standard VMs, persistent disks that are marked for auto-delete
are deleted when you delete Spot VMs.
If Compute Engine preempts Spot VMs less than one minute after they are created, you are not billed for the use of those VMs. This ensures that you don't pay for Spot VMs unless they have had time to complete a significant amount of work. However, the charges for premium operating systems are still calculated as normal.
Preemption can happen when Spot VMs are in a
RUNNING state; while in a
TERMINATED state, Spot VMs
are not considered for preemption.
As a result, you can reset the preemption process by
Spot VMs, since
stopping VMs leaves them in a
You can stop and restart preempted Spot VMs
as many times as you would like, as long as there is capacity.
VMs or running
sudo reboot instead leaves VMs in a
RUNNING state and thus
do not reset the preemption process.
For suggestions on reducing your preemption rate, see our best practices.
If a preempted VM was stopped, you are not charged for the VM hours
while it remains in a
You can access and recover data from any persistent disks that are attached
to the VM, but those disks still incur storage charges until you delete them.
Learn more about instance uptime
and disk pricing.
Spot prices, the prices for Spot VMs, change over time, up to once every 30 days. Specifically, Spot VMs provide at least a 60% discount and up to a 91% discount on the price of standard VMs with the same machine types. To see the latest prices for Spot VMs, refer to the VM instance pricing page or use the Cloud Billing Catalog API.
Using Spot VMs with Compute Engine
This section provides notable information about using Spot VMs with other Compute Engine offerings. Learn about using Spot VMs with managed instance groups, premium operating systems, local SSDs, and GPUs. Additionally, understand how Spot VMs affect your quotas for Compute Engine resources.
Spot VMs in a managed instance group
You can create Spot VMs in a managed instance group using the gcloud CLI, or the Compute Engine API. Specify the options for creating Spot VMs in an instance template before you create or update the group.
Managed instance groups can create or add new Spot VMs 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 Spot VMs 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 one or more Spot VMs in a managed instance group, the group repeatedly tries to recreate those VMs using the specified instance template. If the necessary resources become available again, the group recreates the VMs and maintains the target group size.
Premium operating systems on Spot VMs
Spot VMs 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 Spot VMs that run a premium operating system, you are billed for that operating system as if you stopped the VMs 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 Spot VMs that run premium operating systems are always billed by the second, and follow the prices listed on the Machine type pricing page.
Local SSDs on Spot VMs
You can start Spot VMs with local SSDs and Compute Engine charges you spot prices for the local SSD usage. Local SSDs attached to Spot VMs work like normal local SSDs, retain the same data persistence characteristics, and remain attached for the life of the VM.
Compute Engine doesn't charge you for local SSDs if their VMs are preempted in the first minute after they start running.
For more information about local SSDs, see Adding local SSDs.
GPUs on Spot VMs
You can add GPUs to your Spot VMs at lower spot prices for the GPUs. GPUs attached to Spot VMs work like normal GPUs but persist only for the life of the VM. Spot VMs with GPUs follow the same preemption process as all Spot VMs.
Consider requesting dedicated
Preemptible GPU quota to use for GPUs on
Spot VMs. For more information, see
Quotas for Spot VMs.
During maintenance events, Spot VMs with GPUs are preempted by default and cannot be automatically restarted. If you want to recreate your VMs 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 VMs are preempted, or want to configure your VMs to automatically restart after a maintenance event, use standard VMs with a GPU. For standard VMs with GPUs, Compute Engine provides one hour advance notice before preemption.
Compute Engine does not charge you for GPUs if their VMs are preempted in the first minute after they start running.
For steps to automatically restart a standard VM, see Updating options for an instance.
Quotas for Spot VMs
If you use Spot VMs with these resources with and have not requested preemptible quota, Spot VMs consume your standard quota for these resources. If you plan to use Spot VMs, consider requesting preemptible quota for those resources to prevent Spot VMs from consuming your quotas.
After Compute Engine grants you preemptible quota in a region, all Spot VMs (and any preemptible 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 Spot VMs.
Preemptible quota is not visible in the gcloud CLI or 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