Export and import
An export writes a parked sandbox or a snapshot as one archive: its disk, and its memory image when it has one. The archive is a file on the workspace that you download, or an object the workspace uploads to an S3 bucket of yours. An import creates a new sandbox from such an archive, in the same workspace or in another one. Use it as a backup that survives the loss of the workspace, and to move sandboxes between workspaces.
The console's Lineages page exports, downloads and imports the same way.
An archive holds the sandbox's disk and memory as they are, including whatever the sandbox wrote, like source code, tokens in files, and the memory of its processes. Anyone who can read the file or the bucket can read them. Keep downloaded archives and the bucket private.
Export a sandbox or a snapshot
- The sandbox must be
PARKED. To export a running sandbox, take a snapshot and export the snapshot, or park it first. A running sandbox, and a snapshot of a removed sandbox, answerinvalidSandboxStatus. While another operation runs on the sandbox, the export answersoperationInFlight. - With a memory image, the export carries it unless you pass
--no-memory. A sandbox parked without memory, and a disk-only snapshot, export their disk only. - A sandbox that ever received secrets can't be exported, neither its disk nor its snapshots, and neither can a snapshot taken while a sandbox held secrets, because a delivered secret can sit in the disk or the memory. The request fails with
secretBearing. A snapshot shows it in its ownsecretBearingfield. - An export is an operation and may take up to an hour. The archive holds the sandbox as it was when you asked, so you can wake the sandbox while its export runs.
Without the bucket flags, the archive is a file export: a file on the workspace disk, kept for 24 hours after the export finished and then deleted with its export. It goes earlier when the retention deletes the sandbox it came from. A file export is refused with workspaceFull when it would leave less than 1 GiB free on the workspace disk (when the workspace is full). zbox export download writes the archive to <sandbox-id>-<export-id>.tar.zst in the current directory unless -o names another file, and -o - writes it to stdout. A download of a bucket export, or of an export that hasn't finished, fails with exportHasNoFile.
An export's status is RUNNING, FINISHED or FAILED, with the error when it failed. A restart of the workspace fails the exports that are running. A finished export also records an EXPORTED event on the sandbox. The export's operation doesn't name the sandbox, so zbox operation list --sandbox doesn't show it; use zbox export list instead. zbox export remove deletes the export and its file, and refuses a running export with exportRunning. An object in a bucket is never deleted by the workspace. An export ID the workspace doesn't know answers exportNotFound.