Replace instance
Replace an instance with a fresh one on the same capacity, running a new image. Subnet, firewall, public IPv4 setting, tags, and priority carry over.
Authorizations
Create an API token using sf tokens create or at https://sfcompute.com/dashboard/tokens.
Headers
Path Parameters
A resource path like 'sfc:instance:acme:prod:my-instance' or an ID. Resource paths are human-readable but not stable - they change when resources are renamed or moved. IDs are stable and permanent.
(inst_[0-9a-zA-Z_-]{1,21})|(sfc:instance:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})"inst_k3R-nX9vLm7Qp2Yw5Jd8F"
Body
Request body for POST /v2/instances/{id}/replace.
Base64-encoded cloud-init user data. Maximum 64KB. If omitted, the replacement starts with no startup script. SF Compute public images ship with no password or SSH key, so a replacement from one without cloud-init cannot be accessed; a custom image is reachable only if it already includes your key.
"IyEvYmluL2Jhc2gKZWNobyBoZWxsbyB3b3JsZAo="
Optional name for the replacement. A name is generated if omitted. Must differ from the replaced instance's name, which stays reserved while that instance lingers in the terminated state.
1 - 255[a-zA-Z0-9][a-zA-Z0-9._-]{0,254}"my-resource-name"
Response
Replacement instance created.
Identity block flattened into [InstanceResponse]. Response-only: handlers build it from the resolver's [crate::types::resource_path::InstanceScope] at the response boundary.
awaiting_allocation when waiting for compute allocation on its capacity, running once assigned and the physical machine is running (still takes time for the image to be downloaded and booted), terminated when stopped by the user or after running out of allocation, failed on hardware fault.
Values are not exhaustive across API versions. Clients should tolerate new statuses.
awaiting_allocation, running, terminated, failed