Hi everyone,
I’d like to ask what the recommended approach is for creating daily backups of a Motoko backend canister.
[https://raw.githubusercontent.com/dfinity/portal/master/docs/references/_attachments/ic.did]
Canister snapshots (backup and restore)
One of the major additions in late-2025 / early-2026 is support for canister snapshots, which allow canister controllers to take a snapshot of a stopped canister, download it, upload it elsewhere, and restore it to the same or another canister.
The management canister (aaaaa-aa) exposes the following snapshot-related methods:
| Function | Purpose |
|---|---|
take_canister_snapshot |
Takes a snapshot of a stopped canister. Can optionally replace an existing snapshot and/or uninstall the canister’s code atomically. Returns a snapshot record (ID, timestamp, total size). |
list_canister_snapshots |
Lists all snapshots for a canister, including snapshot IDs, timestamps, and sizes. |
delete_canister_snapshot |
Deletes a snapshot by snapshot ID, freeing the associated storage. |
load_canister_snapshot |
Loads (restores) a snapshot onto a canister, replacing its current code and state. Since Dec 2025, snapshots can also be loaded onto a different canister for migration or cloning. |
read_canister_snapshot_metadata |
Reads structured metadata for a snapshot, including timestamp, memory sizes, globals, certified data, timers, and canister version. |
read_canister_snapshot_data |
Reads snapshot contents in chunks (Wasm module, Wasm memory, stable memory, or Wasm chunk store), enabling snapshot download. |
upload_canister_snapshot_metadata |
Uploads snapshot metadata to create a new snapshot record from external storage. |
upload_canister_snapshot_data |
Uploads snapshot data chunks (Wasm, memory, stable memory, chunk store) to complete a snapshot created via uploaded metadata. |
2 Likes