Pause, resume and snapshots
Pause a microVM to keep its memory, processes and files without paying for compute, and take snapshots to create new microVMs from a prepared state.
Pause a microVM to keep everything it holds, its memory, running processes and files, while it accrues no CPU or memory. Take a snapshot to save that same state while the microVM keeps running, then create as many new microVMs from it as you need.
Pause and resume
A paused microVM keeps its memory, its processes and its disk. Processes continue where they stopped when you resume it, with their variables, open files and child processes intact.
curl -X POST https://api.gigadrive.network/microvms/0199a7c4-5b1e-7c3d-9f20-333333333333/pause \
-H "Authorization: Bearer $GIGADRIVE_TOKEN"
curl -X POST https://api.gigadrive.network/microvms/0199a7c4-5b1e-7c3d-9f20-333333333333/resume \
-H "Authorization: Bearer $GIGADRIVE_TOKEN"Both calls answer once the change is done: 200 with the microVM, status: "paused" after a pause and status: "running" after a resume. A pause waits up to two minutes. Add ?wait=false to either call to get 202 right away, with status: "pausing" or "resuming", and poll GET /microvms/{id} until it settles.
While a microVM is paused:
- Its timeout stops counting. It resumes with the time it had left when it paused, and the time it spent paused does not count against your plan's maximum lifetime.
- It is kept for your plan's pause retention, then deleted with everything on it.
expiresAtshows when. A paused microVM deleted this way reportsstopReason: "pause_expired". - Commands and file calls answer
409with the codemicrovm_paused. They are not queued and do not resume the microVM: callPOST /microvms/{id}/resumefirst, or create it withautoResume. - Its preview URLs show a page saying the microVM is paused instead of reaching your server.
- You can still stop or delete it. That discards the paused state.
A resumed microVM keeps its ID, its preview URLs and its metadata. Network connections that were open when it paused are closed, so a process holding a database or WebSocket connection has to reconnect. Its clock is set to the current time when it resumes.
Resume automatically
Create the microVM with "autoResume": true to resume it whenever it is used while paused, instead of answering microvm_paused:
- A command or file call resumes it and waits until it runs, then runs as usual. The call takes a few seconds longer.
- A request to a public preview URL resumes it and waits up to 20 seconds. If it is still resuming after that, the request gets the paused page; try again.
- A request to a private preview URL does not resume it, because the request might not carry the preview token. Resume it with a command, a file call or
POST /microvms/{id}/resume. - Opening the microVM in the console does not resume it, so a page left open never wakes it. Select Resume on its page instead.
curl -X POST https://api.gigadrive.network/microvms \
-H "Authorization: Bearer $GIGADRIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"image": "node22", "ports": [3000], "onTimeout": "pause", "autoResume": true}'Together with onTimeout: "pause", the microVM pauses when its timeout ends and comes back the next time it is used, and while it is paused you pay only for snapshot storage. A microVM that is still pausing answers microvm_paused until the pause finishes. The response shows the setting as autoResume.
If a pause cannot complete, the microVM keeps running and the call answers 502 with the code microvm_capture_failed. If a resume cannot complete, the microVM stays paused with its state intact and the call answers 502 with microvm_resume_failed; try again.
Snapshots
A snapshot saves a running microVM's memory, processes and disk. The microVM keeps running: it is frozen only for the moments the capture takes, and continues afterwards.
curl -X POST https://api.gigadrive.network/microvms/0199a7c4-5b1e-7c3d-9f20-333333333333/snapshots \
-H "Authorization: Bearer $GIGADRIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"name":"after-install","expiresInMs":604800000}'The call answers 201 with the snapshot once it is ready, or 202 while it is still creating when you pass ?wait=false or the capture takes longer than two minutes. Both fields are optional:
| Field | Meaning |
|---|---|
name | Your label: up to 64 letters, digits, spaces and . _ -, starting with a letter or digit |
expiresInMs | Delete the snapshot after this many milliseconds. Default: your plan's maximum |
A microVM can take one pause or snapshot at a time. A second request while one is in progress answers 409 with capture_in_progress.
List, read and delete snapshots under /microvm-snapshots:
curl "https://api.gigadrive.network/microvm-snapshots?applicationId=0197b2f1-2f4a-7a0b-8a2d-222222222222" \
-H "Authorization: Bearer $GIGADRIVE_TOKEN"
curl -X DELETE https://api.gigadrive.network/microvm-snapshots/0199a7c4-5b1e-7c3d-9f20-444444444444 \
-H "Authorization: Bearer $GIGADRIVE_TOKEN"Deleting a snapshot stops its storage from being billed. microVMs already created from it keep running.
Create a microVM from a snapshot
Pass snapshotId instead of image when you create a microVM. The new microVM starts with the snapshot's memory, running processes and files, for example a dev server that is already up or dependencies that are already installed.
curl -X POST https://api.gigadrive.network/microvms \
-H "Authorization: Bearer $GIGADRIVE_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"applicationId":"0197b2f1-2f4a-7a0b-8a2d-222222222222","snapshotId":"0199a7c4-5b1e-7c3d-9f20-444444444444","ports":[3000],"env":{"BRANCH":"feature-a"}}'The new microVM:
- Gets its own ID, preview URLs and network address, and never shares state with the microVM the snapshot came from or with other microVMs created from it.
- Keeps the snapshot's image, vCPUs and memory. Passing other values answers
400.diskMbcan be larger than the snapshot's disk, never smaller. - Takes
env,ports,timeoutMs,metadataandnetworkfrom the request. The variables inenvare added to the ones the snapshot was taken with, andGIGADRIVE_MICROVM_IDholds the new microVM's ID.
Processes that generated random values or tokens before the snapshot keep them in every microVM created from it. Generate secrets after the microVM starts, not before you take the snapshot.
Billing and limits
A paused microVM accrues no CPU and no memory. Pauses and snapshots are billed as storage for the bytes they hold, at the same rate as File Storage: €0.02 per GB-month after 5 GB-months included. See Limits and pricing.
| Limit | Starter | Pro | Enterprise |
|---|---|---|---|
| Snapshots per organization | 10 | 100 | 1000 |
| Longest a snapshot is kept | 7 days | 30 days | 90 days |
| Longest a paused microVM is kept | 1 day | 7 days | 30 days |
Pauses do not count against the snapshot limit. A paused microVM does not count against the number of microVMs running at once, so resuming one can be refused when your organization is already at that limit; it stays paused until there is room.
The network:microvms:write scope pauses, resumes and takes snapshots, network:microvms:read lists and reads them, and network:microvms:delete deletes them.
