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
- Virtual machines APIs
Features of GPU virtual machines
Creating a virtual machine using the Infrahub API
POST 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.
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.
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.
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.
{
"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.
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
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.
{
"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 VM operations
- Manage existing VMs operations
- VM Metrics and events history operations
- Firewall operations
- Public IP operations
- Callback operations
- VNC console operations
Core virtual machine operations
A set of operations for creating virtual machines and retrieving information about your existing virtual machines.
Endpoint Name | URL | Description |
---|---|---|
Create virtual machines | POST /core/virtual-machines | Creates one or more virtual machines with the specified custom configuration and features. |
List virtual machines | GET /core/virtual-machines | Returns a list of your existing virtual machines. |
Retrieve virtual machine details | GET /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 Name | URL | Description |
---|---|---|
Start virtual machine | GET /core/virtual-machines/{id}/start | Starts a virtual machine. |
Stop virtual machine | GET /core/virtual-machines/{id}/stop | Shuts down a virtual machine. |
Hard-reboot virtual machine | GET /core/virtual-machines/{id}/hard-reboot | Reboots a virtual machine. |
Hibernate virtual machine | GET /core/virtual-machines/{id}/hibernate | Initiates the hibernation of a virtual machine. |
Restore hibernated virtual machine | GET /core/virtual-machines/{id}/hibernate-restore | Resumes a virtual machine from hibernation. |
Resize virtual machine | GET /core/virtual-machines/{virtual_machine_id}/resize | Modifies the hardware specifications of a virtual machine. |
Delete virtual machine | DELETE /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 Name | URL | Description |
---|---|---|
Retrieve virtual machine performance metrics | GET /core/virtual-machines/{id}/metrics | Retrieves performance metrics data for a virtual machine. |
Retrieve virtual machine events history | GET /core/virtual-machines/{id}/events | Retrieves history of events for a virtual machine. |
Firewall operations
Operations for creating and managing firewall rules for virtual machines.
Endpoint Name | URL | Description |
---|---|---|
Add firewall rule to virtual machine | POST /core/virtual-machines/{id}/sg-rules | Adds a firewall rule to a virtual machine. |
Delete firewall rule from virtual machine | DELETE /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 Name | URL | Description |
---|---|---|
Attach public IP to virtual machine | POST /core/virtual-machines/{id}/attach-floatingip | Attaches a public IP address to a virtual machine. |
Detach public IP from virtual machine | GET /core/virtual-machines/{id}/stop | Removes a public IP address from a virtual machine. |
Virtual machine callback operations
Operations for managing virtual machine callbacks.
Endpoint Name | URL | Description |
---|---|---|
Attach callback to virtual machine | POST /core/virtual-machines/{id}/attach-callback | Creates a callback URL for a specified volume. |
Update virtual machine callback | PUT /core/virtual-machines/{id}/update-callback | Updates the callback URL for a specified volume. |
Delete virtual machine callback | DELETE /core/virtual-machines/{id}/delete-callback | Deletes a callback URL attached to a volume. |
VNC Console
Operations for retrieving the VNC console for a specified virtual machine.
Endpoint Name | URL | Description |
---|---|---|
Retrieve API path for VNC Console | GET /core/virtual-machines/{id}/request-console | Retrieves the endpoint path to be sent in the GET /core/virtual-machines/{virtual_machine_id}/console/{job_id} request. |
Retrieve URL for VNC console | GET /core/virtual-machines/{virtual_machine_id}/console/{job_id} | Retrieves the URL to access the VNC console. |