Skip to content

Create Virtual Machine Instances

Provision new virtual machine instances with custom specifications and configurations defined in the request parameters.

HTTP Request

POST {API_URL}virtual-machines

Body Parameters

ParameterRequirementTypeDescription
nameRequiredstringInstance identifier for the deployed virtual machine
image_idRequiredstringOperating system image identifier. Available images can be retrieved via the /images endpoint
flavor_idRequiredstringHardware configuration identifier specifying CPU, memory, GPU, storage, and network specifications. Available configurations can be retrieved via the /flavors endpoint
ssh_keyRequiredObjectSSH authentication credentials for secure instance access. Format: {"name":"key_identifier","public_key":"ssh-ed25519 AAAA..."}
init_scriptOptionalstringInitialization script for automated instance configuration

NOTE

Region compatibility is required between image_id and flavor_id to ensure successful instance creation.

Initialization Script Example

The init_script parameter accepts cloud-init configuration for automated instance setup. Example configuration for Docker and NVIDIA GPU support:

bash
#!/bin/bash

# Update package repository
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg

# Configure Docker repository
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add Docker repository
echo \
"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
\"$(. /etc/os-release && echo \"$VERSION_CODENAME\")\" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker and NVIDIA components
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker ubuntu
sudo apt-get install nvidia-container-toolkit -y

# Configure NVIDIA runtime
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

Response Structure

status boolean

Operation result indicator. Returns true for successful execution, false when encountering an error.

message string

Descriptive response indicating the outcome of the instance creation request.

data object

Contains instance details including:

  • name: Assigned instance identifier
  • id: Unique instance identifier

For comprehensive documentation of instance attributes, please refer to our Instance Object Documentation.

Implementation Example

Request

bash
curl -X POST '{API_URL}virtual-machines' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'refresh-token: {REFRESH_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
    "name": "rtx4090vm",
    "image_id": "66b2d63c9e793247704c5a01",
    "flavor_id": "66b9ca8f6523790d00fea3ca",
    "ssh_key": {
        "name": "sshkey",
        "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGBtAhxR75dYv1t3NuQ4lUVNKGVwf4Y/GEXCz4AZIR6 sshusername"
    }
}'

Response

json
{
    "status": true,
    "message": "Virtual machine provisioning initiated successfully",
    "data": {
        "name": "VM-dhSqfrqh",
        "id": "676cf147e39574b1e3149831"
    }
}