Skip to main content
You can create a Compute virtual machine (VM) in the web console, or by using the CLI or Terraform provider. You can tailor the VM configuration to your needs and, for example, attach secondary disks and filesystems, or allocate GPU resources to your VM.

Steps

(Optional) Create a user data configuration

You do not need to create a user data configuration in advance if you create a VM in the web console.
To add a user for connections to a VM, create a configuration by using the cloud-init format:
export USER_DATA=$(jq -Rrs '.' <<EOF
#cloud-config
users:
  - name: $USER
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    ssh_authorized_keys:
      - $(cat ~/.ssh/id_ed25519.pub)
EOF
)
The configuration contains the following parameters:
  • name: Username for connecting to the VM. The above example sets the value of the machine’s USER environment variable as the username for the VM. Do not use the root or admin usernames. They are reserved for internal needs and are not allowed to connect to a VM by SSH.
  • sudo: Sudo policy. ALL=(ALL) NOPASSWD:ALL allows users unrestricted sudo access; False disables sudo access for users.
  • shell: Default shell.
  • ssh_authorized_keys: User’s authorized keys. Allows configuring SSH access to the VM. To create the key pair, run ssh-keygen -t ed25519.
You can specify several users and their public SSH keys.For more information, see cloud-init configuration examples.

Create a VM

On the VM creation page (https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/compute.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=b91340217b08a1456d88ae0347f281d1 Compute → Virtual machines → Create virtual machine), set the VM configuration:
  1. Select the project for the VM location.
  2. Specify the VM name.
  3. Configure the Computing resources section:
    1. Select whether the VM should have GPUs.
    2. Specify the VM type: regular or preemptible. VMs without GPUs only support the regular type.
    1. Select the platform and preset.
    2. (Optional) If you create a VM with 8 GPUs (for example, for training models), use a GPU cluster for the VM. InfiniBand™ in the cluster allows you to accelerate tasks that require high-performance computing (HPC) power. A single VM without InfiniBand cannot perform these tasks as quickly. To use a GPU cluster, select an existing one or create a new cluster:
      1. Click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Create in the GPU cluster field.
      2. In the window that opens, specify the cluster name and InfiniBand fabric. To select the fabric, see InfiniBand fabrics.
      3. Click Create.
    You cannot configure reservations in the web console. If you have reservations suitable for your VM, the service uses them automatically. If you want to configure a different behavior, use the CLI or the provider for Terraform.
  4. In the Boot disk section, set the boot disk settings:
    1. Click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/pencil-to-line.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=9f557f28487b7fec78ae7508b5b6a145.
    2. In the window that opens, select an existing disk or create a new one.
    3. If you create a new boot disk, specify its image with the operating system. Also, configure the type, encryption, size and block size. Maximum size of a boot disk is 30,720 GiB (30 TiB). For more information about these settings, see Volume parameters.
  5. (Optional) If you want to attach an additional disk to your VM, in the Additional disks section, specify the settings of this disk:
    1. Click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Attach disk.
    2. In the window that opens, select an existing secondary disk or create a new one.
    3. If you create a new disk, specify its name and configure the type, encryption, size and block size.
    4. Click Attach disk or Create and attach disk.
    After you create the VM, mount the additional disks to it. Otherwise, the VM’s operating system does not recognize these disks.
  6. (Optional) If you want to attach a filesystem to your VM, in the Shared filesystems section, specify the settings of this filesystem:
    1. Click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Attach shared filesystem.
    2. In the window that opens, select an existing filesystem or create a new one.
    3. If you create a new filesystem, specify its name, size and the block size.
    4. Click Attach filesystem or Create and attach filesystem.
    5. After the window is closed, specify a mount tag for mounting the filesystem to the VM. Create your own tag, such as my-filesystem. Make sure that it is unique within the VM.
    6. To mount the filesystem to the VM automatically, keep the Auto mount option enabled.
  7. Configure the Network section:
    1. Select the VM’s network and subnet.
    2. In the Primary private IP address field, select whether to automatically assign a private IP address or select an already allocated one. For more information, see Private IP addresses.
    3. (Optional) In the Secondary private IP address field, assign secondary addresses. Use them as a backup option in case of incidents. For example, a backup node can take a secondary address of the main node when the main one fails. As a result, routing to this address can be preserved. After you click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Assign secondary address, you can specify a new address or select an already created allocation. You can assign no more than five secondary addresses.
    4. In the Public IP address field, specify whether the VM should have a public address and whether this address should be dynamic, static or taken from an allocation. If you need to secure your VM and make it isolated, you can create a VM without a public IP address. If you need to connect to this VM from the internet, you can set up a WireGuard jump server. It has an IP address in the internet and an IP address in the VM’s network. As a result, you can access the VM via the jump server from the internet. This approach enhances security and still provides access to the VM. For more information, see How to enable a public IP address for a VM.
  8. In the Username and SSH key field, add credentials, so you can connect to the VM:
    1. Generate an SSH key pair:
      ssh-keygen -t ed25519
      
    2. In the Username and SSH key field, click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/chevron-down.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e3ec12ce62b3c2e03427533b780997f0.
    3. If you added an SSH key earlier and you want to reuse it, select the key from the drop-down list. If you want to add a new key, click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Add credentials.
    4. In the window that opens, specify the username of the VM user, a public key of your SSH key pair and the credentials name to recognize the key in the list. Do not use the root or admin usernames. They are reserved for internal needs and are not allowed to connect to a VM by SSH.
  9. Click Add credentials.
  10. (Optional) Select an existing service account or add a new one to associate it with the VM. The service account will perform actions on behalf of the VM, for example, run scripts.
  11. (Optional) Select Enable custom cloud-init config and set a configuration in the cloud-init format. This configuration affects the settings for shared filesystems and access that you set up earlier:
    • If you add a cloud-init configuration, you cannot manage the Auto mount option for filesystems. Their mounting settings automatically appear in the configuration.
    • The username and SSH key that you specify in the Access section are automatically added to a cloud-init configuration if you enable it. Ultimately, the settings from the configuration apply, not those from the Access section.
    The default configuration that only adds the user contains the following parameters:
    • name: Username for connecting to the VM. The above example sets the value of your machine’s USER environment variable as the username for the VM.
    • sudo: Sudo policy. ALL=(ALL) NOPASSWD:ALL allows users unrestricted sudo access; False disables sudo access for users.
    • shell: Default shell.
    • ssh_authorized_keys: User’s authorized keys. Allows configuring SSH access to the VM.
    You can specify several users and their public SSH keys. For more information, see cloud-init configuration examples.
  12. Click Create VM.

Examples

Create a VM without an additional disk or filesystem

  1. Create a boot disk:
    nebius compute disk create \
      --name <boot_disk_name> \
      --size-gibibytes 50 \
      --type network_ssd \
      --source-image-family-image-family ubuntu22.04-cuda12 \
      --block-size-bytes 4096
    
    Save the disk ID from the output metadata.id parameter. For more information about disk creation, see Creating and resizing Compute volumes.
  2. Create a VM:
    nebius compute instance create \
      --name <VM_name> \
      --resources-platform <platform> \
      --resources-preset <preset> \
      --boot-disk-existing-disk-id <boot_disk_ID> \
      --boot-disk-attach-mode <read_only|read_write> \
      --boot-disk-device-id <user_defined_ID> \
      --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": "<subnet_ID>"}]'
    
    The VM is provided with a dynamic public IPv4 address. For more information about the command parameters, see Create a VM.

Create a VM with an additional disk

  1. Create a boot disk:
    nebius compute disk create \
      --name <boot_disk_name> \
      --size-gibibytes 50 \
      --type network_ssd \
      --source-image-family-image-family ubuntu22.04-cuda12 \
      --block-size-bytes 4096
    
    Save the disk ID from the output metadata.id parameter. For more information about disk creation, see Creating and resizing Compute volumes.
  2. Create an additional disk:
    nebius compute disk create \
      --name <additional_disk_name> \
      --size-gibibytes 10 \
      --type network_ssd \
      --block-size-bytes 4096
    
    Save the disk ID from the output metadata.id parameter.
    After you create the VM, mount the additional disks to it. Otherwise, the VM’s operating system does not recognize these disks.
  3. Create the VM:
    nebius compute instance create \
      --name <VM_name> \
      --resources-platform <platform> \
      --resources-preset <preset> \
      --boot-disk-existing-disk-id <boot_disk_ID> \
      --boot-disk-attach-mode <read_only|read_write> \
      --boot-disk-device-id <user_defined_ID> \
      --secondary-disks '[{"existing_disk": {"id": "<additional_disk_ID>"}, "attach_mode": "READ_WRITE", "device_id": "<user_defined_ID>"}]' \
      --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": "<subnet_ID>"}]'
    
    The VM is provided with a dynamic public IPv4 address. For more information about the command parameters, see Create a VM.

Create a VM with a filesystem

  1. Create a boot disk:
    nebius compute disk create \
      --name <boot_disk_name> \
      --size-gibibytes 50 \
      --type network_ssd \
      --source-image-family-image-family ubuntu22.04-cuda12 \
      --block-size-bytes 4096
    
    Save the disk ID from the output metadata.id parameter. For more information about disk and filesystem creation, see Creating and resizing Compute volumes.
  2. Create a filesystem:
    nebius compute filesystem create \
      --name <filesystem_name> \
      --size-gibibytes 10 \
      --type network_ssd \
      --block-size-bytes 4096
    
    Save the filesystem ID from the output metadata.id parameter.
    Mount filesystems after you create the VM. Otherwise, the filesystems are not attached to the VM.
  3. Create the VM:
    nebius compute instance create \
      --name <VM_name> \
      --stopped <true|false> \
      --resources-platform <platform> \
      --resources-preset <preset> \
      --boot-disk-existing-disk-id <boot_disk_ID> \
      --boot-disk-attach-mode <read_only|read_write> \
      --boot-disk-device-id <user_defined_ID> \
      --filesystems '[{"existing_filesystem": {"id": "<filesystem_ID>"}, "attach_mode": "READ_WRITE", "mount_tag": "<filesystem_tag>"}]' \
      --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": "<subnet_ID>"}]'
    
    The VM is provided with a dynamic public IPv4 address. For more information about the command parameters, see Create a VM.

Create a VM within a GPU cluster

If you want to create a VM with 8 GPUs (for example, for training models), create a GPU cluster for the VM. By using InfiniBand, the cluster accelerates tasks that require high-performance computing (HPC) power.
  1. Create a boot disk:
    nebius compute disk create \
      --name <boot_disk_name> \
      --size-gibibytes 50 \
      --type network_ssd \
      --source-image-family-image-family ubuntu22.04-cuda12 \
      --block-size-bytes 4096
    
    Save the disk ID from the output metadata.id parameter. For more information about disk creation, see Creating and resizing Compute volumes.
  2. Create a GPU cluster:
    nebius compute gpu-cluster create \
      --name <GPU_cluster_name> \
      --infiniband-fabric <fabric>
    
    To select the fabric, see InfiniBand fabrics. Save the cluster ID from the output metadata.id parameter.
  3. Create a VM:
    nebius compute instance create \
      --name <VM_name> \
      --resources-platform <platform> \
      --resources-preset <preset> \
      --boot-disk-existing-disk-id <boot_disk_ID> \
      --boot-disk-attach-mode <read_only|read_write> \
      --boot-disk-device-id <user_defined_ID> \
      --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": "<subnet_ID>"}]' \
      --gpu-cluster-id <GPU_cluster_ID>
    
    The VM is provided with a dynamic public IPv4 address. For more information about the command parameters, see Create a VM.

“Not enough resources” error

Sometimes, demand for virtual machines and GPUs in certain Nebius AI Cloud regions might be higher than the available supply. When this happens, you might see a “Not enough resources” error when creating or restarting VMs in the affected region. For more details, see “Not enough resources” error for virtual machines in Nebius AI Cloud.

See also


InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.