Creating a VM from a public image
To create a VM:
-
In the management console
, open the folder to create your VM in. -
At the top right, click Create resource.
-
In the list that opens, select Virtual machine instance.
-
Under Basic parameters:
-
Enter the VM name. 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.
-
Select an availability zone to place your VM in.
-
-
Under Image/boot disk selection, select a public image with the software you want to use.
-
(Optional) If you want to add more disks to the VM, select them under Disks by clicking the Disks tab.
-
(Optional) If you want to add more file storages to the VM, add them under Disks and file storages by clicking the File storages tab. Create the storages first.
-
Under Computing resources:
- Choose a platform.
- Specify the guaranteed share and the required number of vCPUs as well as the amount of RAM.
Note
Each public image has its own minimum requirements for a VM. A GitLab image from Cloud Marketplace, for instance, requires at least 4 virtual cores and 8 GB of RAM.
-
Under Network settings:
-
Enter a subnet ID or select a cloud network from the list. You can select the search scope: in the current folder or in all folders. If you do not have a network, click
-
In the window that opens, enter the folder to host the new network, as well as the network name.
-
In the Advanced field, enable Create subnets (each network must have at least one subnet).
-
Click Create.
-
-
In the Public IP field, choose a method for assigning an IP address:
Auto
: Assign a random IP address from the Nebius Israel IP pool.List
: Select a public IP address from the list of previously reserved static addresses. For more information, see Converting a dynamic public IP address to static.No address
: Do not assign a public IP address.
-
Select the appropriate security groups in the Security groups field (if there is no such field, the VM will be enabled for all incoming and outgoing traffic).
-
-
Under Access, specify the information required to access the instance:
- (Optional) Select or create a service account. With a service account, you can flexibly configure access rights for your resources.
- Enter username in the Login field.
- In the SSH key field, paste the contents of the public key file.
- (Optional) Enable access to the serial console in the Advanced field, if required.
In public Linux images provided by Nebius Israel, the functionality of connecting over SSH using login and password is disabled by default.
-
Click Create VM.
VM creation takes several minutes. When the VM status changes to RUNNING
, proceed to configuring software. You can monitor VM statuses on the list of VMs in the folder.
If you don't have the Nebius Israel 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:
yc compute instance create --help
-
Prepare the key pair (public and private keys) for SSH access to the VM.
-
Select one of the Cloud Marketplace public images.
You can view image IDs in the management console
when creating a VM or in Cloud Marketplace on the image page under Product IDs.To get a list of available images using the Nebius Israel CLI, run this command:
yc compute image list --folder-id standard-images
Result:
+----------------------+-------------------------------------+--------------------------+----------------------+--------+ | ID | NAME | FAMILY | PRODUCT IDS | STATUS | +----------------------+-------------------------------------+--------------------------+----------------------+--------+ ... | fdvk34al8k5n******** | centos-7-1549279494 | centos-7 | dqni65lfhvv2den5gtv9 | READY | | fdv7ooobjfl3******** | windows-2016-gvlk-1548913814 | windows-2016-gvlk | dqnnc72gj2ist3ktjj1p | READY | | fdv4f5kv5cvf******** | ubuntu-1604-lts-1549457823 | ubuntu-1604-lts | dqnnb6dc7640c5i968ro | READY | ... +----------------------+-------------------------------------+--------------------------+----------------------+--------+
-
Select a subnet:
yc vpc subnet list
Result:
+----------------------+---------------------------+----------------------+----------------+-------------------+-----------------+ | ID | NAME | NETWORK ID | ROUTE TABLE ID | ZONE | RANGE | +----------------------+---------------------------+----------------------+----------------+-------------------+-----------------+ | b0c6n43f9lgh3695v2k2 | default-il1-a | enpe3m3fa00udao8g5lg | | il1-a | [10.130.0.0/24] | | e2l2da8a20b33g7o73bv | default-il1-b | enpe3m3fa00udao8g5lg | | il1-b | [10.129.0.0/24] | | e9bnlm18l70ao30pvfaa | default-il1-c | enpe3m3fa00udao8g5lg | | il1-c | [10.128.0.0/24] | +----------------------+---------------------------+----------------------+----------------+-------------------+-----------------+
-
Create a VM in the default folder:
yc compute instance create \ --name first-instance \ --zone il1-a \ --network-interface subnet-name=default-il1-a,nat-ip-version=ipv4 \ --create-boot-disk image-folder-id=standard-images,image-family=centos-7 \ --ssh-key ~/.ssh/id_ed25519.pub
Where:
-
name
: VM name.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.
-
zone
: Availability zone that corresponds to the selected subnet. -
subnet-name
: Name of the selected subnet. -
image-family
: Image family, such ascentos-7
. This option allows you to install the latest version of the operating system from the specified family. -
nat-ip-version=ipv4
: Public IP address. To create a VM without a public IP address, disable this parameter. -
ssh-key
: Path to the public SSH key. The VM will automatically create a user namedyc-user
for this key.
Note
If you are using the CLI version 0.92.0 or lower, then in the command, you must also specify the VM platform:
--platform standard-v3
. You can find out the CLI version using theyc version
command and install the latest version using theyc components update
command.Note
If you are using the CLI version 0.92.0 or lower, then in the command, you must also specify the VM platform:
--platform standard-v3
. You can find out the CLI version using theyc version
command and install the latest version using theyc components update
command.Note
If you are using the CLI version 0.92.0 or lower, then in the command, you must also specify the VM platform:
--platform standard-v3
. You can find out the CLI version using theyc version
command and install the latest version using theyc components update
command. -
Once you are done, all the resources you need will be created in the specified folder. You can verify that the resources are there and their configuration is correct using the management console
yc compute instance list
When a VM is created, it is assigned an IP address and hostname (FQDN). This data can be used for SSH access.
You can make a public IP address static. For more information, see Making a VM's public IP address static.
If you do not have Terraform yet, install it and configure the provider Nebius Israel.
-
In the configuration file, describe the parameters of the resources you want to create:
resource "yandex_compute_instance" "linux-vm" { name = "linux-vm" platform_id = "standard-v3" zone = "<availability_zone>" resources { cores = "<number_of_vCPU_cores>" memory = "<GB_of_RAM>" } boot_disk { initialize_params { image_id = "<image_ID" } } network_interface { subnet_id = yandex_vpc_subnet.subnet-1.id nat = true } metadata = { user-data = "#cloud-config\nusers:\n - name: <username>\n groups: sudo\n shell: /bin/bash\n sudo: 'ALL=(ALL) NOPASSWD:ALL'\n ssh-authorized-keys:\n - ${file("<path_to_public_SSH_key>")}" } } resource "yandex_vpc_network" "network-1" { name = "network1" } resource "yandex_vpc_subnet" "subnet-1" { name = "subnet1" zone = "<availability_zone>" v4_cidr_blocks = ["192.168.10.0/24"] network_id = yandex_vpc_network.network-1.id }
Where:
yandex_compute_instance
: Description of the VM:-
name
: VM name. -
platform_id
: Platform. -
zone
: ID of the availability zone that will host your VM. -
resources
: Number of vCPU cores and the amount of RAM available to the VM. The values must match the selected platform. -
boot_disk
: Boot disk settings. Specify the ID of the selected image. You can get the image ID from the list of public images.You can view image IDs in the management console
when creating a VM or in Cloud Marketplace on the image page under Product IDs. -
network_interface
: Network settings. Specify the ID of the selected subnet. To automatically assign a public IP address to the VM, setnat = true
. -
metadata
: In the metadata, provide the username and public key for accessing the VM via SSH. For more information, see VM metadata.
-
yandex_vpc_network
: Description of the cloud network.yandex_vpc_subnet
: Description of the subnet your VM will connect to.
Note
If you already have suitable resources, such as a cloud network and subnet, you do not need to describe them again. Use their names and IDs in the appropriate parameters.
For more information about the resources that you can create using Terraform, see the provider documentation
. -
Make sure the configuration files are valid.
-
In the command line, go to the directory where you created the configuration file.
-
Run a check using this command:
terraform plan
If the configuration is described correctly, the terminal will display a list of created resources and their parameters. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm creating the resources: type
yes
in the terminal and press Enter.
Once you are done, all the resources you need will be created in the specified folder. You can verify that the resources are there and their configuration is correct using the management console
or the following CLI command:yc compute instance list
-
When a VM is created, it is assigned an IP address and hostname (FQDN). This data can be used for SSH access.
You can make a public IP address static. For more information, see Making a VM's public IP address static.