Skip to main content

Restore Snapshot

https://infrahub-api.nexgencloud.com/v1/core/snapshots/{id}/restore

Restore a snapshot to a new virtual machine. Supply the snapshot ID in the path to restore the specified snapshot.


Path parameters


id integer   Required

The unique identifier of the snapshot to be restored.


Body parameters


new_vm_name string   Required

A unique name for the new virtual machine.
A string with a maximum length of 50 characters.


contract_id string  optional

An optional contract ID can be provided to assign the virtual machine (VM) to a specific contract. If the assignment fails due to reasons such as insufficient GPU resources or mismatched GPU types, the VM will still be created (on-demand), and the response will include the reasons why the contract assignment failed. The contract ID can be updated after VM deployment, allowing for organizational and identification purposes.


Attributes


status boolean

Indicates the result of the request to restore the snapshot. true signifies success, while false indicates an error.


message string

A description of the status of the request.


instances array of objects

An array of instances objects, containing details about the request to restore a new VM.

For descriptions of the fields within the instances object returned in response to your request, please refer to the documentation here.

Example request
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/snapshots/{id}/restore" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"new_vm_name": "my-restored-vm",
"contract_id": 123,
}'
Response
{
"status": true,
"message": "VM is scheduled for creation.",
"errors": {
"contract":"Contract with ID: 123 not found."
},
"instances": [
{
"id": 1234,
"name": "my-restored-vm",
"status": "CREATING",
"environment": {
"id": 123,
"name": "my-environment-name",
"org_id": 123,
"region": "region-name"
},
"image": {
"name": "Ubuntu Server 22.04 LTS R535 CUDA 12.2"
},
"flavor": {
"id": 123,
"name": "n3-A100x1",
"cpu": 28,
"ram": 120.0,
"disk": 100,
"ephemeral": 750,
"gpu": "A100-80G-PCIe",
"gpu_count": 1
},
"os": "Ubuntu Server 22.04 LTS R535 CUDA 12.2",
"keypair": {
"name": "my-keypair-name"
},
"volume_attachments": [],
"power_state": null,
"vm_state": null,
"fixed_ip": null,
"floating_ip": null,
"floating_ip_status": "ATTACHING",
"security_rules": [],
"callback_url": null,
"locked": false,
"contract_id": null,
"labels": [],
"created_at": "1970-01-10T00:00:00"
}
]
}

Returns


Returns the status of virtual machine deployment and the instances object containing details on the restored virtual machine. The CREATING status in the response indicates a successful deployment of the virtual machine.


Back to top