Skip to main content
POST
Create instance template

Authorizations

Authorization
string
header
required

Create an API token using sf tokens create or at https://sfcompute.com/dashboard/tokens.

Body

application/json
workspace
string
required

Workspace to create this template in.

Pattern: (wksp_[0-9a-zA-Z_-]{1,21})|(sfc:workspace:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){1,1})
Example:

"wksp_k3R-nX9vLm7Qp2Yw5Jd8F"

image
string
required

Machine image to use when starting instances with this template. Accepts name or ID.

Pattern: (image_[0-9a-zA-Z_-]{1,21}|vmi_[0-9a-zA-Z_-]{1,21})|(sfc:image:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
Example:

"image_k3R-nX9vLm7Qp2Yw5Jd8F"

name
null | string
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

enable_public_ipv4
boolean

Assign a public IPv4 address to instances started with this template.

firewall
null | string

Firewall to apply to instances started with this template. Accepts name or ID. Required when enable_public_ipv4 is true, and rejected when it is false.

Pattern: (frwl_[0-9a-zA-Z_-]{1,21})|(sfc:firewall:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
Example:

"frwl_k3R-nX9vLm7Qp2Yw5Jd8F"

infiniband_partition
null | string

InfiniBand partition for instances started with this template to join. Accepts an ibpart_ id or a resource path. When an instance is launched from this template, the partition must belong to the pool's workspace and sit on the selected SKU's InfiniBand fabric. GPU clusters and spot deployments don't accept templates with a partition. Available to accounts enrolled in the InfiniBand preview.

Pattern: (ibpart_[0-9a-zA-Z_-]{1,21})|(sfc:infiniband_partition:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
Example:

"ibpart_k3R-nX9vLm7Qp2Yw5Jd8F"

tags
null | object

Metadata tags to attach to this instance template. Instances launched from it don't inherit these tags.

Example:
cloud_init_user_data
string<byte>

Base64-encoded cloud-init user data. Maximum 64KB. Instances created by a generic or spot deployment inherit this data from the referenced template, so bootstrap steps such as worker registration can be configured here.

Example:

"IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="

Response

Instance template created.

id
required

Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.

Pattern: itmpl_[0-9a-zA-Z_-]{1,21}
Example:

"itmpl_k3R-nX9vLm7Qp2Yw5Jd8F"

resource_path
string
required

A resource path for a instance_template resource. Format: sfc:instance_template:::.

Pattern: sfc:instance_template:([a-zA-Z0-9._-]+:){2}[a-zA-Z0-9._-]+
Example:

"sfc:instance_template:<account_id>:<workspace>:<name>"

owner
string
required
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

workspace
string
required
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

workspace_id
string
required
Pattern: wksp_[0-9a-zA-Z_-]{1,21}
Example:

"wksp_k3R-nX9vLm7Qp2Yw5Jd8F"

name
string
required
Required string length: 1 - 255
Pattern: [a-zA-Z0-9][a-zA-Z0-9._-]{0,254}
Example:

"my-resource-name"

object
string
default:instance_template
required
read-only
Allowed value: "instance_template"
image
object
required

Machine image to use when starting instances with this template.

enable_public_ipv4
boolean
required

Whether instances started with this template get a public IPv4 address.

cloud_init_user_data_used
boolean
required

Whether cloud-init user data is configured for this template.

created_at
integer<int64>
required

Unix timestamp.

Example:

1738972800

firewall
null | string

Firewall applied to instances started with this template. Present exactly when enable_public_ipv4 is true.

Pattern: frwl_[0-9a-zA-Z_-]{1,21}
Example:

"frwl_k3R-nX9vLm7Qp2Yw5Jd8F"

subnet
null | string

Subnet instances started with this template are placed in, if any. Instances without a subnet use an ephemeral subnet (isolated, no east-west traffic with other VMs).

Pattern: snet_[0-9a-zA-Z_-]{1,21}
Example:

"snet_k3R-nX9vLm7Qp2Yw5Jd8F"

infiniband_partition
null | string

InfiniBand partition instances started with this template join, if any.

Pattern: ibpart_[0-9a-zA-Z_-]{1,21}
Example:

"ibpart_k3R-nX9vLm7Qp2Yw5Jd8F"

tags
null | object

Metadata tags attached to this instance template. Instances launched from it don't inherit these tags.

Example:
cloud_init_user_data
string<byte>

Base64-encoded cloud-init user data.

Example:

"IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="