---
description: Pay as you go for preemptible instances.
---

# Spot bids

Spot instances are preemptible instances from Foundry's unreserved capacity, allocated through a blind second-price auction.

You can often leverage spot compute to:

* Decrease the cost of workloads that can tolerate delays or preemptions, such as batch jobs.
* Horizontally scale capacity for less predictable workloads like live inference.
* Run short, critical workloads when reserved capacity is unavailable.

{% hint style="info" %}
Unlike traditional clouds, Foundry always maintains a pool of dedicated spot capacity in each region. This ensures you always have the ability to provision some amount of spot compute on short notice; however, Foundry always recommends making reservations for critical workloads whenever possible to maximize your price predictability and avoid the risk of preemption.
{% endhint %}

## Creating a spot bid

You can request spot instances by creating a **spot bid** specifying an instance type, a region, a required quantity of instances, and a per-instance **limit price**.&#x20;

After submitting your bid, it becomes an **open bid**. The spot auction evaluates all open bids every 2 minutes to determine allocation. Your bid will remain open until it is successful or you terminate it.

Whenever the current **spot price** for your requested instances is lower than your limit price and enough capacity is available, your bid is <mark style="color:green;">`Allocated`</mark>, and your requested instances are provisioned. While your instances are provisioned, you are billed at the current spot price (which will be less than or equal to your limit price). Your instances remain provisioned until you cancel your bid or the spot price exceeds your limit price.&#x20;

For additional details on how spot prices are set, read [spot-auction-mechanics](spot-bids/spot-auction-mechanics "mention").

{% hint style="warning" %}
Once you submit a spot bid, the limit price can be altered as well as pausing & resuming. To change parts of your bid, such as the SSH keys or storage, you must cancel your bid and submit a new one.
{% endhint %}

## Accessing running spot instances

Connection details for your running spot instances can be found on the **Instances** tab.&#x20;

{% hint style="warning" %}
SSH keys cannot be added after submitting a bid. Only the SSH keys selected when creating your bid can be used to access your instances.
{% endhint %}

## Preemption

Preemption occurs when the spot price for your requested instances exceeds the limit price you set in your bid. When your bid is preempted, you will receive a 5-minute notice, and the status of your bid and its associated instances will change to <mark style="color:orange;">`Preempting`</mark>. After 5 minutes, your instances will be shut down, and the status of your bid will revert to `Open bid`. Your bid will automatically be allocated again when the market adjusts such that your bid is successful. To prevent your bid from being

When your bid is preempted, your instances are shut down, but the boot disks for your instances are preserved until you terminate your bid. This allows you to implement logic to automatically restart your workload should your bid be allocated again in the future. [This guide](../startup-scripts#running-scripts-on-startup-after-reallocation-or-preemption) provides an overview of implementing a `systemd` service to run scripts on subsequent startups after preemption or relocation.

## Pausing & resuming spot bids

In some cases, you may want to pause your workload but do not want to lose your environment & setup on the boot disk. For these situations, you can pause your spot bid using the **•••** menu and selecting "Pause Bid." Your instances associated with the bid will spin-down, preserving the boot disk, and billing will stop. When you want to resume workloads, use the **•••** menu to "Resume Bid" to begin spinning up associated instances if they can be allocated in the spot market.&#x20;

Upon resuming a spot bid, your instances will retain the previous boot disk and have the same configuration of storage disks and SSH keys. If resuming your spot bids causes you to exceed your quota, the action will not be able to complete.

Pausing spot bids allows you to setup your environment once and save both time and money when you need to resume those workloads.&#x20;

## FAQs & troubleshooting

To learn the nuances of the Foundry spot auction, read [spot-auction-mechanics](spot-bids/spot-auction-mechanics "mention").

<details>

<summary>How do I know what limit price to set so that my bid is allocated immediately?</summary>

The **Price Chart** page displays the most recent spot prices for all instance types. These spot prices are determined by the highest _losing_ spot bid, meaning that you may need to bid well above this price for your bid to be instantly successful.&#x20;

In the case that you need to provision compute immediately and reserved compute is unavailable, Foundry recommends setting the limit price for your bid at your next best alternative for on-demand compute (this could be the AWS or GCP on-demand price, for example). This ensures that your bid will be allocated unless the spot price exceeds these alternatives for on-demand compute (which has never occured).

Foundry never displays the lowest winning price to ensure a fair auction and to encourage setting truthful limit prices.

</details>

<details>

<summary>Does Foundry always have spot capacity available?</summary>

Yes. Unlike traditional clouds, Foundry always maintains dedicated spot capacity in every region. This ensures that you can always spin up some amount of spot compute on short notice.

</details>

<details>

<summary>My limit price is higher than the current spot price for the instance type I requested, but my bid still isn't allocated.</summary>

This typically occurs when your bid requests multiple instances, and after allocating all bids with higher limit prices, fewer instances remain than the quantity your bid is requesting.&#x20;

For example, if after allocating all bids with a higher limit price, three instances remain, and your bid requests four instances, Foundry will be unable to allocate your bid and will move to allocate the next-highest bid requesting three instances or fewer. In this scenario, the spot price would be set below your bid's limit price, but your bid would not be allocated.

</details>

