Checkpoints
A checkpoint captures the full state of an instance—its memory and volume state—at any moment, so you can later start new instances that resume from exactly that state. Unlike a branch, which creates a single independent copy right away, a checkpoint is a reusable, named restore point that you can load as many times as you like.
You can take a checkpoint of a running instance without stopping it, keep a history of successive checkpoints, and create new instances from any checkpoint later on.
How it works
Checkpointing builds on the same machinery as branching. When you create a checkpoint, Unikraft Cloud:
- Branches the source instance using copy-on-write (CoW) asynchronous snapshotting. Because the snapshot is copy-on-write and taken asynchronously, the source instance only pauses for a few milliseconds before it resumes running.
- Converts the resulting branch into an instance template and marks it as a checkpoint.
This means checkpoints reuse the entire template lifecycle—storage, cloning, autokill, tags, and delete locks—but with their own dedicated endpoints.
A freshly created checkpoint starts in the starting state while the platform is still building its snapshot.
Once the snapshot completes and the checkpoint becomes ready, it transitions to the checkpoint state.
You can only load a checkpoint once it reaches the checkpoint state.
Creating a checkpoint
To create a checkpoint, pass the source instance to unikraft instance checkpoint create:
Code
The CLI doesn't name the checkpoint, so the platform derives a name from the source instance's name plus a random suffix.
Checkpoint creation is asynchronous, so the new checkpoint reports starting until its snapshot completes.
Either wait for it afterward, or have the create call wait for you:
Code
To choose the name yourself, call POST /instances/checkpoints directly—the CLI doesn't cover it:
Code
To take checkpoints on a recurring schedule rather than on demand, give the instance a checkpoint scheduled operation.
Checkpoint history
Every instance keeps an ordered history of its checkpoints, spanning the full lineage rather than only the checkpoints taken directly from that instance. When you create an instance from a checkpoint and then take further checkpoints from that instance, its history includes the new checkpoints and the ones inherited from the parent checkpoint.
For example, given this sequence:
- Create
inst1. - Create
chk1frominst1. - Create
inst2fromchk1. - Create
chk2frominst2.
The history of inst2 lists both chk2 (taken directly from inst2) and chk1 (inherited from the checkpoint inst2 was loaded from).
To query this history, run unikraft instance history:
Code
Code
The checkpoints themselves also carry this history of their lineage.
You can query it directly with unikraft instance checkpoint history, which returns the same shape:
Code
Checkpoint information
To retrieve detailed information about a checkpoint, including its instance configuration, and volumes, query it by name or UUID:
Code
List all available checkpoints by omitting the identifier:
Code
Code
Loading a checkpoint
You load a checkpoint by creating a new instance from it.
Pass the checkpoint to --checkpoint:
Code
Use unikraft run --checkpoint instead to load the checkpoint and follow the new instance's logs in one step.
The new instance inherits the image, vCPUs, memory, arguments, environment, and saved memory and volume state from the checkpoint.
As with branching and instance templates, you can configure the remaining properties—the instance name, volumes, ROMs, and services.
The checkpoint must be ready (in the checkpoint state) before you can load it.
Loading a checkpoint that's still in the starting state fails (see Error handling).
Autokill
Like instance templates, checkpoints persist on the machine once created, holding onto the storage their snapshot occupies. A checkpoint can carry an autokill policy that removes it automatically when nothing loads it for a configured time, measured from the last load.
Set the policy with --autokill when you create the checkpoint:
Code
You can also set or update the policy on an existing checkpoint:
Code
This example removes the checkpoint after 1 hour without a load.
unikraft instance checkpoint get reports the policy as autokill.time.
Editing a checkpoint
Use unikraft instance checkpoint edit to update a checkpoint's tags, delete lock, and autokill policy:
Code
Deleting a checkpoint
Delete a checkpoint by name or UUID:
Code
If a checkpoint has a delete lock set, the delete request fails until you remove the lock:
Code
Deleting the instance that owns a set of checkpoints doesn't remove the checkpoints. They remain available to load until you delete them explicitly or their autokill policy removes them.
Error handling
The CLI rejects a checkpoint in a different metro from the new instance before it sends anything, with cannot create instance: metro mismatch between checkpoint ("fra") and instance ("dal2").
Otherwise, a checkpoint request can fail for the following reasons:
| Error message | Cause |
|---|---|
Insufficient license. Please make sure your license is valid and includes checkpointing | Your account's license doesn't include the checkpointing feature. |
A checkpoint with the name '<name>' already exists | A checkpoint with the requested name already exists. Choose a different name. |
Failed to create instance from checkpoint: ... | The referenced checkpoint isn't ready yet. Wait until it reaches the checkpoint state before loading it. |
Deletion protection enabled | The checkpoint has a delete lock set. Remove the lock before deleting. |
Failed to allocate checkpoint: ... | The platform couldn't create the checkpoint (for example, it hit a quota limit). |
Limitations
- A checkpoint and the instances you load from it must stay in the same metro. The CLI catches a cross-metro checkpoint before it sends the request.
- Checkpointing needs the default
microinstance type. QEMU-backed full VMs (type: full), which GPU instances require, don't support checkpointing, and a create request can't combinetypewith a checkpoint source. - Checkpointing builds on branching, so it only works with block-based volumes (for example,
ext4). The checkpoint clones the source's volume state consistently with its memory snapshot, which isn't supported for other volume types. - On BYOC and on-prem installations, checkpointing requires a license that includes the feature.
Learn more
- Branching: create a single independent copy of a running instance—the mechanism checkpoints build on.
- Instance templates: how templates work, the lifecycle checkpoints reuse.
- Autokill: automatically removing checkpoints and templates the platform hasn't loaded recently.
- Snapshots: the copy-on-write snapshotting that underpins checkpoints.
- Serverless databases: a use case that checkpoints a running PostgreSQL instance to capture and restore its state.
- Cron jobs / scheduled wake-ups: the
checkpointaction periodically creates restore points for an instance. - Unikraft Cloud's REST API reference, in particular the section on instances.