Skip to main content

Attach Volumes to Virtual Machine

https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{virtual_machine_id}/attach-volumes

Attaches one or more volumes to an existing virtual machine, expanding its storage capacity. Include the virtual machine ID in the path and the volume IDs in the request body to attach the specified volumes to the designated virtual machine. For additional details on volumes, click here.


Path parameters


virtual_machine_id integer   Required

The ID of the virtual machine the volumes are being attached to.


Request body parameters


volume_ids array of integers   Required

Specify one or more IDs of the volumes to be attached to the virtual machine.


Attributes


status boolean

Indicates the status of the volume attachment request. A status of true indicates success.


message string

A message describing the status of the volume attachment.


volume_attachments array

An array consisting of details on each of the volumes attached to the virtual machine.
To learn more about the attributes of the volumes_attachments objects, click here.

Example request
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/virtual-machines/{virtual_machine_id}/attach-volumes" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"volume_ids": [
0
]
}'
Response
{
"status": true,
"message": "string",
"volume_attachments": [
{
"id": 0,
"instance_id": 0,
"volume_id": 0,
"status": "string",
"created_at": "1970-01-01T00:00:00.000Z"
}
]
}

Returns


A successful response returns a status of true, along with a confirmation message and the volume_attachments array of objects. Each object in the array provides details about a volume attached to the specified virtual machine. Any other response indicates an error has occurred.


Back to top