Skip to main content

GPU Virtual Machine Features

Explore the range of features offered by Infrahub's virtual machines (VMs) to understand how our VM APIs can aid you in creating and managing customized VMs tailored to your specific needs. This VM API guide provides an in-depth look at virtual machines, outlining their capabilities and explaining the supported API operations that empower you to effortlessly create, optimize, and efficiently manage your VMs according to your requirements.

In this article


Features of GPU virtual machines





Creating a virtual machine using the Infrahub API

https://infrahub-api.nexgencloud.com/v1/core/virtual-machines

Create a custom virtual machine by including the desired resource configuration in the body of the request.

This request allows you to customize the specifications, operating system, storage, internet accessibility, security, custom initialization configuration scripts, event callbacks and more.

Learn more about these features below.


Example request
curl -X POST "https://infrahub-api.nexgencloud.com/v1/core/virtual-machines" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"\
-H "content-type: application/json" \
-d '{
"name": "string",
"environment_name": "string",
"image_name": "string",
"volume_name": "string",
"create_bootable_volume": false,
"flavor_name": "string",
"flavor": {...},
"key_name": "string",
"user_data": "string",
"callback_url": "string",
"assign_floating_ip": false,
"security_rules": [{...}],
"profile": {...},
"count": 0
}'

Required fields

The following fields must be included in the body of the request to create a new virtual machine.


name string   Required

Name of the virtual machine being deployed.
A string with a maximum length of 50 characters.


environment_name string   Required

Name of the environment within which the virtual machine will be created.


image_name string   Required

Name of the operating system image to be installed on the virtual machine, or bootable volume if the optional create_bootable_volume field is set to true.

note

If you are creating a virtual machine from an existing bootable volume, do not provide a value for the image_name field, as the operating system is already installed on the existing bootable volume.


key_name string   Required

Name of the SSH key pair that was used to import an SSH key.


flavor_name string Required

Name of the flavor (hardware configuration) that was chosen from the response of the GET /core/flavors endpoint call.


flavor object In development

The flavor object including the custom configuration of the specifications for the virtual machine.

note

The flavor object field is a feature presently under development, which will enable the creation of custom specification configurations.


count integer Required

The number of virtual machines to be deployed.
The maximum number of VMs that can be deployed per API call is 20.

The Create Virtual Machine object - required fields
  {
"name": "test-virtual-machine",
"environment_name": "test1",
"image_name": "Ubuntu Server 22.04 LTS",
"key_name": "test-key",
"flavor_name": "n3-RTX-A6000x1",
"count": 1
"volume_name": "string",
"create_bootable_volume": false,
"user_data": "string",
"callback_url": "string",
"assign_floating_ip": false,
"security_rules": [{...}],
"profile": {...},
"labels": [
"string"
]
}'

Optional fields

To specify additional features of a custom virtual machine, you can include the following optional fields in the body of the creation request.



volume_name string  optional

The name(s) of the volumes to be attached to the virtual machine, providing increased storage capacity.

note

Include either the operating system image_name or the volume_name if the existing volume being attached is bootable. Including both will result in a failed API request.


create_bootable_volume boolean  optional

Specify whether to create a virtual machine from a bootable operating system volume with the following valid values: true enables creation from a bootable volume, and false disables it.

To create a virtual machine from a new bootable volume, include the desired operating system image in the image_name and set the create_bootable_volume field to true. To create from an existing bootable volume, include the volume_name and set create_bootable_volume to true.


user_data string  optional

Configure your virtual machine for launch by including cloud-init scripts to be executed during virtual machine deployment.


callback_url string  optional

The URL where callback events will be sent whenever actions are executed on the virtual machine.


assign_floating_ip boolean  optional

Designates whether or not to assign a public IP address to the virtual machine. Setting this field to true makes the virtual machine publicly accessible using the SSH key pair. If you don't want your virtual machine to be publicly accessible, set the assign_floating_ip to false.


security_rules array of objects  optional

Create one or more firewall rules during virtual machine creation by including the security_rules object containing its configuration.

Show child parameters
direction string Required

The direction of traffic that the firewall rule applies to. Possible values: one of ingress or egress.


protocol string Required

The network protocol associated with the rule. Possible values: Any one of the protocol values retrieved by calling the GET /core/sg-rules-protocols endpoint.


ethertype string Required

The Ethernet type associated with the rule. Possible values: one of IPv4 or IPv6.


remote_ip_prefix string Required

The IP address range that is allowed to access the specified port.


port_range_min integer  optional

The minimum port number in the range of ports to be allowed by the firewall rule.


port_range_max integer  optional

The maximum port number in the range of ports to be allowed by the firewall rule.


profile object

Save the configuration of this virtual machine for future use by creating a provisioning profile. Include the name and description of the profile as parameters in the profile object.

Show child parameters
name string Required

The name of the provisioning profile that will be created.
Maximum length of 50 characters.


description string Required

A brief description of the provisioning profile being saved.
Maximum length of 150 characters.


labels array of strings  optional

An optional array of labels can be applied to the virtual machine for organizational and identification purposes. These labels can be updated after VM deployment using the update virtual machine labels endpoint.

The Create Virtual Machine object - optional fields
  {
"name": "test-virtual-machine",
"environment_name": "test1",
"image_name": "Ubuntu Server 22.04 LTS",
"key_name": "test-key",
"flavor_name": "n3-RTX-A6000x1",
"count": 1
"volume_name": "string",
"create_bootable_volume": false,
"user_data": "string",
"callback_url": "string",
"assign_floating_ip": false,
"security_rules": [{...}],
"profile": {...},
"labels": [
"string"
]
}'

Virtual machine APIs

Core virtual machine operations

A set of operations for creating virtual machines and retrieving information about your existing virtual machines.

Endpoint NameURLDescription
Create virtual machines /core/virtual-machinesCreates one or more virtual machines with the specified custom configuration and features.
List virtual machinesGET /core/virtual-machinesReturns a list of your existing virtual machines.
Retrieve virtual machine detailsGET /core/virtual-machines/{id}Retrieves the details of an existing virtual machine.

Manage existing virtual machine operations

A set of operations for managing existing virtual machine resources.

Endpoint NameURLDescription
Start virtual machineGET /core/virtual-machines/{id}/startStarts a virtual machine.
Stop virtual machineGET /core/virtual-machines/{id}/stopShuts down a virtual machine.
Hard-reboot virtual machineGET /core/virtual-machines/{id}/hard-rebootReboots a virtual machine.
Hibernate virtual machineGET /core/virtual-machines/{id}/hibernateInitiates the hibernation of a virtual machine.
Restore hibernated virtual machineGET /core/virtual-machines/{id}/hibernate-restoreResumes a virtual machine from hibernation.
Resize virtual machineGET /core/virtual-machines/{virtual_machine_id}/resizeModifies the hardware specifications of a virtual machine.
Delete virtual machineDELETE /core/virtual-machines/{id}Permanently deletes a virtual machine.

Metrics and events history operations

Operations for retrieving virtual machine metrics data and a history of events executed on a VM.

Endpoint NameURLDescription
Retrieve virtual machine performance metricsGET /core/virtual-machines/{id}/metricsRetrieves performance metrics data for a virtual machine.
Retrieve virtual machine events historyGET /core/virtual-machines/{id}/eventsRetrieves history of events for a virtual machine.

Firewall operations

Operations for creating and managing firewall rules for virtual machines.

Endpoint NameURLDescription
Add firewall rule to virtual machine /core/virtual-machines/{id}/sg-rulesAdds a firewall rule to a virtual machine.
Delete firewall rule from virtual machineDELETE /core/virtual-machines/{id}/sg-rules/{sg_rule_id}Deletes a firewall rule from a virtual machine.

Public IP operations

Operations for managing public IP addresses attached to virtual machines.

Endpoint NameURLDescription
Attach public IP to virtual machine /core/virtual-machines/{id}/attach-floatingipAttaches a public IP address to a virtual machine.
Detach public IP from virtual machineGET /core/virtual-machines/{id}/stopRemoves a public IP address from a virtual machine.

Virtual machine callback operations

Operations for managing virtual machine callbacks.

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

VNC Console

Operations for retrieving the VNC console for a specified virtual machine.

Endpoint NameURLDescription
Retrieve API path for VNC ConsoleGET /core/virtual-machines/{id}/request-consoleRetrieves the endpoint path to be sent in the GET /core/virtual-machines/{virtual_machine_id}/console/{job_id} request.
Retrieve URL for VNC consoleGET /core/virtual-machines/{virtual_machine_id}/console/{job_id}Retrieves the URL to access the VNC console.

Back to top