Copy a VM

A new VM whose disk starts as a copy of the source VM's disk.

POST /v1/tenants/{tenant}/vms/{source}/copy

curl -X POST "https://api.shako.dev/v1/tenants/acme/vms/web1/copy" \
  -H "Authorization: Bearer $SHAKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"web1-test"}'

201 (excerpt)

{
  "name": "web1",
  "tenant": "acme",
  "state": "awake",
  "ssh": "web1.acme.shako.dev",
  "vcpus": 1,
  "mem_mib": 2048,
  "disk_gb": 10
}

Authenticate with Authorization: Bearer <API key> on https://api.shako.dev. Role: contributor or owner.

Path parameters

tenantstringrequired
The tenant's name, from GET /v1/tenants.
sourcestringrequired
The VM to copy.

Request body

namestringrequired
The new VM's name: a-z, 0-9 and single hyphens, starting with a letter, at most 31 characters. It is in the VM's SSH name and in the URLs of its public ports.
sleepstring (auto, never)default: the sleep policy of the source VM
When the VM sleeps. auto: when it is quiet. never: it stays on, and it restarts after a reboot or a crash. With both, the sleep and wake endpoints work at once.
idlestringdefault: the quiet time of the source VM
The quiet time before the VM sleeps, for example "15m" or "2h".

Response

201 with the VM object.

Behavior

The copy gets the size, the image, the agents and the role of the source VM, and it boots with new SSH host keys. The answer comes at once, with the copy creating, as for a create.

The errors. All the endpoints of VMs.