Creating a VM from a set of disks
You can create a VM from existing disks. Make sure the disks reside in one of the availability zones and are not added to other VMs.
When you select a disk to attach to a VM, you can specify whether that disk should be deleted when deleting the VM. You can choose this option when creating a VM, updating it, or attaching a new disk to it.
-
In the list of services in the management console
, select Compute Cloud. -
At the top right, click Create VM.
-
Under Basic parameters:
-
Enter a name for the VM. The naming requirements are as follows:
- The length can be from 3 to 63 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter. The last character can't be a hyphen.
Note
The VM name is used to generate an internal FQDN only once: when creating a VM. If the internal FQDN is important to you, choose an appropriate name for the VM at the creation stage.
-
Select an availability zone to place your VM in.
-
-
Under Image/boot disk selection, select an image.
-
Under Disks, add a disk:
-
Click Add disk.
-
Enter the disk name.
-
Select the disk type.
-
Specify the desired disk size.
-
(Optional) Enable the Delete with the VM option if you need to automatically delete the disk when deleting the VM it will be attached to.
-
Select
Disk
as content. -
Click Add.
-
-
(Optional) Under Disks and file storages, select the File storages tab and attach the file storage:
- Click Attach file storage.
- In the window that opens, select a file store.
- Enter the device name.
- Click Attach file storage.
-
Under Computing resources:
- Choose a platform.
- Specify the required number of vCPUs, as well as the amount of RAM.
-
Under Network settings:
- (Optional) Select the Public IP checkbox to assign the VM a public IP address.
-
Under Access, specify the information required to access the instance:
-
Enter username in the Login field.
Alert
Do not use the
root
username or other names reserved by the operating system. To perform operations that require superuser permissions, use thesudo
command. -
In the SSH key field, paste the contents of the public key file.
In public Linux images provided by Nebius AI, the functionality of connecting over SSH using login and password is disabled by default.
-
-
Click Create VM.
The VM appears in the list. Once created, the VM is assigned an IP address and a host name (FQDN).
If you don't have the Nebius AI command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
View a description of the CLI create VM command:
ncp compute instance create --help
-
Get a list of disks::
ncp compute disk list
Result:
+----------------------+--------------+-------------+-----------------+--------+----------------------+-----------------+ | ID | NAME | SIZE | ZONE | STATUS | INSTANCE IDS | PLACEMENT GROUP | +----------------------+--------------+-------------+-----------------+--------+----------------------+-----------------+ | a7lqgbt0bb9s******** | first-disk | 20401094656 | eu-north1-c | READY | a7lcvu28njbh******** | | | a7lv5j5hm1p1******** | second-disk | 21474836480 | eu-north1-c | READY | | | +----------------------+--------------+-------------+-----------------+--------+----------------------+-----------------+
-
Select the identifier (
ID
) or name (NAME
) of the necessary disks. -
Create a VM:
ncp compute instance create \ --name first-instance \ --zone eu-north1-c \ --network-interface subnet-name=default-eu-north1-c,nat-ip-version=ipv4 \ --use-boot-disk disk-name=first-disk \ --attach-disk disk-name=second-disk \ --ssh-key ~/.ssh/id_ed25519.pub
This command creates the VM:
-
Named
first-instance
.Note
The VM name is used to generate an internal FQDN only once: when creating a VM. If the internal FQDN is important to you, choose an appropriate name for the VM at the creation stage.
-
With a public IP address and two disks.
To specify whether to delete the disk when deleting the VM, set the
--auto-delete
flag:ncp compute instance create \ --name first-instance \ --zone eu-north1-c \ --network-interface subnet-name=default-eu-north1-c,nat-ip-version=ipv4 \ --use-boot-disk disk-name=first-disk,auto-delete=yes \ --attach-disk disk-name=second-disk,auto-delete=yes \ --ssh-key ~/.ssh/id_ed25519.pub
-