Spot VMs

This page describes Spot VMs: virtual machine (VM)instances that are excess Compute Engine capacity. Spot VMshave significant discounts, but Compute Engine might preemptivelystop or delete (preempt) Spot VMs to reclaim the capacityat any time. Spot VMs are the latest version ofpreemptible VMs.

Spot VMs are VMs that use thespot provisioning model.This provisioning model lets you obtain resources at much lower prices comparedto standard VMs. However, Compute Engine can preemptSpot VMs at any time to reclaim resources. Use Spot VMs toreduce costs for fault-tolerant workloads.

To learn more about Compute Engine VMs in general, read theVirtual machine instances documentation.To learn how to create Spot VMs, readCreate and use Spot VMs.

What are Spot VMs?

Spot VMs are available at much lowerprices—up to 91% discounts for many machine types, GPUs, TPUs,and Local SSDs—compared to the default price for standard VMs. However,Compute Engine might preempt Spot VMs at any time, such aswhen it needs the resources for other tasks. At this uncertain preemption time,Compute Engine either stops (default) or deletes yourSpot VMs depending on your specified termination action for eachSpot VM. Spot VMs are excess Compute Enginecapacity, so their availability varies based on Compute Engine usage.Spot VMs don't have a minimum or maximum runtime unless youspecificallylimit the runtime.

If your workloads are fault-tolerant and can withstand possible VMpreemption, Spot VMs can reduce your Compute Enginecosts significantly. For example, batch processing jobs can run on Spot VMs.If some of those VMs stop during processing, thejob slows but does not completely stop. Spot VMs complete yourbatch processing tasks without placing additional load on your existingVMs and without requiring you to pay full price for additional standard VMs.

Spot VMs limitations

Spot VMs function like standard VMs but have thefollowing limitations:

  • Compute Engine might preempt Spot VMs to reclaimthe resources at any time. Compute Engine preemptsSpot VMs for a variety of reasons—for example, system events.The probability that Compute Engine preemptsSpot VMs is generally low, but might vary from day to day andfrom zone to zone depending on current conditions. For more information,seePreemption selection in this document.
  • Spot VMs are finite Compute Engine resources,so they might not always be available.
  • Spot VMs don't support the following machine series:
    • A4X
    • X4
    • Bare metal instances
  • Spot VMs can'tlive migrateto become standard VMs while they are running or be set toautomatically restartwhen there is ahost event.
  • Due to the preceding limitations, Spot VMs are not covered by anyService Level Agreement and are excluded from theCompute Engine SLA.
  • TheGoogle Cloud Free Tier credits forCompute Engine don't apply to Spot VMs.

Preemption of Spot VMs

This section describes how Compute Engine preemptsSpot VMs and which VMs are selected for preemption.

Preemption process

Compute Engine performs the following steps topreempt Spot VMs:

  1. Compute Engine sends a preemption notice to the VM in theform of anACPI G2 Soft Off signal. You can use ashutdown scriptto handle thepreemption notice and complete cleanup actions before the VM stops.The shutdown period for a preemption notice is best effort and up to30 seconds.
  2. If the Spot VM has not stopped after the shutdown period forthe preemption notice, Compute Engine sends anACPI G3 Mechanical Off signal to the operating system.
  3. The final state of Spot VMs varies depending on your specifiedtermination action for each VM:
    • If the termination action is set toSTOP or not specified, thenCompute Engine stops the VM, transitioning the VM to aTERMINATEDstate.
    • If the termination action is set toDELETE, then Compute Enginedeletes the VM.

You can simulate the preemption of a VM bystopping the VMordeleting the VM accordingly.

If the preempted VM was stopped, it still appears in your project, but you arenot charged for the VM hours while it remains in aTERMINATED state. You canaccess 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-deleteare deleted when you delete Spot VMs.

If Compute Engine preempts Spot VMs less than oneminute 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 hadtime to complete a significant amount of work. However, the charges forpremium operating systems are still calculatedas normal.

Preemption selection

Preemption can happen when Spot VMs are in aRUNNING state; while in aTERMINATED state, Spot VMsare not considered for preemption.As a result, you can reset the preemption process bystoppingthenrestartingSpot VMs, sincestopping VMs leaves them in aTERMINATED state.You can stop and restart preempted Spot VMsas many times as you would like, as long as there is capacity.Notably,resetting or rebooting VMsinstead leaves VMs in aRUNNING state and, thus, don't reset the preemptionprocess.

You can't view why any given preemption event occurred. Similar toresource availability errors,preemption rates can vary in different zones, at different times, or withdifferent resources. For specific suggestions on reducing your preemption rate,see thebest practices.

Pricing

Spot prices, the prices for Spot VMs, provide significant discountsfor VMs. Spot prices give you discounts of up to 91% off of the default pricefor many machine types, GPUs, TPUs, and Local SSDs.

Important: Spot prices can change up to once every day. Spot prices don'tappear in most pricing tables for Compute Engine. For the latest prices,see theSpot VMs pricing page.

Notably, if a preempted VM was stopped, you are not charged for the VM hourswhile it remains in aTERMINATED state.You can access and recover data from any persistent disks that are attachedto the VM, but those disks still incur storage charges until you delete them.Learn more aboutinstance uptimeanddisk pricing.

To see the latest pricesfor Spot VMs, refer to theSpot VMs pricing page,use theCloud Billing Catalog API,orsign up for pricing announcements for Spot VMs.

Using Spot VMs with Compute Engine

This section provides notable information about using Spot VMs withother Compute Engine offerings. Learn about using Spot VMswith managed instance groups, premium operating systems, local SSDs, and GPUs.Additionally, understand how Spot VMs affect your quotas forCompute Engine resources.

Spot VMs in a managed instance group

You can create Spot VMs in amanaged instance groupusing thegcloud CLI, or theCompute Engine API. Specifythe options forcreating Spot VMsin aninstance template before you create orupdate the group.

Managed instance groups can create or add new Spot VMs onlywhen additional Compute Engine resources are available. If theseresources are limited, managed instance groups are unable to resize orautomatically scale the number of Spot VMs in the group.

Managed instance groups always attempt to maintain their target size or the sizespecified by theautoscaler for that group. IfCompute Engine stops one or more Spot VMs in a managedinstance group, the group repeatedly tries to recreate those VMs using thespecifiedinstance template. If thenecessary resources become available again, the group recreates the VMs andmaintains the target group size.

Premium operating systems on Spot VMs

Spot VMs don't reduce the cost ofpremium operating systems anddon't change the way that you're billed for the use of those operating systems.If Compute Engine stops Spot VMs that run a premiumoperating system, you are billed for that operating system as if you stoppedthe VMs yourself. The charges for minimum usage still apply, and bills forpremium operating systems are still calculated by rounding up to the nearestusage increment.

The machine types on Spot VMs that run premium operating systemsare always billed by the second, and follow the prices listed on theMachine type pricing page.

Local SSDs on Spot VMs

You can start Spot VMs withlocal SSDsand Compute Engine charges youspot pricesfor the local SSD usage. Local SSDs attached to Spot VMs worklike normal local SSDs, retain the samedata persistence characteristics,and remain attached for the life of the VM.

Compute Engine doesn't charge you for local SSDs if their VMsare preempted in the first minute after they start running.

For more information about local SSDs, seeAdding local SSDs.

GPUs on Spot VMs

You can add GPUs to your Spot VMsat lowerspot prices for the GPUs. GPUsattached to Spot VMs work like normal GPUs but persist only forthe life of the VM. Spot VMs with GPUs follow the samepreemption processas all Spot VMs.

Consider requesting dedicatedPreemptible GPU quota to use for GPUs onSpot VMs. For more information, seeQuotas for Spot VMs.

During maintenance events, Spot VMs with GPUs are preempted bydefault and cannot be automatically restarted. If you want to recreate yourVMs after they have been preempted, use amanaged instance group.Managed instance groups recreate your VM instances if the vCPU, memory, andGPU resources are available.

If you want a warning before your VMs are preempted, or want toconfigure your VMs to automatically restart after a maintenance event, usestandard VMs with a GPU. For standard VMs with GPUs,Compute Engine providesone hour advance noticebefore preemption.

Compute Engine does notcharge you for GPUs if their VMs are preempted in the firstminute after they start running.

To learn how to create Spot VMs with GPUs attached, readCreate a VM with attached GPUsandCreating Spot VMs.For example, seeCreate an A3 Ultra or A4 instance using Spot VMs.

Quotas for Spot VMs

Like other VMs, Spot VMs require availableCPU quotas. Additionally, if you planto use Spot VMs with local SSDs or with GPUs, Spot VMsalso requiredisk quota andGPU quota respectively.

If you use Spot VMs with these resources and have notrequested preemptible quota, Spot VMs consume yourstandard quota for these resources.If you plan to use Spot VMs, consider requestingpreemptible quota for those resources to prevent Spot VMs fromconsuming your other quotas.

After Compute Engine grants you preemptible quota in a region, allSpot VMs (and anypreemptible VMs)in that region count against that quota. All standard VMs inthat region continue to count against the standard quota. In regions where youdon't have preemptible quota, you can use standard quota to launch Spot VMs.

Note: Once you request preemptible quota in a region, you are limited to usingthat quota for Spot VMs in that region. You can't consumestandard quota in its place.

Preemptible quota is not visible in the gcloud CLI orGoogle Cloud console quota pages unless Compute Engine has grantedthe quota. For more information, seeAllocation quotas for preemptible resources.

What's next?

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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.