Skip to main content

Volumes

Volumes can be attached to your virtual machines, allowing you to increase their data storage capacity. Dive into the volume-related operations below to learn more.

Infrahub utilizes Shared Storage Volumes (SSV), a network-based storage solution offering reliable performance suitable for a wide range of use cases. SSV can be dynamically added to any virtual machine at any time, including those initially launched with only Hypervisor local NVMe storage. This "hot add" capability enhances your flexibility and resource management.

See more information about SSV

In this article


Core volume operations

Endpoint NameURLDescription
List volume typesGET /core/volume-typesReturns a list of available volume types.
List volumesGET /core/volumesReturns a list of your existing volumes.
Create volume /core/volumesCreates a volume.
Delete volumeDELETE /core/volumes/{id}Deletes a volume.

Volume attachment

Endpoint NameURLDescription
Attach volumes to virtual machine /core/virtual-machines/{virtual_machine_id}/attach-volumesAttaches one or more volumes to a virtual machine.
Detach volumes from virtual machine /core/virtual-machines/{virtual_machine_id}/detach-volumesRemoves one or more volumes from a virtual machine.

Volume Callbacks

Endpoint NameURLDescription
Attach callback to volume /core/volumes/{id}/attach-callbackCreates a callback URL for a specified volume.
Update volume callbackPUT /core/volumes/{id}/update-callbackUpdates the callback URL for a specified volume.
Delete volume callbackDELETE /core/volumes/{id}/delete-callbackDeletes a callback URL attached to a volume.


Create a Volume

https://infrahub-api.nexgencloud.com/v1/core/volumes

Creates a volume that can be attached to a virtual machine, expanding its storage capacity. If you install an operating system on the volume using the image_id field, it becomes a bootable volume. Specify the volume type and custom configuration in the request body. For additional details on volumes, click here.


Request body parameters


name string   Required

The name of the volume being created.
A string with a maximum length of 50 characters.


environment_name string   Required

The name of the environment within which the volume will be created.


volume_type string   Required

Specifies the type of volume being created, which determines the storage technology it will use.

note

To choose a volume_type use the GET /core/volume-types endpoint to retrieve a list of all available volume types. Currently, we offer the "Cloud-SSD" storage type.


size integer   Required

The size of the volume in GB.
Maximum size of "1048576 GB".


description string  optional

A brief description or comment about the volume.


image_id integer  optional

The ID of an operating system image to be installed on the volume. By providing an image_id in the create volume request, you will create a bootable volume.

note

To choose image an image for the volume you are creating call the GET /core/images endpoint to retrieve a list of the available image types and their IDs.

See more information about choosing an operating system image.


callback_url string  optional

A URL that can be attached to the volume you are creating. This callback_url will post any action events that occur to your volume to the provided URL.
A string with a maximum length of 250 characters.


Attributes of the volume object


status boolean

Indicates the success or failure of the creation of a volume. In this case, it is set to true, indicating that the volume has been created successfully.


message string

A message confirming the successful creation of the volume.


volume object

An object containing details about the created volume. To learn more about about the attributes of the volume object, click here.

Example request
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/volumes" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"name": "string",
"environment_name": "string",
"description": "string",
"volume_type": "string",
"size": 0,
"image_id": 0,
"callback_url": "string"
}'
Response
{
"status": true,
"message": "string",
"volume": {
"id": 0,
"name": "string",
"environment": {
"name": "string"
},
"description": "string",
"volume_type": "string",
"size": "string",
"status": "string",
"bootable": false,
"image_id": 0,
"callback_url": "string",
"created_at": "1970-01-01T00:00:00.000Z",
"updated_at": "1970-01-01T00:00:00.000Z"
}
}

Returns


The response will return the status of the request and the volume object containing details on the created volume.


Back to top