Skip to main content
An instance is a GPU-backed virtual machine. You create an instance, attach it to a pool, choose an image, and attach a cloud-init script (required for SF Compute public images, optional for custom images). The instance waits for compute time (from orders) before starting.

Create an instance

Create an instance on a pool with an image and a startup script.
All flags are optional in interactive mode. Omit them to use pickers for the pool, image, and SKU. Non-interactive runs (--no-input) must pass --pool, --image, and --sku (with a sku_… ID from sf skus list), plus --cloud-init when the image is an SF Compute public image.

Instance lifecycle

The API and CLI report the status as a snake_case value. The console shows the same status under a friendlier label. An instance in awaiting_allocation starts running when the pool’s allocation schedule covers the current time. For example, if you buy compute time starting at now, the instance starts within about a minute. If the order starts in the future, the instance waits until then. The image download and boot process takes up to 10 minutes before SSH is available.

Why is my instance pending?

An instance stays awaiting_allocation (Pending in the console) until a node is assigned to it. A node is only assigned when the pool has allocation for the instance’s SKU at the current time. Check these in order:
  1. The pool has no allocation. Creating an instance does not buy compute; you also need a filled buy order on the pool. Run sf pools get <pool> and check the TOTAL SCHEDULE line, or open the pool in the console. If the schedule is empty, place a buy order on the pool.
  2. The allocation starts in the future. If the schedule’s first segment starts later than now, the instance waits until then.
  3. The allocation is for a different SKU. An instance only runs on nodes of its own SKU. Run sf pools get <pool> --verbose to see the schedule per SKU and compare it with the instance’s SKU from sf instances get <instance>. See Mixed hardware.
  4. The pool has fewer nodes than instances. Allocation covers a node count. If you created more instances than the pool has nodes right now, the extra ones wait. Terminate an instance or buy more nodes.
  5. The buy order hasn’t filled yet. Orders add to the schedule only once they fill. Check the order status.
If the pool has allocation for the right SKU right now and the instance stays pending for more than a few minutes, contact support@sfcompute.com with the instance ID. The console also shows Pending in the Public IP column of a running or pending instance that was created with a public IPv4 address but hasn’t been assigned one yet. That’s a separate field from the instance status. See IP addresses. This table is the complete set of statuses today; the API may add new ones later, so don’t assume it’s exhaustive. There’s no separate status for an instance queued for preemption. A spot deployment marks an affected instance internally, but it keeps reporting running until the platform stops it and its status becomes terminated. terminated is one-way; an instance never returns to running. Terminated instances remain in sf instances list and GET /preview/v2/instances until you delete them. The CLI’s default view buckets recent terminated instances into their own section; pass --status terminated to list all of them. The platform stops an instance with no in-band push signal to the guest OS. There’s no ACPI (Advanced Configuration and Power Interface) shutdown notice before it powers off the VM (current behavior, not a guarantee). Spot-managed instances can poll ahead using the in-instance metadata endpoint described in Preemption. For everything else, build in a margin before your pool’s allocation ends instead of waiting for a signal. See Allocation schedule.

Images

List available images to find one to use with your instance.
Pass the image name (as shown by sf images list) or ID when creating an instance. Public images require the full sfc:image:sfcompute:public:... name; SF Compute rejects the short trailing segment on its own.
To build and upload your own custom image, see Custom Images.

Cloud-init

Pass a startup script or cloud-config YAML via --cloud-init to configure the VM on first boot. SSH access depends on this. SF Compute public images ship with no default password or key, and sf instances create does not add your local key, so the CLI requires --cloud-init for them: a non-interactive run fails without it, and the interactive prompt offers to create a script, pick a recent one, or provide a path. A custom image may omit it if it already includes your key. Either way, you need a cloud-init script or cloud-config that adds your public key to authorized_keys before you can connect. A shell script can inject your SSH public keys. Key files that don’t exist are skipped.
Cloud-config YAML sets up users and keys declaratively.
startup.yaml
Pass the file when creating the instance.

Check instance status

List your instances and their statuses.
Filter by time range.
--created-after and --created-before accept a datetime, Unix timestamp, or a duration like 24h or 7d. A duration counts back from now, so 24h means 24 hours ago. You can also use --since and --until as aliases. Get details on a specific instance.

SSH into an instance

Connect to a running instance over SSH.
The instance must be in running status and the image must be fully booted. This typically takes less than 5 minutes after the instance starts, but can take up to 10.
Permission denied (publickey) means the instance has no matching key: either its cloud-init never added one (see Cloud-init), or you’re connecting as the wrong user. sf instances ssh defaults to your local username, not root, mirroring ssh(1) and any User directive in ~/.ssh/config. If your cloud-init added the key to the root user, as in the examples above, connect with sf instances ssh gpu-worker --login root. Pin a specific local key with sf instances ssh gpu-worker -i ~/.ssh/<key>.

View logs

View an instance’s logs.
Show more lines.
Filter by time range.
--after and --before accept flexible time expressions: "now", "in -1h", a date like mar 1, ISO 8601, or a Unix timestamp.

Terminate an instance

Stop the VM immediately. The instance moves to terminated status.

Replace an instance

Replace an instance with a new one on the same pool and SKU. Replacing terminates the original and creates a fresh instance with a new image and startup script (and optionally a new name).
The replacement inherits the original’s pool, SKU, subnet, public IPv4 setting, firewall, tags, and priority.
Replacing does not carry cloud-init over from the original instance. When the new image is an SF Compute public image, --cloud-init is required. For a custom image, omitting it starts the replacement with no startup script, so SSH only works if the image already includes your key.
Replace with a specific name.
Instances have no persistent storage. Replacing an instance deletes all data on the original.

Delete an instance

Permanently delete an instance. The instance must be terminated first.

Instance priority

When a pool’s quota drops below the number of running instances, the system terminates instances to match. Instance priority controls which ones survive. The system keeps higher-priority instances longer and terminates lower-priority ones first. Among instances of equal priority, it terminates the newest first. Priority has 4 levels, ordered yield < normal < preferred < critical. Every instance defaults to normal. Set priority on an existing instance.
Set priority at create time.
You can also set priority through the API. Pass priority_level in the body of POST /preview/v2/instances to set it at create time.
Omit priority_level to default to normal. Update one instance with PATCH /preview/v2/instances/{id}.
Omit priority_level to leave it unchanged. Pass "normal" to reset to the default. Update many instances atomically by PATCHing the collection.
Batch updates follow these rules.
  • A single call can include up to 10,000 entries.
  • All instances in a batch must belong to the same workspace.
  • The API rejects the whole request with a 422 if any entry has an unknown id or belongs to another organization.
  • A batch spanning more than one workspace is also rejected with a 422.
  • The entire request rolls back, so no instance is modified.
  • An empty data returns 200 with no writes.
  • When the same id appears more than once, the last occurrence wins.
The response includes the updated instance for each entry, so you can confirm the result in one round-trip. Setting priority requires the Instance: Write permission. Read-only tokens see priority_level on GET responses but receive 403 on writes.

Limitations

  • No persistent storage. If the underlying physical host dies, you get a replacement but not the same disk.
  • Public IPv4 is available only on SKUs that support it, and only when enabled at create time. See IP addresses.
  • No InfiniBand.
  • Instances don’t share a VPC or VLAN. Configure a VPN if you need connectivity between instances.
  • Boot time can be up to 10 minutes for image download and startup.
  • No GPU monitoring. GPUs may occasionally become undetectable (fall off the PCIe bus). Terminate and recreate the instance, or email support@sfcompute.com.

API reference

See the Instances API for programmatic access.