> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sfcompute.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Instances and Pools

> How instances and pools separate what you run from the compute time it runs on

You run workloads on instances and pay for the compute time they use from pools.

## Instances

An [instance](https://docs.sfcompute.com/preview/instances.md) is a GPU virtual machine booted from an [image](https://docs.sfcompute.com/preview/images.md).
Like instances on other clouds, it has hardware, an image, startup configuration, logs, SSH access,
and lifecycle state. You create it, connect to it, run your workload, and terminate it when you are
done.

The only difference is that an SF Compute instance consumes compute time when it runs. It won't
start until it has compute time allocated to it. That compute time comes from a pool.

## Pools

A [pool](https://docs.sfcompute.com/preview/pools.md) is a named container that holds an allocation of compute time. It
represents that allocation as a schedule. The schedule tracks how many nodes you own, on which
hardware, and for which windows of time. Each node runs 1 instance.

For example, a pool might have this schedule.

| Hardware | Window | Allocation |
| - | - | - |
| H100, EU North, InfiniBand, … | Mar 20, 09:00 → Mar 20, 17:00 | 4 nodes |
| H100, EU North, InfiniBand, … | Mar 20, 17:00 → Mar 21, 00:00 | 8 nodes |
| H200, US East, No RDMA, … | Mar 21, 09:00 → Mar 21, 17:00 | 2 nodes |

The pool's schedule changes as you buy, sell, or transfer compute time, or as it expires.

## SKUs

Each pool tracks a separate schedule for each stock-keeping unit (SKU). A
[SKU](https://docs.sfcompute.com/preview/instance-skus.md) represents a specific set of interchangeable hardware,
including the following.

* Accelerator type, such as H100 or H200
* Instance specs like number of CPUs, RAM, and local storage
* RDMA type, such as InfiniBand or RoCE
* Zone or location
* Other operator-defined hardware properties

You pin orders, transfers, and instances to a SKU. That tells SF Compute which hardware
the allocation comes from.

## Starting an instance

When you create an instance, you attach it to a pool. The instance starts in `awaiting_allocation`
if the pool does not currently have matching allocation for the hardware it will run on.

To add compute time, place a buy [order](https://docs.sfcompute.com/preview/orders.md) on the pool. When the order fills, it adds
compute time to the pool's allocation schedule for the order's SKU. Once the schedule
covers the current time and there is enough matching allocation, the instance starts booting.

```bash theme={null}
sf pools create --name dev

sf instances create \
  --pool dev \
  --image sfc:image:sfcompute:public:ubuntu-24.04-cuda-13.2 \
  --cloud-init ./startup.sh \
  --sku sku_4UpxzQw7A8N

# --max-rate is the most you'll pay, in dollars per node-hour.
sf orders create \
  --side buy \
  --pool dev \
  --count 1 \
  --start now \
  --duration 2h \
  --max-rate 20.00 \
  --sku sku_4UpxzQw7A8N
```

You can create the instance before the order fills. It waits until matching allocation exists.

Instances define what should run. Pools define when there is compute time available to run it.

## Instance lifecycle

A pool's allocation determines whether attached instances can run.

| Pool state | Instance behavior |
| - | - |
| No matching allocation | Instance waits in `awaiting_allocation` |
| Allocation becomes available | Waiting instances start booting |
| Allocation covers the running instance | Instance stays `running` |
| Allocation shrinks below demand | SF Compute terminates instances until demand fits allocation |

Terminating an instance does not free its allocation. The allocation remains in the pool's
schedule until you sell it, transfer it, or let it expire.

When allocation grows, waiting instances can start.

When allocation shrinks below the number of running instances, SF Compute terminates instances until
the running count fits the pool schedule. It terminates lower-priority instances first. Among
instances with the same priority, it terminates the newest first. If you need control over which
work survives a planned shrink, set [instance priority](https://docs.sfcompute.com/preview/instances.md) before selling,
transferring, or letting allocation expire.

Compute allocation stays separate from what you run. You can buy compute time before you launch
instances and recreate instances without losing reserved time. You can also sell unused time without
deleting the pool and move allocation between workloads.

Think of it like a power grid. Pools are the circuits.

Orders add compute time to those circuits. Transfers move it between circuits. Instances draw it
from the pool they are attached to.

If a circuit has enough scheduled compute time, the attached instances can run. If it does not, they
wait or terminate.

## One pool or many

You can attach multiple instances to a single pool, or create a separate pool for each instance or
workload.

Use a separate pool when you want to manage the instance independently.

* A personal dev box should usually have its own pool.
* A one-off debugging instance should usually have its own pool.
* A customer-isolated workload should use its own pool if selling or expiration should not affect
  other customers.

Use one shared pool when the instances are part of the same fleet and can share allocation
decisions.

* An inference fleet should usually use one pool.
* Batch workers for the same queue can usually share one pool.
* A training job with many identical workers can usually share one pool.

As a rule of thumb, put instances in the same pool only when you can scale, interrupt, extend,
sell, or transfer them together.

## Transfers

You can transfer compute time between pools. This lets you manage allocation like any other
resource. Assign it to projects, teams, or workloads, then move it when it is not being used.

For example, a platform team might buy a large block of H100 time into a shared pool. It can then
transfer pieces of that allocation to separate pools for `training`, `inference`, and `experiments`.
If `experiments` does not need its allocation, the team can transfer it back or move it to another
project.

Transfers affect the same schedule that orders affect. If compute time leaves a pool, attached
instances may terminate if the remaining allocation no longer covers them. If compute time arrives,
waiting instances can start.

## Next steps

* [Orders](https://docs.sfcompute.com/preview/orders.md) covers buying and selling compute time.
* [Pools](https://docs.sfcompute.com/preview/pools.md) is the command reference for pool operations, including transfers.
* [Instances](https://docs.sfcompute.com/preview/instances.md) is the command reference for instance lifecycle operations.
