Skip to main content
A delete-after timer permanently deletes a machine at a set time. Use it as a safety net for throwaway machines (forks for a task, demo machines, agent sandboxes), so a machine nobody remembered stops billing. boxd enforces the timer, not the machine. It fires whatever state the machine is in: running, on standby or hibernated, or stopped. A sleeping machine’s own clock is frozen, so a timer inside it would never fire.
Deletion is permanent. The machine’s disk goes with it, as with boxd machine remove. Snapshots you saved from it are kept.

Set a timer

Give a duration, from now:
Or a cron expression: the machine is deleted the next time it matches, in UTC. Anything with a space, or an @ nickname like @daily, is read as a cron expression:
A cron timer fires once, at the next match. The machine is gone afterwards, so there is no second match to wait for. In the console, it’s the Delete after setting on the machine’s Settings tab: pick a preset, or Custom for a cron expression. From inside a machine, the in-machine boxd takes the same command and defaults to the machine it runs on: boxd machine config set delete-after 2h, or --vm <name> for another of your machines.

Extend or clear it

Setting the timer again replaces it. That lets a script keep pushing its own deadline back while it is still working (see Leases below).

See the time left

The SDKs return the deadline as machine.delete_at (Python) / machine.deleteAt (TypeScript), None/null when there’s no timer, and the cron expression it was set with as delete_after_cron / deleteAfterCron. The console shows Deletes in … on the machine and in the machine list.

Forks

A fork starts with its own copy of its parent’s timer, counted from the moment of the fork: a parent set to delete after 2 hours gives every fork a fresh 2 hours, however long the parent has left. A cron timer carries over as the expression and fires at its next match after the fork. Pass --delete-after on the fork to give it a different timer, or --delete-after 0 for none. A machine restored from a snapshot starts without a timer.

Leases

For a job whose length you can’t predict, keep the timer short and have the job extend it while it is alive. If the job dies, or the machine stops responding, the extensions stop and the timer deletes the machine:
If auto-suspend is on for the machine (it is off by default, but you may have set it, and a fork inherits its source’s), a job with no network traffic puts the machine into standby, which freezes the job and the loop with it. The timer still deletes the machine on time, but the job won’t finish. For batch jobs, pass --auto-suspend-timeout 0 to be sure.

Delete when the task is done

A timer deletes at a time, not when work finishes. To delete a machine as soon as its task completes, have it delete itself as the last step of the job, and keep a delete-after timer as the safety net for a job that hangs or crashes.