Skip to main content
The “Sandbox Clone” feature allows you to duplicate a running or paused sandbox instance. The cloned sandbox maintains the same file system and memory state as the original sandbox.
If you clone a running sandbox, the sandbox being cloned will be briefly suspended. During this period, the sandbox instance will be unavailable, and the suspension time is close to the time required to pause a sandbox.
Parameter Description:
  • count: Specifies how many sandbox instances to clone. The minimum value is 1, and the maximum is determined by the concurrent running sandbox instance limit (see Quota Limit).
  • strict: Specifies whether to strictly clone according to the number specified in the count parameter. The default value is false. When set to true, if the number of successfully cloned instances is less than count, a clone failure error will be returned, and other successfully created sandboxes will also be cleaned up. When set to false, the actual number of successfully cloned sandbox instances will be returned.
  • timeout(timeoutMs): Specifies the timeout for cloning sandbox instances. If this parameter is not specified, when the parent sandbox is running, it inherits the parent sandbox’s timeout configuration; but when the parent sandbox is in a paused state, the default value of 5min is used.
import { Sandbox } from 'novita-sandbox';

const sandbox = await Sandbox.create();
console.log('Sandbox created', sandbox.sandboxId)

const sbxClones = await Sandbox.clone(sandbox.sandboxId, 
    {
        count: 2,
        strict: false,
        timeoutMs: 100_000
    }
);
console.log('Sandbox clones created', sbxClones.map(sbxClone => sbxClone.sandboxId))

await sandbox.kill()
for (const sbxClone of sbxClones) {
    await sbxClone.kill()
}
Additionally, you can also use the Novita Sandbox CLI to clone a specified sandbox instance:
Bash
# novita-sandbox-cli sandbox clone [sandboxID] -c [count] -s [strict] -t [timeout]
novita-sandbox-cli sandbox clone 0r0efkbfwzfp9p7qpc1c -c 2