CreateInstance, because a retry creates a second machine.
experimental.uniqueTag solves that: the platform claims the tag for the instance, and a later request carrying the same tag returns the running instance instead of creating another one.
Pairing the tag with a CACHE volume gives the replacement instance a warm cache when the previous one is gone, so a restart does not start from scratch.
uniqueTag lives under experimental. Fields there can change or be removed at any time.Claim a unique tag at creation
Repeating this request with the same tag is safe. The response describes the existing instance if one is already running under the tag.
Mount a cache volume under a tag
A volume with
persistencyKind: CACHE is restored on a best-effort basis from the most recent volume carrying the same tag.
The container below writes an index file on first boot only, so a restart that restores the cache keeps the original file.Read the allocated endpoint
The create response lists each container with the endpoint allocated for every exported port. A reused instance returns the endpoint it already has.HTTP endpoints require Namespace authentication by default. See access controls.
Source
go/ensurewithcache in github.com/namespacelabs/examples.
The TypeScript version above follows the same request fields; only the Go example ships in the repository.
See cache volumes for how volume tags and reuse work, and instance configuration for the rest of CreateInstanceRequest.