Skip to main content
A node template defines the configuration for a node: which image to boot and an optional cloud-init script. Templates are used by deployments to create nodes with a consistent configuration. Templates are immutable. To change a configuration, create a new template and update your deployment to reference it.

Create a node template

sf node-templates create \
  --name prod-worker \
  --image ubuntu-22.04.5-cuda-12.7 \
  --cloud-init ./startup.sh

Cloud-init

Pass a startup script or cloud-config YAML file via --cloud-init. The file is stored with the template and applied to every node created from it. Maximum size is 64 KB.
startup.sh
#!/bin/bash

mkdir -p /root/.ssh
cat >>/root/.ssh/authorized_keys <<"EOF"
ssh-ed25519 AAAA... you@example.com
EOF
sf node-templates create --name ssh-ready \
  --image ubuntu-22.04.5-cuda-12.7 --cloud-init ./startup.sh

List templates

sf node-templates list
NAME           IMAGE                      CLOUD-INIT  CREATED
prod-ubuntu    ubuntu-22.04.5-cuda-12.7   yes         Mar 23, 4:40pm
dev-debian     debian-12-cuda-12.7        -           Mar 26, 2:00pm
staging-base   ubuntu-22.04.5-cuda-12.7   yes         Mar 27, 2:00pm

Get template details

sf node-templates get prod-ubuntu
│ ID          ntmpl_Gw5rT8mKn2Pj4Lx9Qf7Y
│ NAME        prod-ubuntu
│ IMAGE       ubuntu-22.04.5-cuda-12.7 (image_TQiHEBzCA18ToAQqBtOr_)
│ CLOUD-INIT  yes
└ CREATED     Mar 23, 4:40pm UTC

Delete a template

sf node-templates delete prod-ubuntu
A template cannot be deleted while it is in use by a deployment or running node. Remove or update the referencing deployment first.

API reference

See the Node Templates API for programmatic access.