Skip to content

Attach Volumes to Virtual Machine

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.

HTTP Request

POST {API_URL}/virtual-machines/{virtual_machine_id}/volumes

Path parameters

ParametersRequirementsTypeDescription
virtual_machine_idRequiredstringThe ID of the virtual machine the volumes are being attached to.

Body parameters

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

NOTE

Only volumes with bootable=false can be attached

Reponse Attributes

status boolean

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

message string

A description of the status of the request to delete the volume.

Example

Request

curl -X POST '{API_URL}/virtual-machines/{virtual_machine_id}/volumes' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'refresh-token: {REFRESH_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{"volume_ids":["689598902b54490029aa25c9"]}'

Response

{
    "status": true,
    "message": "Attaching volumes to virtual machine successful"
}