> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to create a virtual machine in Nebius AI Cloud

You can create a Compute virtual machine (VM) in the [web console](https://console.nebius.com), or by using the [CLI](../../cli) or [Terraform provider](../../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

<Tip>
  You do not need to create a user data configuration in advance if you create a VM in the web console.
</Tip>

<Tabs>
  <Tab title="CLI">
    To add a user for connections to a VM, create a configuration by using the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format:

    ```bash theme={null}
    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, follow the instructions in [Generating SSH keys](/compute/virtual-machines/ssh-keys).

    You can specify several users and their public SSH keys.

    For more information, see [cloud-init configuration examples](https://cloudinit.readthedocs.io/en/latest/reference/examples.html).
  </Tab>

  <Tab title="Terraform">
    1. [Install and configure](/terraform-provider/quickstart) the Nebius AI Cloud provider for Terraform.

    2. To add a user for connections to a VM, create a configuration by using the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format:

       ```bash theme={null}
       export USER_DATA=$(jq -Rs '.' <<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, follow the instructions in [Generating SSH keys](/compute/virtual-machines/ssh-keys).

       You can specify several users and their public SSH keys.

       For more information, see [cloud-init configuration examples](https://cloudinit.readthedocs.io/en/latest/reference/examples.html).

    3. Put the user data to a Terraform variable, so the Terraform configuration can address it:

       ```bash theme={null}
       export TF_VAR_user_data=$(printf "%s" "$USER_DATA")
       ```

    4. Check that the `TF_VAR_user_data` variable contains the correct data:

       ```bash theme={null}
       printf "TF_VAR_user_data: %s\n" "$TF_VAR_user_data"
       ```

       The output is the following:

       ```text theme={null}
       TF_VAR_user_data: "users:\n  - name: <username>\n    sudo: ALL=(ALL) NOPASSWD:ALL\n    shell: /bin/bash\n    ssh_authorized_keys:\n      - <public_SSH_key>\n"
       ```

    5. Create the `variables.tf` file with the following contents:

       ```hcl theme={null}
       variable "user_data" {
         description = "User data in the cloud-init format"
         type        = string
       }
       ```

       The file allows the Terraform provider to address the `TF_VAR_user_data` environment variable.

    6. Initialize the working directory:

       ```bash theme={null}
       terraform init
       ```
  </Tab>
</Tabs>

### Create a VM

<Tabs>
  <Tab title="Web console">
    On the VM creation page (<Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/compute.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=b91340217b08a1456d88ae0347f281d1" width="16" height="16" data-path="_assets/sidebar/compute.svg" /> **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](./preemptible).

          VMs without GPUs only support the regular type.

       3. (Optional) For a regular VM with GPUs, select **Reservation usage**. Specify whether Compute should allocate resources for the VM from [reservations](./reservations).

          The **Reservation usage** field is only displayed if you have [capacity block groups](/overview/limits/capacity-block-groups).

              <Accordion title="More information about reservation usage">
                * **With reservations**: The resources are allocated from reservations ([capacity block groups](/overview/limits/capacity-block-groups)). For example, if a Nebius manager has created a capacity block group for you, Compute allocates GPUs for the VM from this capacity block group. This ensures that resources are always available, even if the VM is stopped (for example, by you or a [maintenance event](./maintenance)).

                  You can use one of the following reservation types:

                  * **Any** (default): You do not need to select reservations. The service uses the reservations that are most suitable for the configuration of your VM.
                  * **Specific**: Select specific reservations. Make sure to select reservations that have enough capacity and that do not expire in several days.

                  If there are no reservations available during the VM lifecycle, you can run your VM without reservations. Resources for it will be taken from the common pool. To configure this behavior, enable the **Start without a reservation when reservation capacity is exhausted** option.

                * **Without reservations**: The resources are allocated from a common pool, and no reservations are used for the VM.
              </Accordion>

       4. Select the [platform and preset](./types).

       5. (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 <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1" width="16" height="16" data-path="_assets/plus.svg" /> **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](../clusters/gpu#infiniband-fabrics).
          3. Click **Create**.

    4. In the **Boot disk** section, set the boot disk settings:

       1. Click <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/pencil-to-line.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=9f557f28487b7fec78ae7508b5b6a145" width="16" height="16" data-path="_assets/pencil-to-line.svg" />.
       2. In the window that opens, select an existing disk or create a new one.
       3. If you create a new boot disk, choose an operating system image: either a [public image](/compute/storage/boot-disk-images) provided by Nebius or a [custom image or image family](/compute/storage/custom-disk-images) that you created yourself. 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](../storage/manage#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 <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1" width="16" height="16" data-path="_assets/plus.svg" /> **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**.

           <Warning>
             After you create the VM, [mount the additional disks](/compute/storage/use#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks.
           </Warning>

    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 <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1" width="16" height="16" data-path="_assets/plus.svg" /> **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](/vpc/overview).

       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](./network#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 <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1" width="16" height="16" data-path="_assets/plus.svg" /> **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](/compute/virtual-machines/wireguard). 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](./network#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](./connect):

       1. Generate an [SSH key pair](/compute/virtual-machines/ssh-keys).

       2. In the **Username and SSH key** field, click <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/chevron-down.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e3ec12ce62b3c2e03427533b780997f0" width="16" height="16" data-path="_assets/chevron-down.svg" />.

       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 <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1" width="16" height="16" data-path="_assets/plus.svg" /> **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](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) 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](https://cloudinit.readthedocs.io/en/latest/reference/examples.html).

    12. Click **Create VM**.
  </Tab>

  <Tab title="CLI">
    1. Create a boot disk:

       ```bash theme={null}
       nebius compute disk create \
         --name <boot_disk_name> \
         --size-gibibytes 50 \
         --type network_ssd \
         --source-image-family-image-family ubuntu24.04-cuda13.0 \
         --block-size-bytes 4096
       ```

       Save the disk ID from the output `metadata.id` parameter.

       Maximum size of a boot disk is 30,720 GiB (30 TiB). For more information about disk creation, see [Creating and resizing Compute volumes](../storage/manage).

    2. (Optional) If you want to attach an additional disk to your VM, create this disk:

       ```bash theme={null}
       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.

    3. (Optional) If you want to attach a filesystem to your VM, create this filesystem:

       ```bash theme={null}
       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.

       For more information about filesystem creation, see [Creating and resizing Compute volumes](../storage/manage).

    4. (Optional) To provide the VM with an [allocation](../../vpc/overview#allocation) that reserves a static public IP address, create this allocation. As a result, the address is preserved even if you delete the VM.

       1. [Get the required subnet ID](../../vpc/networking/resources#how-to-get-a-subnet-id).
       2. Run the following command:

          ```bash theme={null}
          nebius vpc allocation create \
            --ipv4-public-subnet-id <subnet_ID> \
            --name <allocation_name>
          ```

          Save the allocation ID from the output `metadata.id` parameter.

       For more information about networking in Compute, see [Public IP addresses](./network#public-ip-addresses).

    5. (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 create a GPU cluster, run the following command:

       ```bash theme={null}
       nebius compute gpu-cluster create \
         --name <GPU_cluster_name> \
         --infiniband-fabric <fabric>
       ```

       To select the fabric, see [InfiniBand fabrics](../clusters/gpu#infiniband-fabrics).

       Save the cluster ID from the output `metadata.id` parameter.

    6. (Optional) Create a [service account](/iam/service-accounts/manage) that will perform actions on behalf of the VM:

       ```bash theme={null}
       nebius iam service-account create --name <service_account_name>
       ```

    7. Create the VM:

       ```bash theme={null}
       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> \
         --secondary-disks '[{"existing_disk": {"id": "<additional_disk_ID>"}, "attach_mode": "READ_WRITE", "device_id": "<user_defined_ID>"}]' \
         --filesystems '[{"existing_filesystem": {"id": "<filesystem_ID>"}, "attach_mode": "READ_WRITE", "mount_tag": "<filesystem_tag>"}]' \
         --cloud-init-user-data "$USER_DATA" \
         --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {"allocation_id": "<allocation_ID>"}, "subnet_id": "<subnet_ID>"}]' \
         --gpu-cluster-id <GPU_cluster_ID> \
         --hostname <FQDN_hostname> \
         --reservation-policy-policy <auto|forbid|strict> \
         --reservation-policy-reservation-ids <reservations> \
         --recovery-policy <recover|fail> \
         --preemptible-priority <1...5> \
         --preemptible-on-preemption stop \
         --service-account-id <service_account_ID>
       ```

       The command contains the following parameters:

       * `--name`: VM's name.

       * `--stopped` (optional): If you want to create a VM but not launch it, specify the `false` value. The VM will remain in the `Stopped` status.

         For more information, see [Lifecycle of a Compute virtual machine](./lifecycle).

       * `--resources-platform`: [VM platform](./types).

       * `--resources-preset`: VM preset. Depends on the chosen platform.

       * `--boot-disk-existing-disk-id`: ID of the boot disk created earlier.

       * `--boot-disk-attach-mode`: Write permission of the boot disk, `READ_ONLY` or `READ_WRITE`.

       * `--boot-disk-device-id` (optional): User-defined ID for mounting the boot disk to the VM. The default value is `disk-n`, where `n` is an integer index. A `virtio-` prefix is added to the specified (or default) device ID.

       * `--secondary-disks` (optional): Additional disk settings. You can attach several disks.

         * `id`: ID of the additional disk created earlier.
         * `attach_mode`: Write permission of the additional disk, `READ_ONLY` or `READ_WRITE`.
         * `device_id`: User-defined ID for mounting the disk to the VM.

       * `--filesystems` (optional): Filesystem settings. You can attach several filesystems, if required.

         * `id`: ID of the filesystem created earlier.
         * `attach_mode`: Write permission of the filesystem, `READ_ONLY` or `READ_WRITE`.
         * `mount_tag`: 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.

           If you do not specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`.

             <Warning>
               After you create the VM, [mount the additional disks and filesystems](/compute/storage/use#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these volumes.
             </Warning>

       * `--cloud-init-user-data` (optional): Configuration of VM users in the [cloud-init](https://cloud-init.io/) format.

       * `--network-interfaces`: Network settings.

         * To assign a dynamic public IP address, specify `"public_ip_address": {}`.

           A dynamic public IP address is randomly allocated from the [IPv4 public range](#get-public-ip-range) of Nebius AI Cloud and is not persistent. If a VM with a dynamic address has the `Stopped` status for more than one hour, the address is automatically returned to the IPv4 public range. After that, Compute may allocate this address to a different VM.

         * To assign a static public IP address, specify `"public_ip_address": {"static": true}`.

           A static public IP address is also randomly allocated from the IPv4 public range of Nebius AI Cloud. If you stop a VM that has a static IP address, the address will not return to the range. However, if you delete this VM, the address will return.

         * To assign the allocation created earlier, specify `"public_ip_address": {"allocation_id": "<allocation_ID>"}`.

           An allocation allows you to use a reserved static public address for the VM. This address will not return to the IPv4 range even if you delete the VM.

         * To create a VM without a public IP address, remove the `public_ip_address` parameter from the JSON. The VM will only have a private address.

           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](/compute/virtual-machines/wireguard). 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.

       * `--gpu-cluster-id` (optional): ID of the GPU cluster created earlier.

       * `--hostname` (optional): Hostname for the VM's [FQDN](./fqdn). By default, the FQDN has the `<VM_ID>.<VM_network_ID>.compute.internal.` format. If you want to customize it, use a hostname instead of the VM's ID in the FQDN. For example, if you specify `--hostname my-host`, the FQDN is `my-host.vpcnetwork-e00***.compute.internal.`.

       * `--reservation-policy-policy` (optional): Policy for reservation usage. You can use [reservations of capacity resources](./reservations) and run your VM based on them. As a result, the VM resources are reserved and always available.

       * `--reservation-policy-reservation-ids` (optional): IDs of specific reservations. These are capacity block groups that a Nebius manager has created.

         For information about how to configure `--reservation-policy-policy` and `--reservation-policy-reservation-ids`, see [How to add reservations to VMs](./reservations#how-to-add-reservations-to-vms).

       * `--recovery-policy` (optional): Defines what Compute does with the VM after it is preempted or fails.

         [Preemptible VMs](./preemptible) only support the `fail` value that stops the VM. They do not support the `recover` value that tries to restart the VM. If you set `recover` for a preemptible VM, it will cause an error.

       * `--preemptible-priority` (optional; for preemptible VMs only): Affects the order in which Compute tries to stop the VM in your project. It starts with VMs that have lower priority values but does not guarantee the exact order. The value can range from `1` to `5`, where `5` indicates the highest priority.

       * `--preemptible-on-preemption` (optional; for preemptible VMs only): Specifies what happens when the VM is preempted. The only supported value is `stop`: Compute stops the VM without deleting or restarting it.

       * `--service-account-id` (optional): Service account associated with the VM.
  </Tab>

  <Tab title="Terraform">
    1. Create a boot disk by using the following configuration:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_boot_disk" {
         name           = "<boot_disk_name>"
         parent_id      = "<project_ID>"
         size_gibibytes = "50"
         type           = "NETWORK_SSD"
         source_image_family = {
           image_family = "ubuntu24.04-cuda13.0"
         }
         block_size_bytes = 4096
       }
       ```

       For `parent_id`, use [project ID](/iam/manage-projects#terraform-3).

       Maximum size of a boot disk is 30,720 GiB (30 TiB). For more information, see [Volume parameters](../storage/manage#volume-parameters).

    2. (Optional) If you want to attach an additional disk to your VM, create this disk:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_additional_disk" {
         name             = "<additional_disk_name>"
         parent_id        = "<project_ID>"
         size_gibibytes   = "10"
         type             = "NETWORK_SSD"
         block_size_bytes = 4096
       }
       ```

    3. (Optional) If you want to attach a filesystem to your VM, create this filesystem:

       ```hcl theme={null}
       resource "nebius_compute_v1_filesystem" "my_filesystem" {
         name             = "<filesystem_name>"
         parent_id        = "<project_ID>"
         size_gibibytes   = 10
         type             = "NETWORK_SSD"
         block_size_bytes = 4096
       }
       ```

       For more information, see [Volume parameters](../storage/manage#volume-parameters).

    4. (Optional) To provide the VM with an [allocation](../../vpc/overview#allocation) that reserves a static public IP address, create this allocation. As a result, the address is preserved even if you delete the VM.

       ```hcl theme={null}
       resource "nebius_vpc_v1_allocation" "my_allocation" {
         name      = "<allocation_name>"
         parent_id = "<project_ID>"
         ipv4_public = {
           subnet_id = "<subnet_ID>"
         }
       }
       ```

       To create the allocation, [get the required subnet ID](../../vpc/networking/resources#how-to-get-a-subnet-id).

       For more information about networking in Compute, see [Public IP addresses](./network#public-ip-addresses).

    5. (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 create a GPU cluster, use the following configuration:

       ```hcl theme={null}
       resource "nebius_compute_v1_gpu_cluster" "my_gpu_cluster" {
         name              = "<GPU_cluster_name>"
         parent_id         = "<project_ID>"
         infiniband_fabric = "<fabric>"
       }
       ```

       To select the fabric, see [InfiniBand fabrics](../clusters/gpu#infiniband-fabrics).

    6. (Optional) Create a [service account](/iam/service-accounts/manage) that will perform actions on behalf of the VM:

       ```hcl theme={null}
       resource "nebius_iam_v1_service_account" "my_sa" {
         name = "<service_account_name>"
         parent_id = "<project_ID>"
       }
       ```

    7. Create the VM:

       ```hcl theme={null}
       resource "nebius_compute_v1_instance" "my_vm" {
         name      = "<VM_name>"
         parent_id = "<project_ID>"
         stopped   = <true|false>
         resources = {
           platform = "<platform>"
           preset   = "<preset>"
         }
         boot_disk = {
           existing_disk = {
             id = nebius_compute_v1_disk.my_boot_disk.id
           }
           attach_mode = "<READ_ONLY|READ_WRITE>"
           device_id = "<user_defined_ID>"
         }
         secondary_disks = [
           {
             existing_disk = {
               id = nebius_compute_v1_disk.my_additional_disk.id
             }
             attach_mode = "<READ_ONLY|READ_WRITE>"
             device_id = "<user_defined_ID>"
           }
         ]
         filesystems = [
           {
             existing_filesystem = {
               id = nebius_compute_v1_filesystem.my_filesystem.id
             }
             attach_mode = "<READ_ONLY|READ_WRITE>"
             mount_tag   = "<filesystem_tag>"
           }
         ]
         cloud_init_user_data = var.user_data
         network_interfaces = [
           {
             name       = "eth0"
             ip_address = {}
             public_ip_address = {
               allocation_id = nebius_vpc_v1_allocation.my_allocation.id
             }
             subnet_id = "<subnet_ID>"
           }
         ]
         gpu_cluster = {
           id = nebius_compute_v1_gpu_cluster.my_gpu_cluster.id
         }
         hostname           = "<FQDN_prefix>"
         reservation_policy = {
           policy = "<AUTO|FORBID|STRICT>"
           reservation_ids = "<reservations>"
         }
         recovery_policy    = "<RECOVER|FAIL>"
         preemptible = {
           priority      = <1...5>
           on_preemption = "STOP"
         }
         service_account_id = nebius_iam_v1_service_account.my_sa.id
       }
       ```

       The configuration contains the following parameters:

       * `name`: VM's name.

       * `stopped` (optional): If you want to create a VM but not launch it, specify the `false` value. The VM will remain in the `Stopped` status.

         For more information, see [Lifecycle of a Compute virtual machine](./lifecycle).

       * `resources.platform`: [VM platform](./types).

       * `resources.preset`: VM preset. Depends on the chosen platform.

       * `boot_disk`: Boot disk settings.

         * `existing_disk.id`: ID of the boot disk created earlier.
         * `attach_mode`: Write permission of the boot disk, `READ_ONLY` or `READ_WRITE`.
         * `device_id` (optional): User-defined ID for mounting the disk to the VM. The default value is `disk-n`, where `n` is an integer index. A `virtio-` prefix is added to the specified (or default) device ID.

       * `secondary_disks` (optional): Additional disk settings. You can attach several disks.

         * `id`: ID of the additional disk created earlier.
         * `attach_mode`: Write permission of the additional disk, `READ_ONLY` or `READ_WRITE`.
         * `device_id`: User-defined ID for mounting the disk to the VM.

       * `filesystems` (optional): Filesystem settings. You can attach several filesystems, if required.

         * `existing_filesystem.id`: ID of the filesystem created earlier.
         * `attach_mode`: Write permission of the filesystem, `READ_ONLY` or `READ_WRITE`.
         * `mount_tag`: 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.

           If you do not specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`.

             <Warning>
               After you create the VM, [mount the additional disks and filesystems](/compute/storage/use#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these volumes.
             </Warning>

       * `cloud_init_user_data` (optional): Configuration of VM users in the [cloud-init](https://cloud-init.io/) format.

       * `network_interfaces`: Network settings.

         * To assign a dynamic public IP address, specify `public_ip_address = {}`.

           A dynamic public IP address is randomly allocated from the [IPv4 public range](#get-public-ip-range) of Nebius AI Cloud and is not persistent. If a VM with a dynamic address has the `Stopped` status for more than one hour, the address is automatically returned to the IPv4 public range. After that, Compute may allocate this address to a different VM.

         * To assign a static public IP address, specify `public_ip_address = {static = true}`.

           A static public IP address is also randomly allocated from the IPv4 public range of Nebius AI Cloud. If you stop a VM that has a static IP address, the address will not return to the range. However, if you delete this VM, the address will return.

         * To assign the allocation created earlier, specify `public_ip_address = {allocation_id = nebius_vpc_v1_allocation.my_allocation.id}`.

           An allocation allows you to use a reserved static public address for the VM. This address will not return to the IPv4 range even if you delete the VM.

         * To create a VM without a public IP address, remove the `public_ip_address` parameter from the configuration. The VM will only have a private address.

           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](/compute/virtual-machines/wireguard). 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.

       * `gpu_cluster.id` (optional): ID of the GPU cluster created earlier.

       * `hostname` (optional): Hostname for the VM's [FQDN](./fqdn). By default, the FQDN has the `<VM_ID>.<VM_network_ID>.compute.internal.` format. If you want to customize it, use a hostname instead of the VM's ID in the FQDN. For example, if you specify `hostname = "my-host"`, the FQDN is `my-host.vpcnetwork-e00***.compute.internal.`.

       * `reservation_policy.policy` (optional): Policy for reservation usage. You can use [reservations of capacity resources](./reservations) and run your VM based on them. As a result, VM resources are reserved and always available.

       * `reservation_policy.reservation_ids` (optional): IDs of specific reservations. These are capacity block groups that a Nebius manager has created.

         For information about how to configure `reservation_policy.policy` and `reservation_policy.reservation_ids`, see [How to add reservations to VMs](./reservations#how-to-add-reservations-to-vms).

       * `recovery_policy` (optional): Defines what Compute does with the VM after it is preempted or fails.

         [Preemptible VMs](./preemptible) only support the `FAIL` value that stops the VM. They do not support the `RECOVER` value that tries to restart the VM. If you set `RECOVER` for a preemptible VM, it will cause an error.

       * `preemptible.priority` (optional; for preemptible VMs only): Affects the order in which Compute tries to stop the VM in your project. It starts with VMs that have lower priority values but does not guarantee the exact order. The value can range from `1` to `5`, where `5` indicates the highest priority.

       * `preemptible.on_preemption` (optional; for preemptible VMs only): Specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it.

       * `service_account_id` (optional): Service account associated with the VM.

    8. Check that the configuration is correct:
       ```bash theme={null}
       terraform validate
       ```

    9. Apply the changes:
       ```bash theme={null}
       terraform apply
       ```
  </Tab>
</Tabs>

## Examples

### Create a VM without an additional disk or filesystem

<Tabs>
  <Tab title="CLI">
    1. Create a boot disk:

       ```bash theme={null}
       nebius compute disk create \
         --name <boot_disk_name> \
         --size-gibibytes 50 \
         --type network_ssd \
         --source-image-family-image-family ubuntu24.04-cuda13.0 \
         --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](../storage/manage).

    2. Create a VM:

       ```bash theme={null}
       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).
  </Tab>

  <Tab title="Terraform">
    1. [Install and configure](/terraform-provider/quickstart) the Nebius AI Cloud provider for Terraform.

    2. Create a boot disk by using the following configuration:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_boot_disk" {
         name           = "<boot_disk_name>"
         parent_id      = "<project_ID>"
         size_gibibytes = "50"
         type           = "NETWORK_SSD"
         source_image_family = {
           image_family = "ubuntu24.04-cuda13.0"
         }
         block_size_bytes = 4096
       }
       ```

       Set the `parent_id` to your [Project ID](/iam/manage-projects#terraform-3).

       For more information, see [Volume parameters](../storage/manage#volume-parameters).

    3. Create a VM:

       ```hcl theme={null}
       resource "nebius_compute_v1_instance" "my_vm" {
         name      = "<VM_name>"
         parent_id = "<project_ID>"
         resources = {
           platform = "<platform>"
           preset   = "<preset>"
         }
         boot_disk = {
           existing_disk = {
             id = nebius_compute_v1_disk.my_boot_disk.id
           }
           attach_mode = "<READ_ONLY|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 configuration parameters, see [Create a VM](#create-a-vm).

    4. Check that the configuration is correct:
       ```bash theme={null}
       terraform validate
       ```

    5. Apply the changes:
       ```bash theme={null}
       terraform apply
       ```
  </Tab>
</Tabs>

### Create a VM with an additional disk

<Tabs>
  <Tab title="CLI">
    1. Create a boot disk:

       ```bash theme={null}
       nebius compute disk create \
         --name <boot_disk_name> \
         --size-gibibytes 50 \
         --type network_ssd \
         --source-image-family-image-family ubuntu24.04-cuda13.0 \
         --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](../storage/manage).

    2. Create an additional disk:

       ```bash theme={null}
       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.

           <Warning>
             After you create the VM, [mount the additional disks](/compute/storage/use#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks.
           </Warning>

    3. Create the VM:

       ```bash theme={null}
       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).
  </Tab>

  <Tab title="Terraform">
    1. [Install and configure](/terraform-provider/quickstart) the Nebius AI Cloud provider for Terraform.

    2. Create a boot disk by using the following configuration:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_boot_disk" {
         name           = "<boot_disk_name>"
         parent_id      = "<project_ID>"
         size_gibibytes = "50"
         type           = "NETWORK_SSD"
         source_image_family = {
           image_family = "ubuntu24.04-cuda13.0"
         }
         block_size_bytes = 4096
       }
       ```

       For `parent_id`, use [Project ID](/iam/manage-projects#terraform-3).

       For more information, see [Volume parameters](../storage/manage#volume-parameters).

    3. Create an additional disk:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_additional_disk" {
         name             = "<additional_disk_name>"
         parent_id        = "<project_ID>"
         size_gibibytes   = "10"
         type             = "NETWORK_SSD"
         block_size_bytes = 4096
       }
       ```

           <Warning>
             After you create the VM, [mount the additional disks](/compute/storage/use#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks.
           </Warning>

    4. Create the VM:

       ```hcl theme={null}
       resource "nebius_compute_v1_instance" "my_vm" {
         name      = "<VM_name>"
         parent_id = "<project_ID>"
         resources = {
           platform = "<platform>"
           preset   = "<preset>"
         }
         boot_disk = {
           existing_disk = {
             id = nebius_compute_v1_disk.my_boot_disk.id
           }
           attach_mode = "<READ_ONLY|READ_WRITE>"
           device_id = "<user_defined_ID>"
         }
         secondary_disks = [
           {
             existing_disk = {
             id = nebius_compute_v1_disk.my_additional_disk.id
           }
             attach_mode = "<READ_ONLY|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 configuration parameters, see [Create a VM](#create-a-vm).

    5. Check that the configuration is correct:
       ```bash theme={null}
       terraform validate
       ```

    6. Apply the changes:
       ```bash theme={null}
       terraform apply
       ```
  </Tab>
</Tabs>

### Create a VM with a filesystem

<Tabs>
  <Tab title="CLI">
    1. Create a boot disk:

       ```bash theme={null}
       nebius compute disk create \
         --name <boot_disk_name> \
         --size-gibibytes 50 \
         --type network_ssd \
         --source-image-family-image-family ubuntu24.04-cuda13.0 \
         --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](../storage/manage).

    2. Create a filesystem:

       ```bash theme={null}
       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.

           <Warning>
             [Mount filesystems](../storage/use#shared-filesystems) after you create the VM. Otherwise, the filesystems are not attached to the VM.
           </Warning>

    3. Create the VM:

       ```bash theme={null}
       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).
  </Tab>

  <Tab title="Terraform">
    1. [Install and configure](/terraform-provider/quickstart) the Nebius AI Cloud provider for Terraform.

    2. Create a boot disk by using the following configuration:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_boot_disk" {
         name           = "<boot_disk_name>"
         parent_id      = "<project_ID>"
         size_gibibytes = "50"
         type           = "NETWORK_SSD"
         source_image_family = {
           image_family = "ubuntu24.04-cuda13.0"
         }
         block_size_bytes = 4096
       }
       ```

       For `parent_id`, use [Project ID](/iam/manage-projects#terraform-3).

       For more information, see [Volume parameters](../storage/manage#volume-parameters).

    3. Create a filesystem:

       ```hcl theme={null}
       resource "nebius_compute_v1_filesystem" "my_filesystem" {
         name             = "<filesystem_name>"
         parent_id        = "<project_ID>"
         size_gibibytes   = 10
         type             = "NETWORK_SSD"
         block_size_bytes = 4096
       }
       ```

       For more information, see [Volume parameters](../storage/manage#volume-parameters).

           <Warning>
             [Mount filesystems](../storage/use#shared-filesystems) after you create the VM. Otherwise, the filesystems are not attached to the VM.
           </Warning>

    4. Create the VM:

       ```hcl theme={null}
       resource "nebius_compute_v1_instance" "my_vm" {
         name      = "<VM_name>"
         parent_id = "<project_ID>"
         resources = {
           platform = "<platform>"
           preset   = "<preset>"
         }
         boot_disk = {
           existing_disk = {
             id = nebius_compute_v1_disk.my_boot_disk.id
           }
           attach_mode = "<READ_ONLY|READ_WRITE>"
           device_id = "<user_defined_ID>"
         }
         filesystems = [
           {
             existing_filesystem = {
               id = nebius_compute_v1_filesystem.my_filesystem.id
             }
             attach_mode = "<READ_ONLY|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 configuration parameters, see [Create a VM](#create-a-vm).

    5. Check that the configuration is correct:
       ```bash theme={null}
       terraform validate
       ```

    6. Apply the changes:
       ```bash theme={null}
       terraform apply
       ```
  </Tab>
</Tabs>

### 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.

<Tabs group="interfaces">
  <Tab title="CLI">
    1. Create a boot disk:

       ```bash theme={null}
       nebius compute disk create \
         --name <boot_disk_name> \
         --size-gibibytes 50 \
         --type network_ssd \
         --source-image-family-image-family ubuntu24.04-cuda13.0 \
         --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](../storage/manage).

    2. Create a GPU cluster:

       ```bash theme={null}
       nebius compute gpu-cluster create \
         --name <GPU_cluster_name> \
         --infiniband-fabric <fabric>
       ```

       To select the fabric, see [InfiniBand fabrics](../clusters/gpu#infiniband-fabrics).

       Save the cluster ID from the output `metadata.id` parameter.

    3. Create a VM:

       ```bash theme={null}
       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](#create-a-vm).
  </Tab>

  <Tab title="Terraform">
    1. [Install and configure](/terraform-provider/quickstart) the Nebius AI Cloud provider for Terraform.

    2. Create a boot disk by using the following configuration:

       ```hcl theme={null}
       resource "nebius_compute_v1_disk" "my_boot_disk" {
         name           = "<boot_disk_name>"
         parent_id      = "<project_ID>"
         size_gibibytes = "50"
         type           = "NETWORK_SSD"
         source_image_family = {
           image_family = "ubuntu24.04-cuda13.0"
         }
         block_size_bytes = 4096
       }
       ```

       For `parent_id`, use [Project ID](/iam/manage-projects#terraform-3).

       For more information, see [Volume parameters](../storage/manage#volume-parameters).

    3. Create a GPU cluster:

       ```hcl theme={null}
       resource "nebius_compute_v1_gpu_cluster" "my_gpu_cluster" {
         name              = "<GPU_cluster_name>"
         parent_id         = "<project_ID>"
         infiniband_fabric = "<fabric>"
       }
       ```

       To select the fabric, see [InfiniBand fabrics](../clusters/gpu#infiniband-fabrics).

    4. Create a VM:

       ```hcl theme={null}
       resource "nebius_compute_v1_instance" "my_vm" {
         name      = "<VM_name>"
         parent_id = "<project_ID>"
         resources = {
           platform = "<platform>"
           preset   = "<preset>"
         }
         boot_disk = {
           existing_disk = {
             id = nebius_compute_v1_disk.my_boot_disk.id
           }
           attach_mode = "<READ_ONLY|READ_WRITE>"
           device_id = "<user_defined_ID>"
         }
         network_interfaces = [
           {
             name       = "eth0"
             ip_address = {}
             public_ip_address = {}
             subnet_id = "<subnet_ID>"
           }
         ]
         gpu_cluster = {
           id = nebius_compute_v1_gpu_cluster.my_gpu_cluster.id
         }
       }
       ```

       The VM is provided with a dynamic public IPv4 address.

       For more information about the configuration parameters, see [Create a VM](#create-a-vm).

    5. Check that the configuration is correct:
       ```bash theme={null}
       terraform validate
       ```

    6. Apply the changes:
       ```bash theme={null}
       terraform apply
       ```
  </Tab>
</Tabs>

## Creating a VM and disks together

Instead of creating disks separately and then attaching them to a VM, you can create a boot disk or secondary disks together with a VM. To do that, set the disk configuration in the VM creation command. As a result, you simultaneously create both the VM and the disks.

The disks created together with the VM are called *managed disks*, and their lifecycle is tied to the VM: when you delete the VM, all its managed disks are deleted with it in a single operation. This makes managed disks a good fit for ephemeral workloads, for example, training jobs or inference clusters where the VM and its storage should be cleaned up together.

If you need the disk to persist independently after the VM is deleted, for example, to reattach it to another VM or to enable deletion protection, create the disk separately and attach it by ID instead.

<Warning>
  Renaming a managed disk deletes the existing disk and creates a new one with a new name. All data on the disk is permanently lost. To rename a managed disk without data loss, convert it to an unmanaged disk and then rename it.
</Warning>

### Creating a VM and a boot disk together

To create a VM and its boot disk in a single command, use the `--boot-disk-managed-disk-*` parameters instead of `--boot-disk-existing-disk-id`:

```bash theme={null}
nebius compute instance create \
   --name <VM_name> \
   --resources-platform <platform> \
   --resources-preset <preset> \
   --boot-disk-managed-disk-name <boot_disk_name> \
   --boot-disk-managed-disk-type <disk_type> \
   --boot-disk-managed-disk-size-gibibytes <size> \
   --boot-disk-managed-disk-source-image-family-image-family <image_family> \
   --boot-disk-attach-mode READ_WRITE \
   --network-interfaces '[{"name": "eth0", "ip_address": {}, "subnet_id": "<subnet_ID>"}]'
```

The boot disk parameters correspond to the [Volume parameters](/compute/storage/manage#volume-parameters):

* `--boot-disk-managed-disk-name`: Name of the boot disk.
* `--boot-disk-managed-disk-type`: [Disk type](/compute/storage/types#disk-types).
* `--boot-disk-managed-disk-size-gibibytes`: Disk size in GiB. Maximum boot disk size is 30,720 GiB (30 TiB).
* `--boot-disk-managed-disk-source-image-family-image-family`: [Image family](/compute/storage/boot-disk-images#image-family) of the boot disk.
* `--boot-disk-managed-disk-source-image-id` (optional): ID of a [custom disk image](/compute/storage/custom-disk-images). If you have a custom image, use it instead of the image family.
* `--boot-disk-managed-disk-block-size-bytes` (optional): Block size in bytes. Must be a power of two between 4096 (4 KiB) and 131,072 (128 KiB). Default: 4096.
* `--boot-disk-managed-disk-disk-encryption-type` (optional): [Disk encryption](/compute/storage/types#encryption-of-disks). Set the `disk_encryption_managed` value to enable encryption.

For more information about the remaining VM parameters, see [Create a VM](#create-a-vm).

### Creating a VM and secondary disks together

To create secondary disks together with a VM, use the `managed_disk` object instead of the `existing_disk` object in the `--secondary-disks` parameter:

```bash theme={null}
nebius compute instance create \
   --name <VM_name> \
   --resources-platform <platform> \
   --resources-preset <preset> \
   ... \
   --secondary-disks '[
     {
       "attach_mode": "READ_WRITE",
       "device_id": "<user-defined_ID>",
       "managed_disk": {
         "name": "<disk_name>",
         "spec": {
           "type": "<disk_type>",
           "size_gibibytes": <size>
         }
       }
     }
   ]' \
   --network-interfaces '[{"name": "eth0", "ip_address": {}, "subnet_id": "<subnet_ID>"}]'
```

Each element in the `--secondary-disks` array contains the following parameters:

* `attach_mode`: Write permission. `READ_ONLY` or `READ_WRITE`.
* `device_id` (optional): User-defined ID for mounting the disk. You can use `/dev/disk/by-id/virtio-<device_ID>` as a device path.
* `managed_disk`: Specification of the disk to create.

  * `name`: Name of the disk.
  * `spec`: Disk specification.

    * `type`: [Disk type](/compute/storage/types#disk-types).
    * `size_gibibytes`: Disk size in GiB.
    * `source_image_family` (optional): [Image family](/compute/storage/boot-disk-images#image-family) of the disk.
    * `source_image_id` (optional): ID of a [custom disk image](/compute/storage/custom-disk-images). If you have a custom image, use it instead of the image family.
    * `block_size_bytes` (optional): Block size in bytes. Must be a power of two between 4096 (4 KiB) and 131,072 (128 KiB). Default: 4096.
    * `disk_encryption` (optional): [Disk encryption](/compute/storage/types#encryption-of-disks). Set the `disk_encryption_managed` value to enable encryption.

To add multiple disks, set several disk configurations as separate elements in the JSON array, in the `--secondary-disks` parameter. For more information about the remaining VM parameters, see [Create a VM](#create-a-vm).

## "Not enough resources" error

Sometimes, demand for virtual machines and GPUs in certain [Nebius AI Cloud regions](/overview/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](./not-enough-resources).

## See also

* [Private and public IP addresses of Compute virtual machines](./network)
* [InfiniBand™ networking for Compute virtual machines with GPUs](../clusters/gpu)
* [Types of storage volumes in Compute](../storage/types)
* [Creating and resizing Compute volumes](../storage/manage)
* [Attaching and mounting Compute volumes to VMs](../storage/use)

***

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