## Compute ### Virtual machines # Compute Source: https://docs.nebius.com/compute/index.md Compute allows you to create and manage virtual machines (VMs). These VMs function similarly to your local machine but are hosted in the cloud. You can connect to them and use their GPUs and other computing resources in your ML/AI workloads. In the [web console](https://console.nebius.com), the **Virtual machines** page has two tabs: * **Standalone VMs** * **Kubernetes nodes** The service is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* > [card] [Getting started](https://docs.nebius.com/compute/quickstart.md) > > Create your first set of VMs and connect to them > [card] [Types of virtual machines](https://docs.nebius.com/compute/virtual-machines/types.md) > > Learn about VM configurations > [card] [Creating virtual machines](https://docs.nebius.com/compute/virtual-machines/create.md) > > Learn how to create different types of VMs > [card] [Connecting to virtual machines](https://docs.nebius.com/compute/virtual-machines/connect.md) > > Learn how to connect to VMs using SSH and allow other users to access VMs > [card] [Interconnecting GPUs on VMs with InfiniBand™](https://docs.nebius.com/compute/clusters/gpu.md) > > Create a GPU cluster and add VMs to it to interconnect them with InfiniBand > [card] [Testing InfiniBand connection](https://docs.nebius.com/compute/clusters/gpu/test.md) > > Learn how to run tests to check the InfiniBand network state and performance > [card] [Types of storage volumes](https://docs.nebius.com/compute/storage/types.md) > > Choose a storage option for your VMs that fits your goals best > [card] [Managing volumes](https://docs.nebius.com/compute/storage/manage.md) > > Manage and configure disks and shared filesystems > [card] [Attaching and mounting volumes to VMs](https://docs.nebius.com/compute/storage/use.md) > > Use volumes that you created on VMs > [card] [Monitoring VMs](https://docs.nebius.com/compute/monitoring/virtual-machines.md) > > Control GPU and vCPU states of your VMs > [card] [Monitoring volumes](https://docs.nebius.com/compute/monitoring/volumes.md) > > Control disks and filesystems states # Getting started with Compute: Create your first Nebius AI Cloud virtual machine Source: https://docs.nebius.com/compute/quickstart.md To set up infrastructure for ML workloads, create the following resources in the `eu-north1` region: * Virtual machine (VM) with eight GPUs and a shared filesystem for training * Virtual machine with one GPU for inference Then, connect to them. ## Prerequisites > [tab] Web console > > Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > * Install [jq](https://jqlang.github.io/jq/) to extract IDs from JSON data returned by the Nebius AI Cloud CLI: > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > > * Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] Terraform > > * [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > * Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > * Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > * Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > * Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). ## Create a VM with eight GPUs with InfiniBand™ and a shared filesystem for training > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. On the **Compute** step, configure computing resources: > > 1. In the **Platform** section, select **With GPUs** and **Regular**. Then, select a [platform](https://docs.nebius.com/compute/virtual-machines/types.md) with NVIDIA® H100, H200, or B200 GPUs. Only these platforms support GPU clusters. > > 2. In the **Settings** section, select a **Preset** with 8 GPUs. > > 3. Create a GPU cluster for the VM. InfiniBand in the GPU cluster interconnects the VM GPUs for high-speed networking and efficient training. > > To use a GPU cluster, select an existing one or create a new cluster: > > 1. Click  **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](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > 3. Click **Create**. > > 4. In the same section, select the **Project** for the VM location and specify the **VM name**. > > 4. On the **Storage** step, configure the boot disk and attach a shared filesystem: > > 1. In the **Boot disk** section, click  next to the boot disk. In the window that opens, keep **New VM-managed disk** selected, choose an Ubuntu [operating system](https://docs.nebius.com/compute/storage/boot-disk-images.md#images-for-gpu-vms) with pre-installed NVIDIA® GPU drivers, set the size to 50 GiB, and click **Save**. > > 2. In the **Shared filesystems** section, click  **Attach shared filesystem**. > > 3. In the window that opens, create a new filesystem: specify its name, set the size to 50 GiB and the block size to 4 KiB. Click **Attach filesystem**. > > 4. After the window is closed, in the **Mount tag** field, specify a tag for mounting the filesystem to the VM. > > Create your own tag, such as `my-filesystem`. Make sure that it's unique within the VM. > > 5. To mount the filesystem to the VM automatically, keep the **Auto mount** option enabled. > > 5. On the **Network** step, select the **Network** and **Subnet**. In the **Public IP address** field, select **Auto (dynamic)**, so you can later connect to the VM by SSH. > > 6. On the **Configuration** step, in the **Access** section, add credentials so you can connect to the VM: > > 1. In the **Username and SSH key** field, click  **Create**. > 2. 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. > 3. Click **Add credentials**. > > 7. On the **Review** step, check the full VM configuration. To change a section quickly, click  next to the corresponding block. The wizard opens the relevant step with your current settings. > > Then, click **Create VM**. > > For more information about the wizard settings, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] CLI > > 1. Create a shared filesystem and save its ID to an environment variable: > > ```bash > export TR_VM_FILESYSTEM_ID=$(nebius compute filesystem create \ > --name training-vm-filesystem-1 \ > --size-gibibytes 50 \ > --type network_ssd \ > --block-size-bytes 4096 \ > --format jsonpath='{.metadata.id}') > ``` > > The command creates a 50 GiB SSD shared filesystem with 4 KiB blocks. > > 2. Get the subnet ID and save it to an environment variable: > > ```bash > export SUBNET_ID=$(nebius vpc subnet list \ > --format jsonpath='{.items[0].metadata.id}') > ``` > > Possible subnet ID: `vpcsubnet-***`. > > 3. For high-speed networking and efficient training, consider interconnecting the GPUs of multiple VMs in a GPU cluster by using InfiniBand. To do this, before creating the VM, create a GPU cluster to connect the VM and get its ID: > > ```bash > export GPU_CLUSTER_ID=$(nebius compute gpu-cluster create \ > --name gpu-cluster-name \ > --infiniband-fabric fabric-3 \ > --format jsonpath='{.metadata.id}') > ``` > > 4. Create a VM with 8 GPUs for training: > > ```bash > export USER_DATA=$(jq -Rrs '.' < #cloud-config > users: > - name: user > sudo: ALL=(ALL) NOPASSWD:ALL > shell: /bin/bash > ssh_authorized_keys: > - $(cat ~/.ssh/id_ed25519.pub) > EOF > ) > > export TR_VM_ID=$(nebius compute instance create \ > --name training-vm \ > --resources-platform gpu-h100-sxm \ > --resources-preset 8gpu-128vcpu-1600gb \ > --boot-disk-managed-disk-name training-vm-disk-1 \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 50 \ > --boot-disk-managed-disk-block-size-bytes 4096 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-cuda13.0 \ > --boot-disk-attach-mode READ_WRITE \ > --cloud-init-user-data "$USER_DATA" \ > --filesystems "[{\"existing_filesystem\": {\"id\": \"$TR_VM_FILESYSTEM_ID\"}, \"attach_mode\": \"READ_WRITE\", \"mount_tag\": \"training-vm-filesystem-1\"}]" \ > --network-interfaces "[{\"name\": \"eth0\", \"subnet_id\": \"$SUBNET_ID\", \"ip_address\": {}, \"public_ip_address\": {}}]" \ > --gpu-cluster-id "$GPU_CLUSTER_ID" \ > --format jsonpath='{.metadata.id}') > ``` > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Terraform > > 1. Create a boot disk: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "training-vm-disk-1" > parent_id = "" > type = "NETWORK_SSD" > size_gibibytes = 50 > block_size_bytes = 4096 > source_image_family = { > image_family = "ubuntu24.04-cuda13.0" > } > } > ``` > > The file contains the following parameters: > > * `name`: Disk name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the disk is created. > * `type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `size_gibibytes`: Disk size in gibibytes. > * `block_size_bytes`: Block size in bytes. > * `source_image_family.image_family`: Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > The configuration creates a 50 GiB SSD disk with a 4 KiB block size. For the full resource reference, see [nebius\_compute\_v1\_disk](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md). > > 2. Create a shared filesystem: > > ```hcl > resource "nebius_compute_v1_filesystem" "" { > name = "training-vm-filesystem-1" > parent_id = "" > type = "NETWORK_SSD" > size_gibibytes = 50 > block_size_bytes = 4096 > } > ``` > > The configuration creates a 50 GiB SSD shared filesystem with 4 KiB blocks. The `name`, `parent_id`, `type`, `size_gibibytes`, and `block_size_bytes` parameters have the same meaning as for the disk. For the full resource reference, see [nebius\_compute\_v1\_filesystem](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_filesystem.md). > > 3. For high-speed networking and efficient training, consider interconnecting the GPUs of multiple VMs in a GPU cluster by using InfiniBand. To do this, create a GPU cluster to connect the VM: > > ```hcl > resource "nebius_compute_v1_gpu_cluster" "" { > name = "gpu-cluster-name" > parent_id = "" > infiniband_fabric = "fabric-3" > } > ``` > > The file contains the following parameters: > > * `name`: Cluster name. > * `parent_id`: ID of the project where the cluster is created. > * `infiniband_fabric`: [InfiniBand™ fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics) for the cluster. Select it depending on the region and GPU platform. > > For the full resource reference, see [nebius\_compute\_v1\_gpu\_cluster](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_gpu_cluster.md). > > 4. Create a user data configuration that adds a user with your SSH public key, and assign it to the `user_data` Terraform variable. For instructions, see [Create a user data configuration](https://docs.nebius.com/compute/virtual-machines/create.md#optional-create-a-user-data-configuration-terraform). > > 5. Create a VM with 8 GPUs for training: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "training-vm" > parent_id = "" > resources = { > platform = "gpu-h100-sxm" > preset = "8gpu-128vcpu-1600gb" > } > gpu_cluster = { > id = nebius_compute_v1_gpu_cluster..id > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = nebius_compute_v1_disk..id > } > } > filesystems = [ > { > attach_mode = "READ_WRITE" > mount_tag = "training-vm-filesystem-1" > existing_filesystem = { > id = nebius_compute_v1_filesystem..id > } > } > ] > cloud_init_user_data = var.user_data > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > The file contains the following parameters: > > * `name`: VM name. > > * `parent_id`: ID of the project where the VM is created. Use the same project as for the GPU cluster. > > * `resources.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `resources.preset`: VM preset with 8 GPUs. Depends on the chosen platform. > > * `gpu_cluster.id`: ID of the GPU cluster created earlier. > > * `boot_disk.existing_disk.id`: ID of the boot disk created earlier. > > * `boot_disk.attach_mode`: Write permission of the boot disk. The only supported value is `READ_WRITE`. > > * `filesystems`: Settings of the shared filesystem attached to the VM: > > * `existing_filesystem.id`: ID of the filesystem created earlier. > * `attach_mode`: Write permission of the filesystem. The only supported value is `READ_WRITE`. > * `mount_tag`: Tag for mounting the filesystem to the VM. Make sure that it's unique within the VM. > > * `cloud_init_user_data`: Configuration of VM users in the [cloud-init](https://cloud-init.io/) format. It's taken from the `user_data` variable. > > * `network_interfaces`: Network settings: > > * `name`: Name of the network interface. > * `subnet_id`: [ID of the subnet](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) that the VM is connected to. > * `ip_address`: Set to `{}` to assign a private IP address automatically. > * `public_ip_address`: Set to `{}` to assign a dynamic public IP address, so you can later connect to the VM by SSH. > > The given example assumes that you work with VMs that have public addresses, so you can later [connect to these VMs by SSH](https://docs.nebius.com/compute/quickstart.md#connect-to-the-vms-terraform). However, if you need isolated VMs without public addresses, remove `public_ip_address` from `network_interfaces`. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > > 6. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 7. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Create a boot disk: > > ```go > trainingDiskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "training-vm-disk-1", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 50, > }, > BlockSizeBytes: 4096, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = trainingDiskOperation.Wait(ctx); err != nil { > return err > } > trainingBootDiskID := trainingDiskOperation.ResourceID() > ``` > > The code creates a 50 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Create a shared filesystem: > > ```go > trainingFSOperation, err := sdk.Services().Compute().V1(). > Filesystem().Create( > ctx, > &compute.CreateFilesystemRequest{ > Metadata: &common.ResourceMetadata{ > Name: "training-vm-filesystem-1", > }, > Spec: &compute.FilesystemSpec{ > Size: &compute.FilesystemSpec_SizeGibibytes{ > SizeGibibytes: 50, > }, > BlockSizeBytes: 4096, > Type: compute.FilesystemSpec_NETWORK_SSD, > }, > }, > ) > if err != nil { > return err > } > if _, err = trainingFSOperation.Wait(ctx); err != nil { > return err > } > trainingFilesystemID := trainingFSOperation.ResourceID() > ``` > > The code creates a 50 GiB SSD shared filesystem with 4 KiB blocks. > > 3. Get the subnet ID: > > ```go > subnets, err := sdk.Services().VPC().V1(). > Subnet().List( > ctx, > &vpc.ListSubnetsRequest{}, > ) > if err != nil { > return err > } > if len(subnets.GetItems()) == 0 { > return errors.New("no subnets found") > } > subnetID := subnets.GetItems()[0].GetMetadata().GetId() > ``` > > Possible subnet ID: `vpcsubnet-e0dcbaa76x2024xyz8`. > > 4. For high-speed networking and efficient training, consider interconnecting the GPUs of multiple VMs in a GPU cluster by using InfiniBand™. To do this, before creating the VM, create a GPU cluster to connect the VM and get its ID: > > ```go > gpuClusterOperation, err := sdk.Services().Compute().V1(). > GpuCluster().Create( > ctx, > &compute.CreateGpuClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "gpu-cluster-name", > }, > Spec: &compute.GpuClusterSpec{ > InfinibandFabric: "fabric-3", > }, > }, > ) > if err != nil { > return err > } > if _, err = gpuClusterOperation.Wait(ctx); err != nil { > return err > } > gpuClusterID := gpuClusterOperation.ResourceID() > ``` > > 5. Create a VM with 8 GPUs for training: > > ```go > var gpuCluster *compute.InstanceGpuClusterSpec > if gpuClusterID != "" { > gpuCluster = &compute.InstanceGpuClusterSpec{ > Id: gpuClusterID, > } > } > trainingNetworkName := > "multi-gpu-node-compute-api-" + > "network-interface" > trainingResources := &compute.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &compute.ResourcesSpec_Preset{ > Preset: "8gpu-128vcpu-1600gb", > }, > } > trainingBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: trainingBootDiskID, > }, > }, > } > trainingExistingFS := &compute.ExistingFilesystem{ > Id: trainingFilesystemID, > } > trainingFilesystem := &compute.AttachedFilesystemSpec{ > AttachMode: compute.AttachedFilesystemSpec_READ_WRITE, > MountTag: "training-vm-filesystem-1", > Type: &compute.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: trainingExistingFS, > }, > } > trainingNetwork := &compute.NetworkInterfaceSpec{ > Name: trainingNetworkName, > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > trainingSpec := &compute.InstanceSpec{ > Resources: trainingResources, > GpuCluster: gpuCluster, > BootDisk: trainingBootDisk, > Filesystems: []*compute.AttachedFilesystemSpec{ > trainingFilesystem, > }, > CloudInitUserData: userData, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > trainingNetwork, > }, > } > trainingVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "training-vm", > }, > Spec: trainingSpec, > }, > ) > if err != nil { > return err > } > if _, err = trainingVMOperation.Wait(ctx); err != nil { > return err > } > trainingVMID := trainingVMOperation.ResourceID() > ``` > > The given example assumes that you work with VMs that have public addresses, so you can later [connect to these VMs by SSH](https://docs.nebius.com/compute/quickstart.md#connect-to-the-vms-go-sdk). However, if you need isolated VMs without public addresses, do not set `PublicIpAddress` in the network interface specification. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Python SDK > > 1. Create a boot disk: > > ```python > disk_service = DiskServiceClient(sdk) > training_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="training-vm-disk-1", > ), > spec=DiskSpec( > block_size_bytes=4096, > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ), > size_gibibytes=50, > ), > ), > ) > await training_disk_operation.wait() > training_boot_disk_id = training_disk_operation.resource_id > ``` > > The code creates a 50 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Create a shared filesystem: > > ```python > filesystem_service = FilesystemServiceClient(sdk) > training_fs_operation = await filesystem_service.create( > CreateFilesystemRequest( > metadata=ResourceMetadata( > name="training-vm-filesystem-1", > ), > spec=FilesystemSpec( > block_size_bytes=4096, > type=FilesystemSpec.FilesystemType.NETWORK_SSD, > size_gibibytes=50, > ), > ), > ) > await training_fs_operation.wait() > training_filesystem_id = training_fs_operation.resource_id > ``` > > The code creates a 50 GiB SSD shared filesystem with 4 KiB blocks. > > 3. Get the subnet ID: > > ```python > subnet_service = SubnetServiceClient(sdk) > subnets = await subnet_service.list(ListSubnetsRequest()) > if not subnets.items: > raise ValueError("no subnets found") > subnet_id = subnets.items[0].metadata.id > ``` > > Possible subnet ID: `vpcsubnet-e0dcbaa76x2024xyz8`. > > 4. For high-speed networking and efficient training, consider interconnecting the GPUs of multiple VMs in a GPU cluster by using InfiniBand™. To do this, before creating the VM, create a GPU cluster to connect the VM and get its ID: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > gpu_cluster_operation = await gpu_cluster_service.create( > CreateGpuClusterRequest( > metadata=ResourceMetadata( > name="gpu-cluster-name", > ), > spec=GpuClusterSpec( > infiniband_fabric="fabric-3", > ), > ), > ) > await gpu_cluster_operation.wait() > gpu_cluster_id = gpu_cluster_operation.resource_id > ``` > > 5. Create a VM with 8 GPUs for training: > > ```python > gpu_cluster = None > if gpu_cluster_id: > gpu_cluster = InstanceGpuClusterSpec(id=gpu_cluster_id) > training_network_name = ( > "multi-gpu-node-compute-api-" > "network-interface" > ) > instance_service = InstanceServiceClient(sdk) > training_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="training-vm"), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="8gpu-128vcpu-1600gb", > ), > gpu_cluster=gpu_cluster, > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk( > id=training_boot_disk_id, > ), > ), > filesystems=[ > AttachedFilesystemSpec( > attach_mode=( > AttachedFilesystemSpec.AttachMode.READ_WRITE > ), > existing_filesystem=ExistingFilesystem( > id=training_filesystem_id, > ), > mount_tag="training-vm-filesystem-1", > ), > ], > cloud_init_user_data=user_data, > network_interfaces=[ > NetworkInterfaceSpec( > name=training_network_name, > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await training_vm_operation.wait() > training_vm_id = training_vm_operation.resource_id > ``` > > The given example assumes that you work with VMs that have public addresses, so you can later [connect to these VMs by SSH](https://docs.nebius.com/compute/quickstart.md#connect-to-the-vms-python-sdk). However, if you need isolated VMs without public addresses, do not set `public_ip_address` in the network interface specification. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] JavaScript SDK > > 1. Create a boot disk: > > ```ts > const diskService = new DiskService(sdk); > const trainingDiskOperation = await diskService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "training-vm-disk-1", > }), > spec: DiskSpec.create({ > blockSizeBytes: 4096, > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 50, > }, > }), > }), > ).result; > await trainingDiskOperation.wait(); > const trainingBootDiskId = trainingDiskOperation.resourceId(); > ``` > > The code creates a 50 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Create a shared filesystem: > > ```ts > const filesystemService = new FilesystemService(sdk); > const trainingFsOperation = await filesystemService.create( > CreateFilesystemRequest.create({ > metadata: ResourceMetadata.create({ > name: "training-vm-filesystem-1", > }), > spec: FilesystemSpec.create({ > blockSizeBytes: 4096, > type: FilesystemSpec_FilesystemType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 1024, > }, > }), > }), > ).result; > await trainingFsOperation.wait(); > const trainingFilesystemId = > trainingFsOperation.resourceId(); > ``` > > The code creates a 50 GiB SSD shared filesystem with 4 KiB blocks. > > 3. Get the subnet ID: > > ```ts > const subnetService = new SubnetService(sdk); > const subnets = await subnetService.list( > ListSubnetsRequest.create({}), > ); > const subnetId = subnets.items[0]?.metadata?.id; > if (!subnetId) { > throw new Error("no subnets found"); > } > ``` > > Possible subnet ID: `vpcsubnet-e0dcbaa76x2024xyz8`. > > 4. For high-speed networking and efficient training, consider interconnecting the GPUs of multiple VMs in a GPU cluster by using InfiniBand™. To do this, before creating the VM, create a GPU cluster to connect the VM and get its ID: > > ```ts > const gpuClusterService = new GpuClusterService(sdk); > const gpuClusterOperation = await gpuClusterService.create( > CreateGpuClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "gpu-cluster-name", > }), > spec: GpuClusterSpec.create({ > infinibandFabric: "fabric-3", > }), > }), > ).result; > await gpuClusterOperation.wait(); > let gpuClusterId = gpuClusterOperation.resourceId(); > ``` > > 5. Create a VM with 8 GPUs for training: > > ```ts > const gpuCluster = gpuClusterId > ? InstanceGpuClusterSpec.create({ id: gpuClusterId }) > : undefined; > const trainingNetworkName = > "multi-gpu-node-compute-api-" + > "network-interface"; > const instanceService = new InstanceService(sdk); > const trainingVmOperation = await instanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "training-vm", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "8gpu-128vcpu-1600gb", > }, > }), > gpuCluster, > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: trainingBootDiskId, > }), > }, > }), > filesystems: [ > AttachedFilesystemSpec.create({ > attachMode: > AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "training-vm-filesystem-1", > type: { > $case: "existingFilesystem", > existingFilesystem: > ExistingFilesystem.create({ > id: trainingFilesystemId, > }), > }, > }), > ], > cloudInitUserData: userData, > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: trainingNetworkName, > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await trainingVmOperation.wait(); > const trainingVmId = trainingVmOperation.resourceId(); > ``` > > The given example assumes that you work with VMs that have public addresses, so you can later [connect to these VMs by SSH](https://docs.nebius.com/compute/quickstart.md#connect-to-the-vms-javascript-sdk). However, if you need isolated VMs without public addresses, do not set `publicIpAddress` in the network interface specification. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). ## Create a VM with one GPU for inference > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > 3. On the **Compute** step, configure computing resources: > > 1. In the **Platform** section, select **With GPUs** and **Regular**. Then, select any [GPU platform](https://docs.nebius.com/compute/virtual-machines/types.md). > 2. In the **Settings** section, select a **Preset** with one GPU and the **Project** for the VM location, and specify the **VM name**. > > 4. On the **Storage** step, in the **Boot disk** section, click  next to the boot disk. In the window that opens, keep **New VM-managed disk** selected, choose an Ubuntu operating system with pre-installed NVIDIA® GPU drivers, set the size to 50 GiB, and click **Save**. > > 5. On the **Network** step, select the **Network** and **Subnet**. In the **Public IP address** field, select **Auto (dynamic)**, so you can later connect to the VM by SSH. > > 6. On the **Configuration** step, in the **Access** section, add the same username and SSH public key that you used for the VM with eight GPUs. > > 7. On the **Review** step, check the full VM configuration and click **Create VM**. > [tab] CLI > > Create a VM with one GPU for inference: > > ```bash > export INF_VM_ID=$(nebius compute instance create \ > --name inference-vm \ > --resources-platform gpu-h100-sxm \ > --resources-preset 1gpu-16vcpu-200gb \ > --boot-disk-managed-disk-name inference-vm-disk-1 \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 50 \ > --boot-disk-managed-disk-block-size-bytes 4096 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-cuda13.0 \ > --boot-disk-attach-mode READ_WRITE \ > --cloud-init-user-data "$USER_DATA" \ > --network-interfaces "[{\"name\": \"eth0\", \"subnet_id\": \"$SUBNET_ID\", \"ip_address\": {}, \"public_ip_address\": {}}]" \ > --format jsonpath='{.metadata.id}') > ``` > > The command creates the VM with a boot disk that has the same settings as the boot disk of the training VM. It uses the same `USER_DATA` variable and cloud-init configuration as the training VM. > [tab] Terraform > > 1. Create a boot disk: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "inference-vm-disk-1" > parent_id = "" > type = "NETWORK_SSD" > size_gibibytes = 50 > block_size_bytes = 4096 > source_image_family = { > image_family = "ubuntu24.04-cuda13.0" > } > } > ``` > > The disk has the same settings as the boot disk of the training VM. Give the resource a label that differs from the label of the training disk. > > 2. Create a VM with one GPU for inference: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "inference-vm" > parent_id = "" > resources = { > platform = "gpu-h100-sxm" > preset = "1gpu-16vcpu-200gb" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = nebius_compute_v1_disk..id > } > } > cloud_init_user_data = var.user_data > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > Give the resource a label that differs from the label of the training VM, and in `boot_disk.existing_disk.id`, reference the disk that you created in the previous step. The VM uses the same `user_data` variable and cloud-init configuration as the training VM. For the meaning of other parameters, see the [training VM configuration](https://docs.nebius.com/compute/quickstart.md#create-a-vm-with-eight-gpus-with-infiniband-and-a-shared-filesystem-for-training-terraform). > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Create a boot disk: > > ```go > inferenceDiskOperation, err := > sdk.Services().Compute().V1().Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "inference-vm-disk-1", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 50, > }, > BlockSizeBytes: 4096, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = inferenceDiskOperation.Wait(ctx); err != nil { > return err > } > inferenceBootDiskID := inferenceDiskOperation.ResourceID() > ``` > > The code creates a 50 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Create a VM with one GPU for inference: > > ```go > inferenceNetworkName := > "single-gpu-node-compute-api-" + > "network-interface" > inferenceResources := &compute.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &compute.ResourcesSpec_Preset{ > Preset: "1gpu-16vcpu-200gb", > }, > } > inferenceBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: inferenceBootDiskID, > }, > }, > } > inferenceNetwork := &compute.NetworkInterfaceSpec{ > Name: inferenceNetworkName, > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > inferenceSpec := &compute.InstanceSpec{ > Resources: inferenceResources, > BootDisk: inferenceBootDisk, > CloudInitUserData: userData, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > inferenceNetwork, > }, > } > inferenceVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "inference-vm", > }, > Spec: inferenceSpec, > }, > ) > if err != nil { > return err > } > if _, err = inferenceVMOperation.Wait(ctx); err != nil { > return err > } > inferenceVMID := inferenceVMOperation.ResourceID() > ``` > [tab] Python SDK > > 1. Create a boot disk: > > ```python > inference_disk_service = DiskServiceClient(sdk) > inference_disk_operation = await inference_disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="inference-vm-disk-1", > ), > spec=DiskSpec( > block_size_bytes=4096, > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ), > size_gibibytes=50, > ), > ), > ) > await inference_disk_operation.wait() > inference_boot_disk_id = inference_disk_operation.resource_id > ``` > > The code creates a 50 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Create a VM with one GPU for inference: > > ```python > inference_network_name = ( > "single-gpu-node-compute-api-" > "network-interface" > ) > inference_service = InstanceServiceClient(sdk) > inference_vm_operation = await inference_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="inference-vm"), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="1gpu-16vcpu-200gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk( > id=inference_boot_disk_id, > ), > ), > cloud_init_user_data=user_data, > network_interfaces=[ > NetworkInterfaceSpec( > name=inference_network_name, > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await inference_vm_operation.wait() > inference_vm_id = inference_vm_operation.resource_id > ``` > [tab] JavaScript SDK > > 1. Create a boot disk: > > ```ts > const inferenceDiskService = new DiskService(sdk); > const inferenceDiskOperation = > await inferenceDiskService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "inference-vm-disk-1", > }), > spec: DiskSpec.create({ > blockSizeBytes: 4096, > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 50, > }, > }), > }), > ).result; > await inferenceDiskOperation.wait(); > const inferenceBootDiskId = > inferenceDiskOperation.resourceId(); > ``` > > The code creates a 50 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Create a VM with one GPU for inference: > > ```ts > const inferenceNetworkName = > "single-gpu-node-compute-api-" + > "network-interface"; > const inferenceService = new InstanceService(sdk); > const inferenceVmOperation = await inferenceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "inference-vm", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "1gpu-16vcpu-200gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: inferenceBootDiskId, > }), > }, > }), > cloudInitUserData: userData, > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: inferenceNetworkName, > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await inferenceVmOperation.wait(); > const inferenceVmId = inferenceVmOperation.resourceId(); > ``` ## Connect to the VMs Connect to the VM for training via SSH: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > 2. Open the page of the VM and copy its public IP address. > 3. Use the public IP address to connect to the VM: > > ```bash > ssh @ > ``` > > Use the username that you specified when creating the VM. > [tab] CLI > > 1. Get the public IP address of your VM and save it to an environment variable: > > ```bash > export TR_PUBLIC_IP_ADDRESS=$(nebius compute instance get \ > --id $TR_VM_ID \ > --format json \ > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@$TR_PUBLIC_IP_ADDRESS > ``` > [tab] Terraform > > 1. Add an output that returns the public IP address of your VM: > > ```hcl > output "training_vm_public_ip" { > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].public_ip_address.address)[0] > } > ``` > > The output takes `address` from `status.network_interfaces[0].public_ip_address` of the VM and removes the prefix length after `/`. > > 2. Apply the changes: > > ```bash > terraform apply > ``` > > Terraform doesn't change the VM. It only calculates the new output. > > 3. Get the public IP address: > > ```bash > terraform output -raw training_vm_public_ip > ``` > > 4. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` > [tab] Go SDK > > 1. Get the public IP address of your VM: > > ```go > trainingInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: trainingVMID, > }, > ) > if err != nil { > return err > } > trainingAddress := trainingInstance.GetStatus(). > GetNetworkInterfaces()[0]. > GetPublicIpAddress().GetAddress() > trainingPublicIP := strings.Split(trainingAddress, "/")[0] > if trainingPublicIP == "" { > return fmt.Errorf("training VM public IP is missing") > } > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` > [tab] Python SDK > > 1. Get the public IP address of your VM: > > ```python > training_ip_service = InstanceServiceClient(sdk) > training_instance = await training_ip_service.get( > GetInstanceRequest(id=training_vm_id), > ) > training_address = ( > training_instance.status.network_interfaces[0] > .public_ip_address.address > ) > training_public_ip = training_address.split("/")[0] > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` > [tab] JavaScript SDK > > 1. Get the public IP address of your VM: > > ```ts > const trainingIpService = new InstanceService(sdk); > const trainingInstance = await trainingIpService.get( > GetInstanceRequest.create({ > id: trainingVmId, > }), > ); > const trainingAddress = trainingInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.address; > const trainingPublicIp = trainingAddress?.split("/")[0]; > if (!trainingPublicIp) { > throw new Error("training VM public IP is missing"); > } > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` Connect to the VM for inference via SSH: > [tab] Web console > > Do the same steps as for the training VM. Open the page of the inference VM, copy its public IP address, and then connect to the inference VM: > > ```bash > ssh @ > ``` > > Use the username that you specified when creating the inference VM. > [tab] CLI > > 1. Get the public IP address of your VM and save it to an environment variable: > > ```bash > export INF_PUBLIC_IP_ADDRESS=$(nebius compute instance get \ > --id $INF_VM_ID \ > --format json \ > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@$INF_PUBLIC_IP_ADDRESS > ``` > [tab] Terraform > > 1. Add an output that returns the public IP address of your VM: > > ```hcl > output "inference_vm_public_ip" { > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].public_ip_address.address)[0] > } > ``` > > 2. Apply the changes: > ```bash > terraform apply > ``` > > 3. Get the public IP address: > > ```bash > terraform output -raw inference_vm_public_ip > ``` > > 4. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` > [tab] Go SDK > > 1. Get the public IP address of your VM: > > ```go > inferenceInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: inferenceVMID, > }, > ) > if err != nil { > return err > } > inferenceAddress := inferenceInstance.GetStatus(). > GetNetworkInterfaces()[0]. > GetPublicIpAddress().GetAddress() > inferencePublicIP := strings.Split(inferenceAddress, "/")[0] > if inferencePublicIP == "" { > return fmt.Errorf("inference VM public IP is missing") > } > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` > [tab] Python SDK > > 1. Get the public IP address of your VM: > > ```python > inference_ip_service = InstanceServiceClient(sdk) > inference_instance = await inference_ip_service.get( > GetInstanceRequest(id=inference_vm_id), > ) > inference_address = ( > inference_instance.status.network_interfaces[0] > .public_ip_address.address > ) > inference_public_ip = inference_address.split("/")[0] > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` > [tab] JavaScript SDK > > 1. Get the public IP address of your VM: > > ```ts > const inferenceIpService = new InstanceService(sdk); > const inferenceInstance = await inferenceIpService.get( > GetInstanceRequest.create({ > id: inferenceVmId, > }), > ); > const inferenceAddress = inferenceInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.address; > const inferencePublicIp = inferenceAddress?.split("/")[0]; > if (!inferencePublicIp) { > throw new Error("inference VM public IP is missing"); > } > ``` > > 2. Use the public IP address to connect to the VM: > > ```bash > ssh user@ > ``` ## What's next * Learn about [VM and GPU types](https://docs.nebius.com/compute/virtual-machines/types.md) * Learn how to [create different types of VMs](https://docs.nebius.com/compute/virtual-machines/create.md) * Learn more about [VM networking](https://docs.nebius.com/compute/virtual-machines/network.md) * Learn how to work with [GPU clusters](https://docs.nebius.com/compute/clusters/gpu/index.md) *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Getting started with Compute: Host an LLM on Nebius AI Cloud Source: https://docs.nebius.com/compute/quickstart-host-model.md You can create a virtual machine (VM) in Nebius AI Cloud, deploy the [Qwen/Qwen2.5-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct) large language model (LLM) on the VM and then use [Open WebUI](https://openwebui.com/) to provide access to the model in a browser. ## Prerequisites > [tab] Web console > > Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. To extract JSON data from the CLI output, install [jq](https://jqlang.github.io/jq/): > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > > 3. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > 2. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). ## Create the VM > [tab] Web console > > 1. Go to the [web console](https://console.nebius.com), click **Create resource** and then select **Virtual machine**. > > 2. On the VM creation page that opens, set the following parameters: > * **Platform**: NVIDIA® H100 NVLink. > > * **Preset**: 1 GPU - 16 CPUs - 200 GiB RAM. > > * **Boot disk image**: Ubuntu 22.04 LTS for NVIDIA® GPUs (CUDA® 12). For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > * **Boot disk size**: 300 GiB SSD. > > * **Network**: Select the **Public IP address: Auto assign static IP** option. > > * **Username and SSH key**: Select the public key that you created earlier. > > In this field, 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. > > 3. Click **Create VM**. > > The given example assumes that you work with a VM that has a public address, so you can later [connect to this VM by SSH](https://docs.nebius.com/compute/quickstart-host-model.md#connect-to-the-vm-web-console). However, if you need an isolated VM, do not assign a public address. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] CLI > > 1. Create a boot disk and save its ID to an environment variable: > > ```bash > export BOOT_DISK_ID=$(nebius compute disk create \ > --name openwebui-disk-1 \ > --size-gibibytes 300 \ > --type network_ssd \ > --source-image-family-image-family ubuntu24.04-cuda13.0 \ > --block-size-bytes 4096 \ > --format jsonpath='{.metadata.id}') > ``` > > The command creates a 300 GiB SSD disk with a 4 KiB block size, and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Get the default subnet ID and save it to an environment variable: > > ```bash > export SUBNET_ID=$(nebius vpc subnet list \ > --format jsonpath='{.items[0].metadata.id}') > ``` > > 3. Create the VM with one GPU: > > ```bash > export USER_DATA=$(jq -Rrs '.' < #cloud-config > users: > - name: > sudo: ALL=(ALL) NOPASSWD:ALL > shell: /bin/bash > ssh_authorized_keys: > - $(cat ~/.ssh/id_ed25519.pub) > EOF > ) > > export VM_ID=$(nebius compute instance create \ > --name openwebui \ > --resources-platform gpu-h100-sxm \ > --resources-preset 1gpu-16vcpu-200gb \ > --boot-disk-existing-disk-id "$BOOT_DISK_ID" \ > --boot-disk-attach-mode READ_WRITE \ > --cloud-init-user-data "$USER_DATA" \ > --network-interfaces "[{\"name\": \"default-subnet\", \"subnet_id\": \"$SUBNET_ID\", \"ip_address\": {}, \"public_ip_address\": {}}]" \ > --format jsonpath='{.metadata.id}') > ``` > > The given example assumes that you work with a VM that has a public address, so you can later [connect to this VM by SSH](https://docs.nebius.com/compute/quickstart-host-model.md#connect-to-the-vm-cli). However, if you need an isolated VM without a public address, remove `"public_ip_address": {}` from the `--network-interfaces` parameter. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Terraform > > 1. Create a boot disk: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "openwebui-disk-1" > parent_id = "" > type = "NETWORK_SSD" > size_gibibytes = 300 > block_size_bytes = 4096 > source_image_family = { > image_family = "ubuntu24.04-cuda13.0" > } > } > ``` > > The configuration creates a 300 GiB SSD disk with a 4 KiB block size from an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. The file contains the following parameters: > > * `name`: Disk name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the disk is created. > * `type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `size_gibibytes`: Disk size in gibibytes. > * `block_size_bytes`: Block size in bytes. > * `source_image_family.image_family`: Boot disk image. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > For the full resource reference, see [nebius\_compute\_v1\_disk](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md). > > 2. Create a user data configuration that adds a user with your SSH public key, and assign it to the `user_data` Terraform variable. For instructions, see [Create a user data configuration](https://docs.nebius.com/compute/virtual-machines/create.md#optional-create-a-user-data-configuration-terraform). > > 3. Create the VM with one GPU: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "openwebui" > parent_id = "" > resources = { > platform = "gpu-h100-sxm" > preset = "1gpu-16vcpu-200gb" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = nebius_compute_v1_disk..id > } > } > cloud_init_user_data = var.user_data > network_interfaces = [ > { > name = "default-subnet" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > The file contains the following parameters: > > * `name`: VM name. > * `parent_id`: ID of the project where the VM is created. > * `resources.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > * `resources.preset`: VM preset with one GPU. > * `boot_disk.existing_disk.id`: ID of the boot disk created earlier. > * `boot_disk.attach_mode`: Write permission of the boot disk. The only supported value is `READ_WRITE`. > * `cloud_init_user_data`: Configuration of VM users in the [cloud-init](https://cloud-init.io/) format. It's taken from the `user_data` variable. > * `network_interfaces`: Network settings: > > * `name`: Name of the network interface. > * `subnet_id`: [ID of the subnet](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) that the VM is connected to. > * `ip_address`: Set to `{}` to assign a private IP address automatically. > * `public_ip_address`: Set to `{}` to assign a dynamic public IP address. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 4. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 5. Apply the changes: > ```bash > terraform apply > ``` > > The given example assumes that you work with a VM that has a public address, so you can later [connect to this VM by SSH](https://docs.nebius.com/compute/quickstart-host-model.md#connect-to-the-vm-terraform). However, if you need an isolated VM without a public address, remove `public_ip_address` from `network_interfaces`. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Go SDK > > 1. Create a boot disk: > > ```go > bootDiskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "openwebui-disk-1", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 300, > }, > BlockSizeBytes: 4096, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = bootDiskOperation.Wait(ctx); err != nil { > return err > } > bootDiskID := bootDiskOperation.ResourceID() > ``` > > The code creates a 300 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Get the default subnet ID: > > ```go > subnets, err := sdk.Services().VPC().V1(). > Subnet().List( > ctx, > &vpc.ListSubnetsRequest{}, > ) > if err != nil { > return err > } > if len(subnets.GetItems()) == 0 { > return errors.New("no subnets found") > } > subnetID := subnets.GetItems()[0].GetMetadata().GetId() > ``` > > 3. Create the VM with one GPU: > > ```go > hostResources := &compute.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &compute.ResourcesSpec_Preset{ > Preset: "1gpu-16vcpu-200gb", > }, > } > hostBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > } > hostNetworkInterface := &compute.NetworkInterfaceSpec{ > Name: "default-subnet", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > hostInstanceSpec := &compute.InstanceSpec{ > Resources: hostResources, > BootDisk: hostBootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > hostNetworkInterface, > }, > CloudInitUserData: userData, > } > hostOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "openwebui", > }, > Spec: hostInstanceSpec, > }, > ) > if err != nil { > return err > } > if _, err = hostOperation.Wait(ctx); err != nil { > return err > } > ``` > > The given example assumes that you work with a VM that has a public address, so you can later [connect to this VM by SSH](https://docs.nebius.com/compute/quickstart-host-model.md#connect-to-the-vm-go-sdk). However, if you need an isolated VM without a public address, remove the public IP address specification from the network interface parameters. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Python SDK > > 1. Create a boot disk: > > ```python > disk_service = DiskServiceClient(sdk) > boot_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="openwebui-disk-1", > ), > spec=DiskSpec( > block_size_bytes=4096, > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ), > size_gibibytes=300, > ), > ), > ) > await boot_disk_operation.wait() > boot_disk_id = boot_disk_operation.resource_id > ``` > > The code creates a 300 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Get the default subnet ID: > > ```python > subnet_service = SubnetServiceClient(sdk) > subnets = await subnet_service.list(ListSubnetsRequest()) > if not subnets.items: > raise ValueError("no subnets found") > subnet_id = subnets.items[0].metadata.id > ``` > > 3. Create the VM with one GPU: > > ```python > instance_service = InstanceServiceClient(sdk) > host_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="openwebui"), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="1gpu-16vcpu-200gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk(id=boot_disk_id), > ), > cloud_init_user_data=user_data, > network_interfaces=[ > NetworkInterfaceSpec( > name="default-subnet", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await host_operation.wait() > ``` > > The given example assumes that you work with a VM that has a public address, so you can later [connect to this VM by SSH](https://docs.nebius.com/compute/quickstart-host-model.md#connect-to-the-vm-python-sdk). However, if you need an isolated VM without a public address, remove the public IP address specification from the network interface parameters. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] JavaScript SDK > > 1. Create a boot disk: > > ```ts > const diskService = new DiskService(sdk); > const bootDiskOperation = await diskService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "openwebui-disk-1", > }), > spec: DiskSpec.create({ > blockSizeBytes: 4096, > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 300, > }, > }), > }), > ).result; > await bootDiskOperation.wait(); > const bootDiskId = bootDiskOperation.resourceId(); > ``` > > The code creates a 300 GiB SSD disk with a 4 KiB block size and an Ubuntu boot image with pre-installed NVIDIA® GPU drivers. For details about boot disk images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 2. Get the default subnet ID: > > ```ts > const subnetService = new SubnetService(sdk); > const subnets = await subnetService.list( > ListSubnetsRequest.create({}), > ); > const subnetId = subnets.items[0]?.metadata?.id; > if (!subnetId) { > throw new Error("no subnets found"); > } > ``` > > 3. Create the VM with one GPU: > > ```ts > const instanceService = new InstanceService(sdk); > const hostOperation = await instanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "openwebui", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "1gpu-16vcpu-200gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > cloudInitUserData: userData, > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "default-subnet", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await hostOperation.wait(); > ``` > > The given example assumes that you work with a VM that has a public address, so you can later [connect to this VM by SSH](https://docs.nebius.com/compute/quickstart-host-model.md#connect-to-the-vm-javascript-sdk). However, if you need an isolated VM without a public address, remove the public IP address specification from the network interface parameters. To access the VM, you can [set up a WireGuard jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) later. This approach enhances security and still provides access to the VM within the same subnet. > > For more information about creating VMs and managing their network parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). ## Connect to the VM 1. Get the public IP address of the VM: > [tab] Web console > > 1. Open the VM page. > 2. In the **Network** block, copy the **Public IPv4** value. > [tab] CLI > > Run the following command: > > ```bash > export PUBLIC_IP_ADDRESS=$(nebius compute instance get-by-name \ > --name openwebui \ > --format json \ > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > ``` > [tab] Terraform > > Add the following output to the configuration: > > ```hcl > output "public_ip_address" { > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].public_ip_address.address)[0] > } > ``` > > Then apply the configuration again with `terraform apply` and read the value: > > ```bash > terraform output -raw public_ip_address > ``` > [tab] Go SDK > > ```go > publicInstance, err := sdk.Services().Compute().V1(). > Instance().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "openwebui", > }, > ) > if err != nil { > return err > } > publicAddress := publicInstance.GetStatus(). > GetNetworkInterfaces()[0]. > GetPublicIpAddress().GetAddress() > publicIPAddress := strings.Split(publicAddress, "/")[0] > if publicIPAddress == "" { > return fmt.Errorf("public IP address is missing") > } > ``` > [tab] Python SDK > > ```python > public_ip_service = InstanceServiceClient(sdk) > public_instance = await public_ip_service.get_by_name( > GetByNameRequest(name="openwebui"), > ) > public_address = ( > public_instance.status.network_interfaces[0] > .public_ip_address.address > ) > public_ip_address = public_address.split("/")[0] > ``` > [tab] JavaScript SDK > > ```ts > const publicIpService = new InstanceService(sdk); > const publicInstance = await publicIpService.getByName( > GetByNameRequest.create({ > name: "openwebui", > }), > ); > const publicAddress = publicInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.address; > const publicIpAddress = publicAddress?.split("/")[0]; > if (!publicIpAddress) { > throw new Error("public IP address is missing"); > } > ``` 2. Connect to the VM: ```bash ssh @ ``` Specify the received public IP address and the username that you set during the VM creation. ## Create a virtual environment and install the necessary packages To work with Open WebUI, you need a dedicated [virtual environment](https://docs.python.org/3/tutorial/venv.html). It enables you to set up and run the OpenWebUI server in isolation from other software on the VM. To create a virtual environment, use [Miniconda](https://docs.anaconda.com/miniconda/). To configure the environment: 1. Download and install the latest Miniconda version: ```bash mkdir -p ~/miniconda3 wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 rm ~/miniconda3/miniconda.sh ``` 2. Initialize Miniconda: ```bash source ~/miniconda3/bin/activate ``` On initialization, Miniconda activates its `base` environment. 3. Create an `OpenWebUI` environment with Python 3.11: ```bash conda create -n OpenWebUI python=3.11 conda init bash echo "conda activate OpenWebUI " >> ~/.bashrc source ~/.bashrc ``` This command creates and activates a new environment. 4. Install [Ollama](https://ollama.com/), which provides access to the model: ```bash curl -fsSL https://ollama.com/install.sh | sh ``` 5. Install Open WebUI: ```bash pip install open-webui ``` ## Start the Open WebUI server 1. Start the server: ```bash open-webui serve ``` 2. Open the Open WebUI interface in the browser. To do this, enter the `http://:8080` address in the search bar. 3. In the Open WebUI interface, create an account to work with LLMs locally within the VM. For details on working with Open WebUI, see [their documentation](https://docs.openwebui.com/). If you need to restart the server, use the same command: `open-webui serve`. ## Download the Qwen/Qwen2.5-72B-Instruct model 1. In Open WebUI, click **Select a model**. 2. Paste `qwen2.5:72b` into the search bar. 3. Click **Pull "qwen2.5:72b" from Ollama** and wait for the download to finish. 4. Click **Select a model** again and then choose Qwen/Qwen2.5-72B-Instruct. Now you can chat with the model in the browser. ## Make Open WebUI start automatically With the current configuration, you need to manually start the Open WebUI server every time you connect to your VM. Alternatively, you can configure the server to start up whenever the VM starts. To do this: 1. Create a `systemd` service file for Open WebUI and open the file in an editor: ```bash sudo nano /etc/systemd/system/openwebui.service ``` 2. Paste the following contents into the file and save it. Specify the username that you set during the VM creation: ```ini [Unit] Description=OpenWebUI Server After=network.target [Service] User= WorkingDirectory=/home// ExecStart=/home//miniconda3/envs/OpenWebUI/bin/open-webui serve Restart=always [Install] WantedBy=multi-user.target ``` 3. To make the new service file recognizable, reload `systemd`: ```bash sudo systemctl daemon-reload ``` 4. To start automatically and immediately, enable the `systemd` service: ```bash sudo systemctl enable openwebui.service sudo systemctl start openwebui.service ``` 5. Verify that the service is running: ```bash sudo systemctl status openwebui.service ``` Whenever you start up your VM in the web console, Open WebUI now automatically launches in the background. You can directly access it in the browser at `http://ip_address:8080` and work with the Qwen/Qwen2.5-72B-Instruct model. # Types of virtual machines and GPUs in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/types.md Compute offers the following platforms for virtual machines (VMs): | Platform name | Platform ID | CPU | [Regions](https://docs.nebius.com/overview/regions.md) | | - | - | - | - | | NVIDIA® B300 NVLink | gpu-b300-sxm | [Intel Xeon 6776P](https://www.intel.com/content/www/us/en/products/sku/243691/intel-xeon-6776p-processor-336m-cache-2-30-ghz/specifications.html) | `uk-south1`, `eu-west2`, `us-north1` | | NVIDIA® B200 NVLink | gpu-b200-sxm | [Intel Xeon Platinum 8580](https://www.intel.com/content/www/us/en/products/sku/237250/intel-xeon-platinum-8580-processor-300m-cache-2-00-ghz/specifications.html) | `us-central1` | | NVIDIA® B200 NVLink | gpu-b200-sxm-a | [Intel Xeon Platinum 8570](https://www.intel.com/content/www/us/en/products/sku/237264/intel-xeon-platinum-8570-processor-300m-cache-2-10-ghz/specifications.html) | `me-west1` | | NVIDIA® RTX PRO™ 6000 | gpu-rtx6000 | [Intel Xeon 6776P](https://www.intel.com/content/www/us/en/products/sku/243691/intel-xeon-6776p-processor-336m-cache-2-30-ghz/specifications.html) | `us-central1` | | NVIDIA® RTX PRO™ 6000 | gpu-rtx6000-a | [Intel Xeon 6776P](https://www.intel.com/content/www/us/en/products/sku/243691/intel-xeon-6776p-processor-336m-cache-2-30-ghz/specifications.html) | `uk-south2`, `eu-south1` | | NVIDIA® H200 NVLink | gpu-h200-sxm | [Intel Xeon Platinum 8468](https://ark.intel.com/content/www/us/en/ark/products/231735/intel-xeon-platinum-8468-processor-105m-cache-2-10-ghz.html) | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | | NVIDIA® H100 NVLink | gpu-h100-sxm | [Intel Xeon Platinum 8468](https://ark.intel.com/content/www/us/en/ark/products/231735/intel-xeon-platinum-8468-processor-105m-cache-2-10-ghz.html) | `eu-north1` | | NVIDIA® L40S Intel | gpu-l40s-a | [Intel Xeon Gold 6338](https://ark.intel.com/content/www/us/en/ark/products/212285/intel-xeon-gold-6338-processor-48m-cache-2-00-ghz.html) | `eu-north1` | | NVIDIA® L40S AMD | gpu-l40s-d | [AMD EPYC™ 9654](https://www.amd.com/en/products/processors/server/epyc/4th-generation-9004-and-8004-series/amd-epyc-9654.html) | `eu-north1` | | Non-GPU AMD Epyc Genoa | cpu-d3 | [AMD EPYC™ 9654](https://www.amd.com/en/products/processors/server/epyc/4th-generation-9004-and-8004-series/amd-epyc-9654.html) | `eu-north1`, `eu-west1`, `me-west1`, `us-central1`, `uk-south1`, `uk-south2`, `eu-south1`, `eu-west2`, `us-north1`, `eu-north2` | | Non-GPU Intel Ice Lake | cpu-e2 | [Intel Xeon Gold 6338](https://ark.intel.com/content/www/us/en/ark/products/212285/intel-xeon-gold-6338-processor-48m-cache-2-00-ghz.html) | `eu-north1` | Each platform offers different *presets* for creating VMs. The presets vary by the number of GPUs (for platforms with GPUs), vCPUs, and RAM size. The exact amount of these resources is indicated in the preset name. Thus, the `1gpu-16vcpu-200gb` preset stands for a VM with 1 GPU, 16 vCPUs, and 200 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) RAM. Availability of platforms depends on a region and project. You can [get a list](https://docs.nebius.com/compute/virtual-machines/list-platforms.md) of platforms and presets supported in a given project. For VM platforms with GPUs, you can also use the [capacity advisor](https://docs.nebius.com/compute/virtual-machines/capacity-advisor.md) to get information about the availability of computing resources based on your quotas and the current physical capacity. ## GPU types Compute provides VMs with the following GPU types: | GPU | Architecture | Form factor | GPU memory | Memory bandwidth | InfiniBand interconnect | Network adapter | Platform | CPU | | - | - | - | - | - | - | - | - | - | | [NVIDIA B300](https://www.nvidia.com/en-us/data-center/dgx-b300/) | Blackwell Ultra | SXM | 270 GB HBM3e | 7.7 TB/s | 800 Gbps (8× ConnectX-8) | BlueField-3 400 Gbps | `gpu-b300-sxm` | [Intel Xeon 6776P](https://www.intel.com/content/www/us/en/products/sku/243691/intel-xeon-6776p-processor-336m-cache-2-30-ghz/specifications.html) | | [NVIDIA B200](https://www.nvidia.com/en-us/data-center/dgx-b200/) | Blackwell | SXM | 180 GB HBM3e | 7.7 TB/s | 400 Gbps (8× ConnectX-7) | BlueField-3 400 Gbps | `gpu-b200-sxm`, `gpu-b200-sxm-a` | [Intel Xeon Platinum 8580](https://www.intel.com/content/www/us/en/products/sku/237250/intel-xeon-platinum-8580-processor-300m-cache-2-00-ghz/specifications.html), [Intel Xeon Platinum 8570](https://www.intel.com/content/www/us/en/products/sku/237264/intel-xeon-platinum-8570-processor-300m-cache-2-10-ghz/specifications.html) | | [NVIDIA RTX PRO 6000 Server Edition](https://www.nvidia.com/en-us/data-center/rtx-pro-6000-blackwell-server-edition/) | Blackwell | PCIe Gen5 | 96 GB GDDR7 | 1.6 TB/s | — | BlueField-3 400 Gbps | `gpu-rtx6000`, `gpu-rtx6000-a` | [Intel Xeon 6776P](https://www.intel.com/content/www/us/en/products/sku/243691/intel-xeon-6776p-processor-336m-cache-2-30-ghz/specifications.html) | | [NVIDIA H200](https://www.nvidia.com/en-us/data-center/h200/) | Hopper | SXM | 141 GB HBM3e | 4.8 TB/s | 400 Gbps (8× ConnectX-7) | BlueField-3 200 Gbps | `gpu-h200-sxm` | [Intel Xeon Platinum 8468](https://ark.intel.com/content/www/us/en/ark/products/231735/intel-xeon-platinum-8468-processor-105m-cache-2-10-ghz.html) | | [NVIDIA H100](https://www.nvidia.com/en-us/data-center/h100/) | Hopper | SXM | 80 GB HBM3 | 3.35 TB/s | 400 Gbps (8× ConnectX-7) | ConnectX-6 100 Gbps | `gpu-h100-sxm` | [Intel Xeon Platinum 8468](https://ark.intel.com/content/www/us/en/ark/products/231735/intel-xeon-platinum-8468-processor-105m-cache-2-10-ghz.html) | | [NVIDIA L40S](https://www.nvidia.com/en-us/data-center/l40s/) | Ada Lovelace | PCIe | 48 GB GDDR6 | 864 GB/s | — | — | `gpu-l40s-a`, `gpu-l40s-d` | [Intel Xeon Gold 6338](https://ark.intel.com/content/www/us/en/ark/products/212285/intel-xeon-gold-6338-processor-48m-cache-2-00-ghz.html), [AMD EPYC™ 9654](https://www.amd.com/en/products/processors/server/epyc/4th-generation-9004-and-8004-series/amd-epyc-9654.html) | ## Presets for GPU platforms * NVIDIA® B300 NVLink (`gpu-b300-sxm`), available in `uk-south1`, `eu-west2` and `us-north1`: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) | | - | - | - | - | | `1gpu-24vcpu-346gb` | 1 | 24 | 346 | | `8gpu-192vcpu-2768gb` | 8 | 192 | 2768 | * NVIDIA® B200 NVLink (`gpu-b200-sxm` and `gpu-b200-sxm-a`), available in `us-central1` and `me-west1` respectively: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB | | - | - | - | - | | `1gpu-20vcpu-224gb` | 1 | 20 | 224 | | `8gpu-160vcpu-1792gb` | 8 | 160 | 1792 | * NVIDIA® H200 NVLink (`gpu-h200-sxm`), available in `eu-north1`, `eu-north2`, `eu-west1` and `us-central1`: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB | [Regions](https://docs.nebius.com/overview/regions.md) | | - | - | - | - | - | | `1gpu-16vcpu-200gb` | 1 | 16 | 200 | `eu-north1`, `eu-west1`, `us-central1`, `eu-north2` | | `8gpu-128vcpu-1600gb` | 8 | 128 | 1600 | `eu-north1`, `eu-west1`, `us-central1`, `eu-north2` | * NVIDIA® H100 NVLink (`gpu-h100-sxm`), available in `eu-north1`: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB | | - | - | - | - | | `1gpu-16vcpu-200gb` | 1 | 16 | 200 | | `8gpu-128vcpu-1600gb` | 8 | 128 | 1600 | * NVIDIA® RTX PRO™ 6000, where `gpu-rtx6000` is available in `us-central1` and `gpu-rtx6000-a` is available in `uk-south2` and `eu-south1`: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB | | - | - | - | - | | `1gpu-24vcpu-218gb` | 1 | 24 | 218 | | `8gpu-192vcpu-1744gb` | 8 | 192 | 1744 | * NVIDIA® L40S Intel (`gpu-l40s-a`), available in `eu-north1`: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB | | - | - | - | - | | `1gpu-8vcpu-32gb` | 1 | 8 | 32 | | `1gpu-16vcpu-64gb` | 1 | 16 | 64 | | `1gpu-24vcpu-96gb` | 1 | 24 | 96 | | `1gpu-32vcpu-128gb` | 1 | 32 | 128 | | `1gpu-40vcpu-160gb` | 1 | 40 | 160 | * NVIDIA® L40S AMD (`gpu-l40s-d`), available in `eu-north1`: | Preset name | Number of GPUs | Number of vCPUs | RAM, GiB | | - | - | - | - | | `1gpu-16vcpu-96gb` | 1 | 16 | 96 | | `1gpu-32vcpu-192gb` | 1 | 32 | 192 | | `1gpu-48vcpu-288gb` | 1 | 48 | 288 | | `2gpu-64vcpu-384gb` | 2 | 64 | 384 | | `2gpu-96vcpu-576gb` | 2 | 96 | 576 | | `4gpu-128vcpu-768gb` | 4 | 128 | 768 | | `4gpu-192vcpu-1152gb` | 4 | 192 | 1152 | ### Presets compatible with GPU clusters If you are adding a VM to a [GPU cluster](https://docs.nebius.com/compute/clusters/gpu/index.md), select from the following platforms and presets: | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | | - | - | - | | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | Other presets and platforms are not compatible with GPU clusters. ## Presets for non-GPU platforms * Non-GPU AMD Epyc Genoa (`cpu-d3`): | Preset name | Number of vCPUs | RAM, GiB | [Regions](https://docs.nebius.com/overview/regions.md) | | - | - | - | - | | `2vcpu-8gb` | 2 | 8 | All regions | | `4vcpu-16gb` | 4 | 16 | All regions | | `8vcpu-32gb` | 8 | 32 | All regions | | `16vcpu-64gb` | 16 | 64 | All regions | | `32vcpu-128gb` | 32 | 128 | All regions | | `48vcpu-192gb` | 48 | 192 | All regions | | `64vcpu-256gb` | 64 | 256 | All regions | | `96vcpu-384gb` | 96 | 384 | All regions | | `128vcpu-512gb` | 128 | 512 | All regions | | `160vcpu-640gb` | 160 | 640 | All regions except `eu-north1` and `eu-south1` | | `192vcpu-768gb` | 192 | 768 | All regions except `eu-north1` and `eu-south1` | | `224vcpu-896gb` | 224 | 896 | All regions except `eu-north1` and `eu-south1` | | `256vcpu-1024gb` | 256 | 1024 | All regions except `eu-north1` and `eu-south1` | * Non-GPU Intel Ice Lake (`cpu-e2`), available in `eu-north1`: | Preset name | Number of vCPUs | RAM, GiB | | - | - | - | | `2vcpu-8gb` | 2 | 8 | | `4vcpu-16gb` | 4 | 16 | | `8vcpu-32gb` | 8 | 32 | | `16vcpu-64gb` | 16 | 64 | | `32vcpu-128gb` | 32 | 128 | | `48vcpu-192gb` | 48 | 192 | | `64vcpu-256gb` | 64 | 256 | | `80vcpu-320gb` | 80 | 320 | ## Compatibility with boot disk images Nebius AI Cloud provides boot disk images for GPU and non-GPU VMs. The image that you choose for a VM must be compatible with the VM's platform. For compatibility details, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). ## Compatibility with VM types All platforms support regular VMs. All platforms with GPUs also support [preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md). To get an up-to-date list of platforms, run the `nebius compute platform list` [command](https://docs.nebius.com/cli/reference/compute/platform/list.md). The platforms available for preemptible VMs are marked as `allowed_for_preemptibles: true`. # How to find out platforms and presets available in a project Source: https://docs.nebius.com/compute/virtual-machines/list-platforms.md Different virtual machine platforms and presets are available for different regions and projects. All supported platforms and presets are listed in [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to find out available platforms and presets To find out what platforms and presets are available in a given project: > [tab] CLI > > Run the following command: > > ```bash > nebius compute platform list --parent-id > ``` > > In the `--parent-id` parameter, specify the ID of the project for which you want to see the list. > [tab] Go SDK > > ```go > platforms, err := sdk.Services().Compute().V1(). > Platform().List( > ctx, > &compute.ListPlatformsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(platforms) > ``` > > In the `ParentId` parameter, specify the ID of the project for which you want to see the list. > [tab] Python SDK > > ```python > platform_service = PlatformServiceClient(sdk) > platforms = await platform_service.list( > ListPlatformsRequest(parent_id=""), > ) > print(platforms) > ``` > > In the `parent_id` parameter, specify the ID of the project for which you want to see the list. > [tab] JavaScript SDK > > ```ts > const platformService = new PlatformService(sdk); > const platforms = await platformService.list( > ListPlatformsRequest.create({ > parentId: "", > }), > ); > console.log(platforms); > ``` > > In the `parentId` parameter, specify the ID of the project for which you want to see the list. # How to create a virtual machine in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/create.md You can create a Compute virtual machine (VM) in the [web console](https://console.nebius.com), or by using the [CLI](https://docs.nebius.com/cli/index.md), [Terraform provider](https://docs.nebius.com/terraform-provider/index.md) or SDKs. You can tailor the VM configuration to your needs and, for example, attach secondary disks and filesystems, or allocate GPU resources to your VM. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). The VM that you create this way is a *standalone VM*, which is a general-purpose Compute resource. In the [web console](https://console.nebius.com), standalone VMs are displayed on the **Standalone VMs** tab of the **Virtual machines** page. A standalone VM can be regular or [preemptible](https://docs.nebius.com/compute/virtual-machines/preemptible.md): regular VMs run until you stop them, while Compute may stop preemptible VMs at any time. ## 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. > [tab] 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 > export USER_DATA=$(jq -Rrs '.' < #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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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] Terraform > > 1. 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 > export USER_DATA=$(jq -Rrs '.' < #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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > 2. Put the user data to a Terraform variable, so the Terraform configuration can address it: > > ```bash > export TF_VAR_user_data=$(printf "%s" "$USER_DATA") > ``` > > 3. Check that the `TF_VAR_user_data` variable contains the correct data: > > ```bash > printf "TF_VAR_user_data: %s\n" "$TF_VAR_user_data" > ``` > > The output is the following: > > ```text > TF_VAR_user_data: #cloud-config > users: > - name: > sudo: ALL=(ALL) NOPASSWD:ALL > shell: /bin/bash > ssh_authorized_keys: > - > ``` > > 4. Create the `variables.tf` file with the following contents: > > ```hcl > 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. > > 5. Initialize the working directory: > > ```bash > terraform init > ``` > [tab] Go SDK > > To add a user for connections to a VM, define `userData` as a string in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format. > > ```go > publicKeyBytes, err := os.ReadFile( > os.ExpandEnv("$HOME/.ssh/id_ed25519.pub"), > ) > if err != nil { > return err > } > publicKey := strings.TrimSpace(string(publicKeyBytes)) > userData := "#cloud-config\nusers:\n" + > " - name: user\n" + > " sudo: ALL=(ALL) NOPASSWD:ALL\n" + > " shell: /bin/bash\n" + > " ssh_authorized_keys:\n" + > " - " + publicKey > ``` > > The configuration contains the following parameters: > > * `name`: Username for connecting to the VM. The example sets `user`; replace it with your username. > > 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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > When you create the VM, pass this string to `InstanceSpec.CloudInitUserData`. The VM applies this configuration on first boot. > [tab] Python SDK > > To add a user for connections to a VM, define `user_data` as a string in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format. > > ```python > public_key = ( > Path.home() > .joinpath(".ssh/id_ed25519.pub") > .read_text() > .strip() > ) > user_data = "\n".join( > [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > f" - {public_key}", > ], > ) > ``` > > The configuration contains the following parameters: > > * `name`: Username for connecting to the VM. The example sets `user`; replace it with your username. > > 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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > When you create the VM, pass this string to `InstanceSpec.cloud_init_user_data`. The VM applies this configuration on first boot. > [tab] JavaScript SDK > > To add a user for connections to a VM, define `userData` as a string in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format. > > ```ts > const publicKey = readFileSync( > `${process.env.HOME}/.ssh/id_ed25519.pub`, > "utf8", > ).trim(); > const userData = [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > " - " + publicKey, > ].join("\n"); > ``` > > The configuration contains the following parameters: > > * `name`: Username for connecting to the VM. The example sets `user`; replace it with your username. > > 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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > When you create the VM, pass this string to `InstanceSpec.cloudInitUserData`. The VM applies this configuration on first boot. ### Create a VM > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. If you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md), on the **General** step, choose how Compute allocates resources: > > * **Reserved VM**: Capacity is assured by your capacity block groups. This option is for regular VMs with GPUs. If you have active capacity block groups, the card shows how many are available. > * **Pay-as-you-go VM**: Capacity is subject to availability. This option allows [preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) and VMs without GPUs. > > If you do not have capacity block groups, the wizard skips the **General** step and opens **Compute** instead. > > 4. On the **Compute** step, configure computing resources: > > **Reserved VM:** > > 1. In the **Platform** section, select a [platform](https://docs.nebius.com/compute/virtual-machines/types.md). > > The list shows platforms that match your capacity block groups. Each platform card shows GPU memory, the platform ID and badges for associated capacity block groups. > > 2. In the **Reservation** section, configure how Compute uses your [reservations](https://docs.nebius.com/compute/virtual-machines/reservations.md). > > The **Reservation** section is only displayed if you have capacity block groups. > > 1. If you have capacity block groups in multiple regions, select a **Region**. > 2. To let Compute choose among your capacity block groups automatically, select **Any (existing and future)**. > 3. To use specific capacity block groups, select them. Each option shows the capacity block group ID, reservation period, and GPU usage. > 4. Under **Switch to PAYG**, choose whether the VM can start after you create or restart it without active intervals in selected capacity block groups: > > * **When reservation is exhausted**: The VM can start as a pay-as-you-go VM when no capacity is available in the selected capacity block groups. > * **Never**: The VM cannot start without available capacity in the selected capacity block groups. > > This does not affect the VM when it is running. If an interval in a selected capacity block group expires while the VM is running, the VM always continues as a pay-as-you-go VM, regardless of this setting. > > 3. In the **Settings** section, configure the following: > > 1. Select a **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  **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](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > 3. Click **Create**. > > 3. Select the **Project** for the VM location. > > 4. Specify the **VM name**. > > **Pay-as-you-go VM:** > > 1. In the **Platform** section, select **With GPUs** or **Without GPUs** and the VM type **Regular** or [Preemptible](https://docs.nebius.com/compute/virtual-machines/preemptible.md). > > VMs without GPUs only support the regular type. > > 2. Select a [platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). > > Expand a platform card to compare available presets by region. You can also see the platforms that are not currently available. > > 3. If you selected [Preemptible](https://docs.nebius.com/compute/virtual-machines/preemptible.md), in **Max price**, select or create a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md), or choose **Follows spot price**. > > 4. In the **Settings** section, configure the following: > > 1. Select a **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  **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](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > 3. Click **Create**. > > 3. Select the **Project** for the VM location. > > 4. Specify the **VM name**. > > To check GPU availability across regions and presets before you create a VM, use the [capacity advisor](https://docs.nebius.com/compute/virtual-machines/capacity-advisor.md). > > 5. On the **Storage** step, configure disks and filesystems: > > 1. In the **Boot disk** section, set the boot disk settings: > > 1. Click  on the boot disk card. > 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](https://docs.nebius.com/compute/storage/boot-disk-images.md) provided by Nebius or a [custom image or image family](https://docs.nebius.com/compute/storage/custom-disk-images.md) that you created yourself. Also, configure the type, encryption, size, and block size. For more information about these settings, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > 2. (Optional) If you want to attach an additional disk to your VM, in the **Additional disks** section: > > 1. Click  **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**. > > > [!WARNING] > > > > After you create the VM, [mount the additional disks](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks. > > 3. (Optional) If the selected platform supports local SSD disks, enable **Local SSD disks** to add ephemeral local storage. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > 4. (Optional) If you want to attach a filesystem to your VM, in the **Shared filesystems** section: > > 1. Click  **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**. > > 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. > > 6. On the **Network** step, attach the VM to a [network and subnet](https://docs.nebius.com/vpc/overview.md): > > 1. Select the **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](https://docs.nebius.com/compute/virtual-machines/network.md#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  **Add IP 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](https://docs.nebius.com/compute/virtual-machines/wireguard.md). 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](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-enable-a-public-ip-address-for-a-vm). > > 5. In the **Hostname** field, specify whether to use the VM ID or a custom hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md): > > * **Same as VM ID**: The default FQDN uses the VM ID. > * **Custom**: Specify your own hostname. > > 7. On the **Configuration** step, configure access, identity and VM startup settings: > > 1. In the **Access** section, add credentials so you can [connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md): > > 1. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > 2. In the **Username and SSH key** field, click  **Create**. > 3. 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. > 4. Click **Add credentials**. > > 2. (Optional) In the **Additional** section, select an existing service account or click  **Create** to add a new one. The service account will perform actions on behalf of the VM, for example, run scripts. > > 3. (Optional) In the **User data** section, 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 on the **Configuration** step are automatically added to a cloud-init configuration if you enable it. Ultimately, the settings from the configuration apply, not those from the **Configuration** step. > > 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). > > 8. On the **Review** step, check the full VM configuration. To change a section quickly, click  next to the corresponding block. The wizard opens the relevant step with your current settings. > > 9. Click **Create VM**. > [tab] CLI > > 1. (Optional) If you want to attach a filesystem to your VM, create this filesystem: > > ```bash > nebius compute filesystem create \ > --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 [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > You don't need to create disks for the VM in advance. You can create them along with the VM. Such disks are called [VM-managed](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). They are tied to the VM lifecycle. > > 2. (Optional) To provide the VM with an [allocation](https://docs.nebius.com/vpc/overview.md#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](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli). > 2. Run the following command: > > ```bash > nebius vpc allocation create \ > --ipv4-public-subnet-id \ > --name > ``` > > Save the allocation ID from the output `metadata.id` parameter. > > For more information about networking in Compute, see [Public IP addresses](https://docs.nebius.com/compute/virtual-machines/network.md#public-ip-addresses). > > 3. (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 > nebius compute gpu-cluster create \ > --name \ > --infiniband-fabric > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > Save the cluster ID from the output `metadata.id` parameter. > > 4. (Optional) Create a [service account](https://docs.nebius.com/iam/service-accounts/manage.md) that will perform actions on behalf of the VM: > > ```bash > nebius iam service-account create --name > ``` > > 5. Create the VM: > > ```bash > nebius compute instance create \ > --name \ > --stopped= \ > --resources-platform \ > --resources-preset \ > --boot-disk-managed-disk-name \ > --boot-disk-managed-disk-type \ > --boot-disk-managed-disk-size-gibibytes \ > --boot-disk-managed-disk-source-image-family-image-family \ > --boot-disk-attach-mode READ_WRITE \ > --boot-disk-device-id \ > --secondary-disks '[{"attach_mode": "READ_WRITE", "device_id": "", "managed_disk": { "name": "", "spec": { "type": "", "size_gibibytes": 10 }}}]' \ > --filesystems '[{"existing_filesystem": {"id": ""}, "attach_mode": "READ_WRITE", "mount_tag": ""}]' \ > --cloud-init-user-data "$USER_DATA" \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {"allocation_id": ""}, "subnet_id": ""}]' \ > --gpu-cluster-id \ > --hostname \ > --reservation-policy-policy \ > --reservation-policy-reservation-ids \ > --recovery-policy \ > --preemptible-on-preemption stop \ > --follows-spot-price \ > --service-account-id > ``` > > The command contains the following parameters: > > * `--name`: VM's name. > > * `--stopped` (optional): To create a VM but not launch it, specify `true`. The VM will remain in the `Stopped` status. If you omit the parameter or specify `false`, the VM starts after creation. > > For more information, see [Lifecycle of a Compute virtual machine](https://docs.nebius.com/compute/virtual-machines/lifecycle.md). > > * `--resources-platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `--resources-preset`: VM preset. Depends on the chosen platform. > > * `--boot-disk-managed-disk-name`: Name of the [VM-managed boot disk](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks) that you create along with the VM. > > * `--boot-disk-managed-disk-type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > > * `--boot-disk-managed-disk-size-gibibytes`: Disk size in gibibytes. Maximum boot disk size is 30,720 GiB (30 TiB). > > * `--boot-disk-managed-disk-source-image-family-image-family`: Public image that Nebius AI Cloud supports. For the list of available public images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > * `--boot-disk-attach-mode`: Write permission of the boot disk. The only supported value is `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): Settings of additional VM-managed disks that you create along with the VM. You can attach one or several disks. > > * `attach_mode`: Write permission of the additional disk. The only supported value is `READ_WRITE`. > * `device_id`: User-defined ID for mounting the disk to the VM. > * `managed_disk.name`: Name of a new disk. > * `managed_disk.spec.type`: Disk type. > * `managed_disk.spec.size_gibibytes`: Disk size in gibibytes. > > * `--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. The only supported value is `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](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these volumes. > > * `--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](https://docs.nebius.com/compute/virtual-machines/create.md#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": ""}`. > > 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](https://docs.nebius.com/compute/virtual-machines/wireguard.md). 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. > > * `--local-disks-passthrough-group-requested` (optional): Requests local SSD disks to be added to the VM when set to `true`. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `--hostname` (optional): Hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). By default, the FQDN has the `..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](https://docs.nebius.com/compute/virtual-machines/reservations.md) 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](https://docs.nebius.com/compute/virtual-machines/reservations.md#how-to-add-reservations-to-vms). > > * `--recovery-policy` (optional): Defines what Compute does with the VM after it is preempted or fails. > > [Preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) 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-on-preemption` (required for preemptible VMs): Makes the VM preemptible and specifies what happens when the VM is preempted. The only supported value is `stop`: Compute stops the VM without deleting or restarting it. > > * `--spot-pricing-policy-id` (required for preemptible VMs unless you use `--follows-spot-price`): ID of the pricing policy that sets the maximum spot price. For information on how to get a pricing policy ID or create a new policy, see [Managing pricing policies](https://docs.nebius.com/signup-billing/manage-pricing-policy.md). > > * `--follows-spot-price` (required for preemptible VMs unless you use `--spot-pricing-policy-id`): Accepts the current spot price without setting a maximum spot price. > > * `--service-account-id` (optional): Service account associated with the VM. > [tab] Terraform > > 1. (Optional) If you want to attach a filesystem to your VM, create this filesystem: > > ```hcl > resource "nebius_compute_v1_filesystem" "my_filesystem" { > name = "" > parent_id = "" > size_gibibytes = 10 > type = "NETWORK_SSD" > block_size_bytes = 4096 > } > ``` > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > You don't need to create disks for the VM in advance. You can create them along with the VM. Such disks are called [VM-managed](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). They are tied to the VM lifecycle. > > 2. (Optional) To provide the VM with an [allocation](https://docs.nebius.com/vpc/overview.md#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 > resource "nebius_vpc_v1_allocation" "my_allocation" { > name = "" > parent_id = "" > ipv4_public = { > subnet_id = "" > } > } > ``` > > To create the allocation, [get the required subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). > > For more information about networking in Compute, see [Public IP addresses](https://docs.nebius.com/compute/virtual-machines/network.md#public-ip-addresses). > > 3. (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 > resource "nebius_compute_v1_gpu_cluster" "my_gpu_cluster" { > name = "" > parent_id = "" > infiniband_fabric = "" > } > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 4. (Optional) Create a [service account](https://docs.nebius.com/iam/service-accounts/manage.md) that will perform actions on behalf of the VM: > > ```hcl > resource "nebius_iam_v1_service_account" "my_sa" { > name = "" > parent_id = "" > } > ``` > > 5. (Optional) If your `resources` block uses a platform and preset that support local SSD disks, add a `local_disks` block to the `nebius_compute_v1_instance` resource in the next step. The local SSD disks are provisioned as raw Non-Volatile Memory Express (NVMe) devices (`nvme0`, `nvme1`, and so on). You can enable local SSD disks only when you create the VM. For more information, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > For example: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > # ... > local_disks = { > passthrough_group = { > requested = true > } > } > } > ``` > > 6. Create the VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > stopped = > resources = { > platform = "" > preset = "" > } > boot_disk = { > managed_disk = { > name = "" > spec = { > type = "" > size_gibibytes = > source_image_family = { > image_family = "" > } > } > } > attach_mode = "READ_WRITE" > device_id = "" > } > secondary_disks = [ > { > managed_disk = { > name = "" > spec = { > type = "" > size_gibibytes = > } > } > attach_mode = "READ_WRITE" > device_id = "" > } > ] > filesystems = [ > { > existing_filesystem = { > id = nebius_compute_v1_filesystem.my_filesystem.id > } > attach_mode = "READ_WRITE" > mount_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 = "" > } > ] > gpu_cluster = { > id = nebius_compute_v1_gpu_cluster.my_gpu_cluster.id > } > hostname = "" > reservation_policy = { > policy = "" > reservation_ids = [""] > } > recovery_policy = "" > preemptible = { > on_preemption = "STOP" > } > follows_spot_price = {} > service_account_id = nebius_iam_v1_service_account.my_sa.id > } > ``` > > The configuration contains the following parameters: > > * `name`: VM's name. > > * `stopped` (optional): To create a VM but not launch it, specify `true`. The VM will remain in the `Stopped` status. If you omit the parameter or specify `false`, the VM starts after creation. > > For more information, see [Lifecycle of a Compute virtual machine](https://docs.nebius.com/compute/virtual-machines/lifecycle.md). > > * `resources.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `resources.preset`: VM preset. Depends on the chosen platform. > > * `boot_disk`: Settings of a [VM-managed boot disk](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks) that you create along with the VM. > > * `managed_disk.name`: Name of the disk. > * `managed_disk.spec.type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `managed_disk.spec.size_gibibytes`: Disk size in gibibytes. Maximum boot disk size is 30,720 GiB (30 TiB). > * `managed_disk.spec.source_image_family.image_family`: Public image that Nebius AI Cloud supports. For the list of available public images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > * `attach_mode`: Write permission of the boot disk. The only supported value is `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): Settings of additional VM-managed disks that you create along with the VM. You can attach one or several disks. > > * `managed_disk.name`: Name of a new disk. > * `managed_disk.spec.type`: Disk type. > * `managed_disk.spec.size_gibibytes`: Disk size in gibibytes. > * `attach_mode`: Write permission of the additional disk. The only supported value is `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. The only supported value is `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](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these volumes. > > * `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](https://docs.nebius.com/compute/virtual-machines/create.md#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](https://docs.nebius.com/compute/virtual-machines/wireguard.md). 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. > > * `local_disks` (optional): Set `passthrough_group.requested = true` to request local SSD disks to be added to the VM. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `hostname` (optional): Hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). By default, the FQDN has the `..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](https://docs.nebius.com/compute/virtual-machines/reservations.md) 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](https://docs.nebius.com/compute/virtual-machines/reservations.md#how-to-add-reservations-to-vms). > > * `recovery_policy` (optional): Defines what Compute does with the VM after it is preempted or fails. > > [Preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) 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.on_preemption` (required for preemptible VMs): Makes the VM preemptible and specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > > * `spot_pricing_policy.id` (required for preemptible VMs unless you use `follows_spot_price`): ID of the pricing policy that sets the maximum spot price. > > * `follows_spot_price` (required for preemptible VMs unless you use `spot_pricing_policy.id`): Accepts the current spot price without setting a maximum spot price. > > * `service_account_id` (optional): Service account associated with the VM. > > 7. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 8. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. (Optional) If you want to attach a filesystem to your VM, create this filesystem: > > ```go > filesystemOperation, err := sdk.Services().Compute().V1(). > Filesystem().Create( > ctx, > &compute.CreateFilesystemRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.FilesystemSpec{ > Size: &compute.FilesystemSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > BlockSizeBytes: 4096, > Type: compute.FilesystemSpec_NETWORK_SSD, > }, > }, > ) > if err != nil { > return err > } > if _, err = filesystemOperation.Wait(ctx); err != nil { > return err > } > ``` > > For more information about filesystem creation, see [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > You don't need to create disks for the VM in advance. You can create them along with the VM. Such disks are called [VM-managed](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). They are tied to the VM lifecycle. > > 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. > > Create a GPU cluster: > > ```go > gpuClusterOperation, err := sdk.Services().Compute().V1(). > GpuCluster().Create( > ctx, > &compute.CreateGpuClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.GpuClusterSpec{ > InfinibandFabric: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = gpuClusterOperation.Wait(ctx); err != nil { > return err > } > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 3. (Optional) Create a [service account](https://docs.nebius.com/iam/service-accounts/manage.md) that will perform actions on behalf of the VM: > > ```go > serviceAccountOperation, err := sdk.Services().IAM().V1(). > ServiceAccount().Create( > ctx, > &iam.CreateServiceAccountRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &iam.ServiceAccountSpec{}, > }, > ) > if err != nil { > return err > } > if _, err = serviceAccountOperation.Wait(ctx); err != nil { > return err > } > serviceAccountID := serviceAccountOperation.ResourceID() > ``` > > 4. Create the VM: > > ```go > managedBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > DeviceId: "", > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: , > }, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "", > }, > }, > }, > }, > }, > } > managedSecondaryDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > DeviceId: "device-2", > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-secondary-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > Type: compute.DiskSpec_NETWORK_SSD, > }, > }, > }, > } > managedFilesystem := &compute.AttachedFilesystemSpec{ > AttachMode: compute.AttachedFilesystemSpec_READ_WRITE, > MountTag: "", > Type: &compute.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: &compute.ExistingFilesystem{ > Id: filesystemID, > }, > }, > } > managedNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > managedVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > ServiceAccountId: serviceAccountID, > Stopped: , > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > GpuCluster: &compute.InstanceGpuClusterSpec{ > Id: gpuClusterID, > }, > BootDisk: managedBootDisk, > SecondaryDisks: []*compute.AttachedDiskSpec{ > managedSecondaryDisk, > }, > Filesystems: []*compute.AttachedFilesystemSpec{ > managedFilesystem, > }, > CloudInitUserData: userData, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > managedNetwork, > }, > Hostname: "", > ReservationPolicy: &compute.ReservationPolicy{ > Policy: compute.ReservationPolicy_FORBID, > }, > RecoveryPolicy: compute.InstanceRecoveryPolicy_FAIL, > Preemptible: &compute.PreemptibleSpec{ > OnPreemption: compute.PreemptibleSpec_STOP, > }, > PricingModel: &compute.InstanceSpec_FollowsSpotPrice{ > FollowsSpotPrice: &compute.FollowsSpotPriceSpec{}, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = managedVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * `Metadata.Name`: VM's name. > * `Spec.ServiceAccountId` (optional): Service account associated with the VM. > * `Spec.Stopped` (optional): If you want to create a VM but not launch it, specify the `true` value. The VM will remain in the `Stopped` status. > * `Spec.Resources.Platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > * `Spec.Resources.Size.Preset`: VM preset. Depends on the chosen platform. > * `Spec.GpuCluster.Id` (optional): ID of the GPU cluster created earlier. > * `managedBootDisk.AttachMode`: Write permission of the boot disk. The only supported value is `READ_WRITE`. > * `managedBootDisk.DeviceId` (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. > * `managedBootDisk.ManagedDisk.Name`: Name of the [VM-managed boot disk](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks) that you create along with the VM. > * `managedBootDisk.ManagedDisk.Spec.SizeGibibytes`: Disk size in gibibytes. Maximum boot disk size is 30,720 GiB (30 TiB). > * `managedBootDisk.ManagedDisk.Spec.Type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `managedBootDisk.ManagedDisk.Spec.SourceImageFamily.ImageFamily`: Public image that Nebius AI Cloud supports. For the list of available public images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > * `managedSecondaryDisk.AttachMode`: Write permission of the additional disk. The only supported value is `READ_WRITE`. > * `managedSecondaryDisk.DeviceId`: User-defined ID for mounting the additional disk to the VM. > * `managedSecondaryDisk.ManagedDisk.Name`: Name of a new additional VM-managed disk. > * `managedSecondaryDisk.ManagedDisk.Spec.SizeGibibytes`: Size of the additional disk in gibibytes. > * `managedSecondaryDisk.ManagedDisk.Spec.Type`: Disk type of the additional disk. > * `managedFilesystem.AttachMode`: Write permission of the filesystem. The only supported value is `READ_WRITE`. > * `managedFilesystem.MountTag`: Tag for mounting the filesystem to the VM. > * `managedFilesystem.ExistingFilesystem.Id`: ID of the filesystem created earlier. > * `Spec.CloudInitUserData` (optional): Configuration of VM users in the [cloud-init](https://cloud-init.io/) format. > * `managedNetwork.SubnetId`: ID of the subnet to attach the VM to. > * `managedNetwork.IpAddress`: Private IP address settings. > * `managedNetwork.PublicIpAddress`: Public IP address settings. In the example, an empty `PublicIPAddress` assigns a dynamic public IP address. > * `Spec.Hostname` (optional): Hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). By default, the FQDN has the `..compute.internal.` format. > * `Spec.ReservationPolicy.Policy` (optional): Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/compute/virtual-machines/reservations.md) and run your VM based on them. > * `Spec.RecoveryPolicy` (optional): Defines what Compute does with the VM after it is preempted or fails. > * `Spec.Preemptible.OnPreemption` (required for preemptible VMs): Makes the VM preemptible and specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > * `Spec.PricingModel` (required for preemptible VMs): `FollowsSpotPrice` accepts the current spot price without setting a maximum spot price. To set a maximum spot price, use `SpotPricingPolicy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [tab] Python SDK > > 1. (Optional) If you want to attach a filesystem to your VM, create this filesystem: > > ```python > filesystem_service = FilesystemServiceClient(sdk) > filesystem_operation = await filesystem_service.create( > CreateFilesystemRequest( > metadata=ResourceMetadata(name=""), > spec=FilesystemSpec( > block_size_bytes=4096, > type=FilesystemSpec.FilesystemType.NETWORK_SSD, > size_gibibytes=10, > ), > ), > ) > await filesystem_operation.wait() > ``` > > For more information about filesystem creation, see [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > You don't need to create disks for the VM in advance. You can create them along with the VM. Such disks are called [VM-managed](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). They are tied to the VM lifecycle. > > 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. > > Create a GPU cluster: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > gpu_cluster_operation = await gpu_cluster_service.create( > CreateGpuClusterRequest( > metadata=ResourceMetadata( > name="", > ), > spec=GpuClusterSpec( > infiniband_fabric="", > ), > ), > ) > await gpu_cluster_operation.wait() > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 3. (Optional) Create a [service account](https://docs.nebius.com/iam/service-accounts/manage.md) that will perform actions on behalf of the VM: > > ```python > service_account_service = ServiceAccountServiceClient(sdk) > service_account_operation = await service_account_service.create( > CreateServiceAccountRequest( > metadata=ResourceMetadata( > name="", > ), > spec=ServiceAccountSpec(), > ), > ) > await service_account_operation.wait() > service_account_id = service_account_operation.resource_id > ``` > > 4. Create the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > managed_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > service_account_id=service_account_id, > stopped=, > resources=ResourcesSpec( > platform="", > preset="", > ), > gpu_cluster=InstanceGpuClusterSpec( > id=gpu_cluster_id, > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="", > spec=DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=( > SourceImageFamily( > image_family="", > ) > ), > size_gibibytes=, > ), > ), > device_id="", > ), > secondary_disks=[ > AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-secondary-disk", > spec=DiskSpec( > type=( > DiskSpec.DiskType.NETWORK_SSD > ), > size_gibibytes=10, > ), > ), > device_id="device-2", > ), > ], > filesystems=[ > AttachedFilesystemSpec( > attach_mode=( > AttachedFilesystemSpec.AttachMode.READ_WRITE > ), > existing_filesystem=ExistingFilesystem( > id=filesystem_id, > ), > mount_tag="", > ), > ], > cloud_init_user_data=user_data, > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > hostname="", > reservation_policy=ReservationPolicy( > policy=ReservationPolicy.Policy.FORBID, > ), > recovery_policy=InstanceRecoveryPolicy.FAIL, > preemptible=PreemptibleSpec( > on_preemption=( > PreemptibleSpec.PreemptionPolicy.STOP > ), > ), > follows_spot_price=FollowsSpotPriceSpec(), > ), > ), > ) > await managed_vm_operation.wait() > ``` > > The code contains the following parameters: > > * `metadata.name`: VM's name. > * `spec.service_account_id` (optional): Service account associated with the VM. > * `spec.stopped` (optional): If you want to create a VM but not launch it, specify the `True` value. The VM will remain in the `Stopped` status. > * `spec.resources.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.resources.preset`: VM preset. Depends on the chosen platform. > * `spec.gpu_cluster.id` (optional): ID of the GPU cluster created earlier. > * `spec.boot_disk.attach_mode`: Write permission of the boot disk. The only supported value is `READ_WRITE`. > * `spec.boot_disk.managed_disk.name`: Name of the [VM-managed boot disk](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks) that you create along with the VM. > * `spec.boot_disk.managed_disk.spec.type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `spec.boot_disk.managed_disk.spec.source_image_family.image_family`: Public image that Nebius AI Cloud supports. For the list of available public images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > * `spec.boot_disk.managed_disk.spec.size_gibibytes`: Disk size in gibibytes. Maximum boot disk size is 30,720 GiB (30 TiB). > * `spec.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. > * `spec.secondary_disks[].attach_mode`: Write permission of the additional disk. The only supported value is `READ_WRITE`. > * `spec.secondary_disks[].managed_disk.name`: Name of a new additional VM-managed disk. > * `spec.secondary_disks[].managed_disk.spec.type`: Disk type of the additional disk. > * `spec.secondary_disks[].managed_disk.spec.size_gibibytes`: Size of the additional disk in gibibytes. > * `spec.secondary_disks[].device_id`: User-defined ID for mounting the additional disk to the VM. > * `spec.filesystems[].attach_mode`: Write permission of the filesystem. The only supported value is `READ_WRITE`. > * `spec.filesystems[].existing_filesystem.id`: ID of the filesystem created earlier. > * `spec.filesystems[].mount_tag`: Tag for mounting the filesystem to the VM. > * `spec.cloud_init_user_data` (optional): Configuration of VM users in the [cloud-init](https://cloud-init.io/) format. > * `spec.network_interfaces[].subnet_id`: ID of the subnet to attach the VM to. > * `spec.network_interfaces[].ip_address`: Private IP address settings. > * `spec.network_interfaces[].public_ip_address`: Public IP address settings. In the example, an empty `PublicIPAddress` assigns a dynamic public IP address. > * `spec.hostname` (optional): Hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). By default, the FQDN has the `..compute.internal.` format. > * `spec.reservation_policy.policy` (optional): Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/compute/virtual-machines/reservations.md) and run your VM based on them. > * `spec.recovery_policy` (optional): Defines what Compute does with the VM after it is preempted or fails. > * `spec.preemptible.on_preemption` (required for preemptible VMs): Makes the VM preemptible and specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > * `spec.follows_spot_price` (required for preemptible VMs unless you use `spec.spot_pricing_policy`): Accepts the current spot price without setting a maximum spot price. To set a maximum spot price, use `spec.spot_pricing_policy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [tab] JavaScript SDK > > 1. (Optional) If you want to attach a filesystem to your VM, create this filesystem: > > ```ts > const filesystemCreateService = new FilesystemService(sdk); > const filesystemOperation = > await filesystemCreateService.create( > CreateFilesystemRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: FilesystemSpec.create({ > blockSizeBytes: 4096, > type: FilesystemSpec_FilesystemType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > ).result; > await filesystemOperation.wait(); > ``` > > For more information about filesystem creation, see [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > You don't need to create disks for the VM in advance. You can create them along with the VM. Such disks are called [VM-managed](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). They are tied to the VM lifecycle. > > 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. > > Create a GPU cluster: > > ```ts > const gpuClusterCreateService = new GpuClusterService(sdk); > const gpuClusterOperation = > await gpuClusterCreateService.create( > CreateGpuClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: GpuClusterSpec.create({ > infinibandFabric: "", > }), > }), > ).result; > await gpuClusterOperation.wait(); > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 3. (Optional) Create a [service account](https://docs.nebius.com/iam/service-accounts/manage.md) that will perform actions on behalf of the VM: > > ```ts > const serviceAccountCreateService = > new ServiceAccountService(sdk); > const serviceAccountOperation = > await serviceAccountCreateService.create( > CreateServiceAccountRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: ServiceAccountSpec.create({}), > }), > ).result; > await serviceAccountOperation.wait(); > const serviceAccountId = > serviceAccountOperation.resourceId(); > ``` > > 4. Create the VM: > > ```ts > const managedVmService = new InstanceService(sdk); > const managedVmOperation = await managedVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > serviceAccountId, > stopped: , > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > gpuCluster: InstanceGpuClusterSpec.create({ > id: gpuClusterId, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "", > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: , > }, > }), > }), > }, > }), > secondaryDisks: [ > AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "device-2", > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-secondary-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > }, > }), > ], > filesystems: [ > AttachedFilesystemSpec.create({ > attachMode: > AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "", > type: { > $case: "existingFilesystem", > existingFilesystem: ExistingFilesystem.create({ > id: filesystemId, > }), > }, > }), > ], > cloudInitUserData: userData, > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > hostname: "", > reservationPolicy: ReservationPolicy.create({ > policy: ReservationPolicy_Policy.FORBID, > }), > recoveryPolicy: InstanceRecoveryPolicy.FAIL, > preemptible: PreemptibleSpec.create({ > onPreemption: > PreemptibleSpec_PreemptionPolicy.STOP, > }), > pricingModel: { > $case: "followsSpotPrice", > followsSpotPrice: FollowsSpotPriceSpec.create({}), > }, > }), > }), > ).result; > await managedVmOperation.wait(); > ``` > > The code contains the following parameters: > > * `metadata.name`: VM's name. > * `spec.serviceAccountId` (optional): Service account associated with the VM. > * `spec.stopped` (optional): If you want to create a VM but not launch it, specify the `true` value. The VM will remain in the `Stopped` status. > * `spec.resources.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.resources.size.preset`: VM preset. Depends on the chosen platform. > * `spec.gpuCluster.id` (optional): ID of the GPU cluster created earlier. > * `spec.bootDisk.attachMode`: Write permission of the boot disk. The only supported value is `READ_WRITE`. > * `spec.bootDisk.deviceId` (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. > * `spec.bootDisk.type.managedDisk.name`: Name of the [VM-managed boot disk](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks) that you create along with the VM. > * `spec.bootDisk.type.managedDisk.spec.type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `spec.bootDisk.type.managedDisk.spec.source.sourceImageFamily.imageFamily`: Public image that Nebius AI Cloud supports. For the list of available public images, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > * `spec.bootDisk.type.managedDisk.spec.size.sizeGibibytes`: Disk size in gibibytes. Maximum boot disk size is 30,720 GiB (30 TiB). > * `spec.secondaryDisks[].attachMode`: Write permission of the additional disk. The only supported value is `READ_WRITE`. > * `spec.secondaryDisks[].deviceId`: User-defined ID for mounting the additional disk to the VM. > * `spec.secondaryDisks[].type.managedDisk.name`: Name of a new additional VM-managed disk. > * `spec.secondaryDisks[].type.managedDisk.spec.type`: Disk type of the additional disk. > * `spec.secondaryDisks[].type.managedDisk.spec.size.sizeGibibytes`: Size of the additional disk in gibibytes. > * `spec.filesystems[].attachMode`: Write permission of the filesystem. The only supported value is `READ_WRITE`. > * `spec.filesystems[].mountTag`: Tag for mounting the filesystem to the VM. > * `spec.filesystems[].type.existingFilesystem.id`: ID of the filesystem created earlier. > * `spec.cloudInitUserData` (optional): Configuration of VM users in the [cloud-init](https://cloud-init.io/) format. > * `spec.networkInterfaces[].subnetId`: ID of the subnet to attach the VM to. > * `spec.networkInterfaces[].ipAddress`: Private IP address settings. > * `spec.networkInterfaces[].publicIpAddress`: Public IP address settings. In the example, an empty `PublicIPAddress` assigns a dynamic public IP address. > * `spec.hostname` (optional): Hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). By default, the FQDN has the `..compute.internal.` format. > * `spec.reservationPolicy.policy` (optional): Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/compute/virtual-machines/reservations.md) and run your VM based on them. > * `spec.recoveryPolicy` (optional): Defines what Compute does with the VM after it is preempted or fails. > * `spec.preemptible.onPreemption` (required for preemptible VMs): Makes the VM preemptible and specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > * `spec.pricingModel.followsSpotPrice` (required for preemptible VMs unless you use `spec.pricingModel.spotPricingPolicy`): Accepts the current spot price without setting a maximum spot price. To set a maximum spot price, use `spec.pricingModel.spotPricingPolicy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. ## Examples ### Create a VM without an additional disk or filesystem > [tab] CLI > > To create a VM, run the following command: > > ```bash > nebius compute instance create \ > --name \ > --resources-platform \ > --resources-preset \ > --boot-disk-managed-disk-name managed-boot-disk \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 10 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --boot-disk-attach-mode READ_WRITE \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": ""}]' > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the command parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli). > [tab] Terraform > > 1. Create a VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > managed_disk = { > name = "managed-boot-disk" > spec = { > type = "NETWORK_SSD" > size_gibibytes = 10 > source_image_family = { > image_family = "ubuntu24.04-driverless" > } > } > } > attach_mode = "READ_WRITE" > } > network_interfaces = [ > { > name = "eth0" > ip_address = {} > public_ip_address = {} > subnet_id = "" > } > ] > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the configuration parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Create a VM: > > ```go > simpleBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-boot-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > }, > }, > }, > } > simpleNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > simpleVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: simpleBootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > simpleNetwork, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = simpleVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk). > [tab] Python SDK > > Create a VM: > > ```python > instance_service = InstanceServiceClient(sdk) > simple_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-boot-disk", > spec=DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=( > SourceImageFamily( > image_family=( > "ubuntu24.04-driverless" > ), > ) > ), > size_gibibytes=10, > ), > ), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await simple_vm_operation.wait() > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk). > [tab] JavaScript SDK > > Create a VM: > > ```ts > const simpleVmService = new InstanceService(sdk); > const simpleVmOperation = await simpleVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-boot-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await simpleVmOperation.wait(); > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk). ### Create a VM with an additional disk > [tab] CLI > > Create a VM, its boot disk and an additional disk together: > > ```bash > nebius compute instance create \ > --name \ > --resources-platform \ > --resources-preset \ > --boot-disk-managed-disk-name managed-boot-disk \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 10 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --boot-disk-attach-mode READ_WRITE \ > --secondary-disks "[{\"attach_mode\": \"READ_WRITE\", \"device_id\": \"device-1\", \"managed_disk\": { \"name\": \"managed-secondary-disk\", \"spec\": { \"type\": \"network_ssd\", \"size_gibibytes\": 10 }}}]" \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": ""}]' > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the command parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli). > [tab] Terraform > > 1. Create a VM, its boot disk and an additional disk together: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > managed_disk = { > name = "managed-boot-disk" > spec = { > type = "NETWORK_SSD" > size_gibibytes = 10 > source_image_family = { > image_family = "ubuntu24.04-driverless" > } > } > } > attach_mode = "READ_WRITE" > } > secondary_disks = [ > { > managed_disk = { > name = "managed-additional-disk" > spec = { > type = "" > size_gibibytes = > } > } > attach_mode = "READ_WRITE" > device_id = "device-1" > } > ] > network_interfaces = [ > { > name = "eth0" > ip_address = {} > public_ip_address = {} > subnet_id = "" > } > ] > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the configuration parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Create a VM, its boot disk and an additional disk together: > > ```go > additionalBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-boot-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > }, > }, > }, > } > additionalDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > DeviceId: "device-1", > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-secondary-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: , > }, > Type: compute.DiskSpec_NETWORK_SSD, > }, > }, > }, > } > additionalNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > additionalVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: additionalBootDisk, > SecondaryDisks: []*compute.AttachedDiskSpec{ > additionalDisk, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > additionalNetwork, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = additionalVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk). > [tab] Python SDK > > Create a VM, its boot disk and an additional disk together: > > ```python > instance_service = InstanceServiceClient(sdk) > additional_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-boot-disk", > spec=DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=( > SourceImageFamily( > image_family=( > "ubuntu24.04-driverless" > ), > ) > ), > size_gibibytes=10, > ), > ), > ), > secondary_disks=[ > AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-secondary-disk", > spec=DiskSpec( > type=( > DiskSpec.DiskType.NETWORK_SSD > ), > size_gibibytes=, > ), > ), > device_id="device-1", > ), > ], > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await additional_vm_operation.wait() > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk). > [tab] JavaScript SDK > > Create a VM, its boot disk and an additional disk together: > > ```ts > const additionalVmService = new InstanceService(sdk); > const additionalVmOperation = > await additionalVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-boot-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > }, > }), > secondaryDisks: [ > AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "device-1", > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-secondary-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: , > }, > }), > }), > }, > }), > ], > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await additionalVmOperation.wait(); > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk). ### Create a VM with a filesystem > [tab] CLI > > 1. Create a filesystem: > > ```bash > nebius compute filesystem create \ > --name \ > --size-gibibytes 10 \ > --type network_ssd \ > --block-size-bytes 4096 > ``` > > Save the filesystem ID from the output `metadata.id` parameter. > > > [!WARNING] > > > > [Mount filesystems](https://docs.nebius.com/compute/storage/use.md#shared-filesystems-cli) after you create the VM. Otherwise, the filesystems are not attached to the VM. > > 2. Create the VM: > > ```bash > nebius compute instance create \ > --name \ > --stopped= \ > --resources-platform \ > --resources-preset \ > --boot-disk-managed-disk-name managed-boot-disk \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 10 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --boot-disk-attach-mode READ_WRITE \ > --filesystems '[{"existing_filesystem": {"id": ""}, "attach_mode": "READ_WRITE", "mount_tag": ""}]' \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": ""}]' > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the command parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli). > [tab] Terraform > > 1. Create a filesystem: > > ```hcl > resource "nebius_compute_v1_filesystem" "my_filesystem" { > name = "" > parent_id = "" > size_gibibytes = 10 > type = "NETWORK_SSD" > block_size_bytes = 4096 > } > ``` > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > > [!WARNING] > > > > [Mount filesystems](https://docs.nebius.com/compute/storage/use.md#shared-filesystems) after you create the VM. Otherwise, the filesystems are not attached to the VM. > > 2. Create the VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > managed_disk = { > name = "managed-boot-disk" > spec = { > type = "NETWORK_SSD" > size_gibibytes = 10 > source_image_family = { > image_family = "ubuntu24.04-driverless" > } > } > } > attach_mode = "READ_WRITE" > } > filesystems = [ > { > existing_filesystem = { > id = nebius_compute_v1_filesystem.my_filesystem.id > } > attach_mode = "READ_WRITE" > mount_tag = "" > } > ] > network_interfaces = [ > { > name = "eth0" > ip_address = {} > public_ip_address = {} > subnet_id = "" > } > ] > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the configuration parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform). > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Create a filesystem: > > ```go > filesystemOperation, err := sdk.Services().Compute().V1(). > Filesystem().Create( > ctx, > &compute.CreateFilesystemRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.FilesystemSpec{ > Size: &compute.FilesystemSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > BlockSizeBytes: 4096, > Type: compute.FilesystemSpec_NETWORK_SSD, > }, > }, > ) > if err != nil { > return err > } > if _, err = filesystemOperation.Wait(ctx); err != nil { > return err > } > ``` > > > [!WARNING] > > > > [Mount filesystems](https://docs.nebius.com/compute/storage/use.md#shared-filesystems-go-sdk) after you create the VM. Otherwise, the filesystems are not attached to the VM. > > 2. Create the VM: > > ```go > filesystemBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-boot-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > }, > }, > }, > } > attachedFilesystem := &compute.AttachedFilesystemSpec{ > AttachMode: compute.AttachedFilesystemSpec_READ_WRITE, > MountTag: "", > Type: &compute.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: &compute.ExistingFilesystem{ > Id: filesystemID, > }, > }, > } > filesystemNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > filesystemVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Stopped: , > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: filesystemBootDisk, > Filesystems: []*compute.AttachedFilesystemSpec{ > attachedFilesystem, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > filesystemNetwork, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = filesystemVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk). > [tab] Python SDK > > 1. Create a filesystem: > > ```python > filesystem_service = FilesystemServiceClient(sdk) > filesystem_operation = await filesystem_service.create( > CreateFilesystemRequest( > metadata=ResourceMetadata(name=""), > spec=FilesystemSpec( > block_size_bytes=4096, > type=FilesystemSpec.FilesystemType.NETWORK_SSD, > size_gibibytes=10, > ), > ), > ) > await filesystem_operation.wait() > ``` > > > [!WARNING] > > > > [Mount filesystems](https://docs.nebius.com/compute/storage/use.md#shared-filesystems-python-sdk) after you create the VM. Otherwise, the filesystems are not attached to the VM. > > 2. Create the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > filesystem_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > stopped=, > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-boot-disk", > spec=DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=( > SourceImageFamily( > image_family=( > "ubuntu24.04-driverless" > ), > ) > ), > size_gibibytes=10, > ), > ), > ), > filesystems=[ > AttachedFilesystemSpec( > attach_mode=( > AttachedFilesystemSpec.AttachMode.READ_WRITE > ), > existing_filesystem=ExistingFilesystem( > id=filesystem_id, > ), > mount_tag="", > ), > ], > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await filesystem_vm_operation.wait() > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk). > [tab] JavaScript SDK > > 1. Create a filesystem: > > ```ts > const filesystemCreateService = new FilesystemService(sdk); > const filesystemOperation = > await filesystemCreateService.create( > CreateFilesystemRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: FilesystemSpec.create({ > blockSizeBytes: 4096, > type: FilesystemSpec_FilesystemType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > ).result; > await filesystemOperation.wait(); > ``` > > > [!WARNING] > > > > [Mount filesystems](https://docs.nebius.com/compute/storage/use.md#shared-filesystems-javascript-sdk) after you create the VM. Otherwise, the filesystems are not attached to the VM. > > 2. Create the VM: > > ```ts > const filesystemVmService = new InstanceService(sdk); > const filesystemVmOperation = > await filesystemVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > stopped: , > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-boot-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > }, > }), > filesystems: [ > AttachedFilesystemSpec.create({ > attachMode: > AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "", > type: { > $case: "existingFilesystem", > existingFilesystem: ExistingFilesystem.create({ > id: filesystemId, > }), > }, > }), > ], > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await filesystemVmOperation.wait(); > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk). ### Create a VM with local SSD disks > [!NOTE] > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > [tab] CLI > > To create a VM with local SSD disks, run the following command: > > ```bash > nebius compute instance create \ > --name \ > --stopped= \ > --resources-platform \ > --resources-preset \ > --boot-disk-managed-disk-name managed-boot-disk \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 10 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --boot-disk-attach-mode READ_WRITE \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": ""}]' \ > --local-disks-passthrough-group-requested=true > ``` > > This adds ephemeral local storage to the VM. > > The example creates a private IPv4 address and doesn't assign a public IPv4 address. For more information about the command parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli). > [tab] Terraform > > 1. Create the VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > managed_disk = { > name = "managed-boot-disk" > spec = { > type = "NETWORK_SSD" > size_gibibytes = 10 > source_image_family = { > image_family = "ubuntu24.04-driverless" > } > } > } > attach_mode = "READ_WRITE" > } > network_interfaces = [ > { > name = "eth0" > ip_address = {} > public_ip_address = {} > subnet_id = "" > } > ] > local_disks = { > passthrough_group = { > requested = true > } > } > } > ``` > > This provides a VM with ephemeral local storage. > > The example creates a private IPv4 address and doesn't assign a public IPv4 address. For more information about the configuration parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Create a VM with local SSD disks: > > ```go > localBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-boot-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > }, > }, > }, > } > localDiskNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > passthroughRequest := &compute.PassthroughGroupRequest{ > Requested: true, > } > localDiskRequest := &compute.LocalDisksSpec_PassthroughGroup{ > PassthroughGroup: passthroughRequest, > } > localDiskVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Stopped: , > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: localBootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > localDiskNetwork, > }, > LocalDisks: &compute.LocalDisksSpec{ > Request: localDiskRequest, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = localDiskVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > This adds ephemeral local storage to the VM. > > The example creates a private IPv4 address and doesn't assign a public IPv4 address. For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk). > [tab] Python SDK > > Create a VM with local SSD disks: > > ```python > instance_service = InstanceServiceClient(sdk) > local_disk_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > stopped=, > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-boot-disk", > spec=DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=( > SourceImageFamily( > image_family=( > "ubuntu24.04-driverless" > ), > ) > ), > size_gibibytes=10, > ), > ), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > local_disks=LocalDisksSpec( > passthrough_group=PassthroughGroupRequest( > requested=True, > ), > ), > ), > ), > ) > await local_disk_vm_operation.wait() > ``` > > This adds ephemeral local storage to the VM. > > The example creates a private IPv4 address and doesn't assign a public IPv4 address. For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk). > [tab] JavaScript SDK > > Create a VM with local SSD disks: > > ```ts > const localDiskVmService = new InstanceService(sdk); > const localDiskVmOperation = > await localDiskVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > stopped: , > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-boot-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > localDisks: LocalDisksSpec.create({ > request: { > $case: "passthroughGroup", > passthroughGroup: > PassthroughGroupRequest.create({ > requested: true, > }), > }, > }), > }), > }), > ).result; > await localDiskVmOperation.wait(); > ``` > > This adds ephemeral local storage to the VM. > > The example creates a private IPv4 address and doesn't assign a public IPv4 address. For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk). ### Create a VM with standalone boot and additional disks By default, when you create a VM, its disks are created along with this VM. Such disks are called [VM-managed](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks): their lifecycle is tied to the VM, so when you delete the VM, its disks are deleted along with it. Alternatively, if you already have a disk or you want to keep the disk after the VM deletion, create a standalone disk first and attach it to the VM afterward. To create standalone disks and a VM with them, do the following: > [tab] CLI > > 1. Create a boot disk: > > ```bash > nebius compute disk create \ > --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 [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Create an additional disk: > > ```bash > nebius compute disk create \ > --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](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks. > > 3. Create a VM: > > ```bash > nebius compute instance create \ > --name \ > --resources-platform \ > --resources-preset \ > --boot-disk-existing-disk-id \ > --boot-disk-attach-mode read_write \ > --boot-disk-device-id \ > --secondary-disks "[{\"existing_disk\": {\"id\": \"\"}, \"attach_mode\": \"READ_WRITE\", \"device_id\": \"device-1\"}]" \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_id": ""}]' > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the command parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli). > [tab] Terraform > > 1. Create a boot disk by using the following configuration: > > ```hcl > resource "nebius_compute_v1_disk" "my_boot_disk" { > name = "" > parent_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](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > 2. Create an additional disk: > > ```hcl > resource "nebius_compute_v1_disk" "my_additional_disk" { > name = "" > parent_id = "" > size_gibibytes = "10" > type = "NETWORK_SSD" > block_size_bytes = 4096 > } > ``` > > > [!WARNING] > > > > After you create the VM, [mount the additional disks](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks. > > 3. Create a VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > existing_disk = { > id = nebius_compute_v1_disk.my_boot_disk.id > } > attach_mode = "READ_WRITE" > } > secondary_disks = [ > { > existing_disk = { > id = nebius_compute_v1_disk.my_additional_disk.id > } > attach_mode = "READ_WRITE" > device_id = "" > } > ] > network_interfaces = [ > { > name = "eth0" > ip_address = {} > public_ip_address = {} > subnet_id = "" > } > ] > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the configuration parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform). > > 4. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 5. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Create a boot disk: > > ```go > bootDiskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 50, > }, > BlockSizeBytes: 4096, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = bootDiskOperation.Wait(ctx); err != nil { > return err > } > ``` > > For more information about disk creation, see [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Create an additional disk: > > ```go > addDiskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 10, > }, > BlockSizeBytes: 4096, > Type: compute.DiskSpec_NETWORK_SSD, > }, > }, > ) > if err != nil { > return err > } > if _, err = addDiskOperation.Wait(ctx); err != nil { > return err > } > ``` > > > [!WARNING] > > > > After you create the VM, [mount the additional disks](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks. > > 3. Create a VM: > > ```go > standaloneNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > standaloneAttachMode := compute.AttachedDiskSpec_READ_WRITE > standaloneVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: standaloneAttachMode, > DeviceId: "", > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > }, > SecondaryDisks: []*compute.AttachedDiskSpec{ > { > AttachMode: standaloneAttachMode, > DeviceId: "", > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: additionalDiskID, > }, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > standaloneNetwork, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = standaloneVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk). > [tab] Python SDK > > 1. Create a boot disk: > > ```python > disk_service = DiskServiceClient(sdk) > boot_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata(name=""), > spec=DiskSpec( > block_size_bytes=4096, > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ), > size_gibibytes=50, > ), > ), > ) > await boot_disk_operation.wait() > ``` > > For more information about disk creation, see [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Create an additional disk: > > ```python > disk_service = DiskServiceClient(sdk) > additional_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="", > ), > spec=DiskSpec( > block_size_bytes=4096, > type=DiskSpec.DiskType.NETWORK_SSD, > size_gibibytes=10, > ), > ), > ) > await additional_disk_operation.wait() > ``` > > > [!WARNING] > > > > After you create the VM, [mount the additional disks](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks. > > 3. Create a VM: > > ```python > instance_service = InstanceServiceClient(sdk) > standalone_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=boot_disk_id), > device_id="", > ), > secondary_disks=[ > AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk( > id=additional_disk_id, > ), > device_id="", > ), > ], > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await standalone_vm_operation.wait() > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk). > [tab] JavaScript SDK > > 1. Create a boot disk: > > ```ts > const bootDiskCreateService = new DiskService(sdk); > const bootDiskOperation = await bootDiskCreateService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSpec.create({ > blockSizeBytes: 4096, > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 50, > }, > }), > }), > ).result; > await bootDiskOperation.wait(); > ``` > > For more information about disk creation, see [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Create an additional disk: > > ```ts > const additionalDiskCreateService = new DiskService(sdk); > const additionalDiskOperation = > await additionalDiskCreateService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSpec.create({ > blockSizeBytes: 4096, > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 10, > }, > }), > }), > ).result; > await additionalDiskOperation.wait(); > ``` > > > [!WARNING] > > > > After you create the VM, [mount the additional disks](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) to it. Otherwise, the VM's operating system does not recognize these disks. > > 3. Create a VM: > > ```ts > const standaloneVmService = new InstanceService(sdk); > const standaloneVmOperation = > await standaloneVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > secondaryDisks: [ > AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: additionalDiskId, > }), > }, > }), > ], > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await standaloneVmOperation.wait(); > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk). ### 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. > [tab] CLI > > 1. Create a GPU cluster: > > ```bash > nebius compute gpu-cluster create \ > --name \ > --infiniband-fabric > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > Save the cluster ID from the output `metadata.id` parameter. > > 2. Create a VM: > > ```bash > nebius compute instance create \ > --name \ > --resources-platform \ > --resources-preset \ > --boot-disk-managed-disk-name managed-boot-disk \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 40 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-cuda13.0 \ > --boot-disk-attach-mode READ_WRITE \ > --network-interfaces '[{"name": "eth0", "ip_address": {}, "public_ip_address": {}, "subnet_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](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli). > [tab] Terraform > > 1. Create a GPU cluster: > > ```hcl > resource "nebius_compute_v1_gpu_cluster" "my_gpu_cluster" { > name = "" > parent_id = "" > infiniband_fabric = "" > } > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 2. Create a VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > managed_disk = { > name = "managed-boot-disk" > spec = { > type = "NETWORK_SSD" > size_gibibytes = 40 > source_image_family = { > image_family = "ubuntu24.04-cuda13.0" > } > } > } > attach_mode = "READ_WRITE" > } > network_interfaces = [ > { > name = "eth0" > ip_address = {} > public_ip_address = {} > 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](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform). > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Create a GPU cluster: > > ```go > gpuClusterOperation, err := sdk.Services().Compute().V1(). > GpuCluster().Create( > ctx, > &compute.CreateGpuClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.GpuClusterSpec{ > InfinibandFabric: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = gpuClusterOperation.Wait(ctx); err != nil { > return err > } > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 2. Create a VM: > > ```go > clusterBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "managed-boot-disk", > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 40, > }, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > }, > }, > }, > } > clusterNetwork := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > clusterVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > GpuCluster: &compute.InstanceGpuClusterSpec{ > Id: gpuClusterID, > }, > BootDisk: clusterBootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > clusterNetwork, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = clusterVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk). > [tab] Python SDK > > 1. Create a GPU cluster: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > gpu_cluster_operation = await gpu_cluster_service.create( > CreateGpuClusterRequest( > metadata=ResourceMetadata( > name="", > ), > spec=GpuClusterSpec( > infiniband_fabric="", > ), > ), > ) > await gpu_cluster_operation.wait() > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 2. Create a VM: > > ```python > instance_service = InstanceServiceClient(sdk) > cluster_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="", > preset="", > ), > gpu_cluster=InstanceGpuClusterSpec( > id=gpu_cluster_id, > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > managed_disk=ManagedDisk( > name="managed-boot-disk", > spec=DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=( > SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ) > ), > size_gibibytes=40, > ), > ), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await cluster_vm_operation.wait() > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk). > [tab] JavaScript SDK > > 1. Create a GPU cluster: > > ```ts > const gpuClusterCreateService = new GpuClusterService(sdk); > const gpuClusterOperation = > await gpuClusterCreateService.create( > CreateGpuClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: GpuClusterSpec.create({ > infinibandFabric: "", > }), > }), > ).result; > await gpuClusterOperation.wait(); > ``` > > To select the fabric, see [InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 2. Create a VM: > > ```ts > const clusterVmService = new InstanceService(sdk); > const clusterVmOperation = await clusterVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > gpuCluster: InstanceGpuClusterSpec.create({ > id: gpuClusterId, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk: ManagedDisk.create({ > name: "managed-boot-disk", > spec: DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 40, > }, > }), > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await clusterVmOperation.wait(); > ``` > > The VM is provided with a dynamic public IPv4 address. > > For more information about the code parameters, see [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk). ## "Not enough resources" error Sometimes, demand for virtual machines and GPUs in certain [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md) 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](https://docs.nebius.com/compute/virtual-machines/not-enough-resources.md). ## See also * [Private and public IP addresses of Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/network.md) * [InfiniBand™ networking for Compute virtual machines with GPUs](https://docs.nebius.com/compute/clusters/gpu/index.md) * [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md) * [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md) * [Attaching and mounting Compute volumes to VMs](https://docs.nebius.com/compute/storage/use.md) *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Preemptible virtual machines Source: https://docs.nebius.com/compute/virtual-machines/preemptible.md *Preemptible VMs*, also known as spot VMs or spot instances, are virtual machines that Compute may stop at any time. This can happen, for example, when the system needs resources to launch a regular VM in the same region, or if the current spot price exceeds the maximum price set in the pricing policy associated with the preemptible VM. Compute sends a `SIGTERM` signal 60 seconds before stopping the VM. If your system does not respond in time, Compute sends a `SIGKILL` signal to force shutdown. Compute preserves all data on the volumes attached to a stopped preemptible VM. It does not preserve dynamic resources, such as dynamic public IP addresses. Preemptible VMs can help reduce computing costs for workloads that tolerate interruptions, but they don't provide guaranteed availability. Preemptible VMs are charged at the current [spot price](https://docs.nebius.com/signup-billing/pricing-policy.md). To manage the cost of preemptible VMs, you can: * [Check current spot prices and their history](https://docs.nebius.com/signup-billing/spot-prices.md). * Set the maximum spot price at which your VMs can start and keep running by using a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md). * Run your VMs at the current spot price without a maximum by choosing **Follows spot price**. You can't convert an existing VM from regular to preemptible or the other way around. To get a preemptible VM, create a new one. ## Supported platforms You can run preemptible VMs on all [VM platforms with GPUs](https://docs.nebius.com/compute/virtual-machines/types.md). To get an up-to-date list of platforms, run the `nebius compute platform list` [command](https://docs.nebius.com/cli/reference/compute/platform/list.md). The platforms available for preemptible VMs are marked as `allowed_for_preemptibles: true`. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to create a preemptible VM When you create a preemptible VM, configure one of the [spot pricing](https://docs.nebius.com/signup-billing/pricing-policy.md) settings. You can select a pricing policy to set the maximum price, or follow the spot price to have the VM run at the current spot price. > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. Click **Create resource** → **Virtual machine**. > 3. If you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md), on the **General** step, select **Pay-as-you-go VM**. If you do not have capacity block groups, the wizard skips the **General** step and opens **Compute** instead. > 4. On the **Compute** step, select **With GPUs** or **Without GPUs**, set the VM type to **Preemptible**, and select a [platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). > 5. In **Max price**, select or create a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md), or choose **Follows spot price**. > > For more information about the full wizard, see [How to create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console). > [tab] CLI > > When [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md): > > * Select a [platform that supports preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md#supported-platforms). > > * Add one of the following [spot pricing](https://docs.nebius.com/signup-billing/pricing-policy.md) parameters. The example command below uses `--follows-spot-price`: > > * `--spot-pricing-policy-id `: Select a pricing policy that sets the maximum spot price. For information on how to get a pricing policy ID or create a new policy, see [Managing pricing policies](https://docs.nebius.com/signup-billing/manage-pricing-policy.md). > * `--follows-spot-price`: Accept the current spot price without setting a maximum spot price. > > * Add the following parameters to the `nebius compute instance create` command: > > ```bash > nebius compute instance create \ > ... \ > --recovery-policy fail \ > --preemptible-on-preemption stop \ > --follows-spot-price > ``` > > In this configuration, the following values are specified: > > * `recovery_policy` defines what Compute does with a VM after it's preempted or fails. Preemptible VMs support only the `FAIL` value, which stops the VM. They do not support the `RECOVER` value, which tries to restart the VM. Setting `RECOVER` for a preemptible VM results in an error. > * `on_preemption` specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > > For details about the `nebius compute instance create` command, see the [Nebius AI Cloud CLI reference](https://docs.nebius.com/cli/reference/compute/instance/create.md). > [tab] Terraform > > 1. When creating a VM, select a [platform that supports preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md#supported-platforms) and set the following parameters in the `nebius_compute_v1_instance` resource: > > ```hcl > resource "nebius_compute_v1_instance" "" { > ... > recovery_policy = "FAIL" > preemptible = { > on_preemption = "STOP" > } > follows_spot_price = {} > } > ``` > > `...` stands for the other attributes of the VM configuration. In this configuration, the following values are specified: > > * `recovery_policy` defines what Compute does with a VM after it's preempted or fails. Preemptible VMs support only the `FAIL` value, which stops the VM. They do not support the `RECOVER` value, which tries to restart the VM. Setting `RECOVER` for a preemptible VM results in an error. > > * `on_preemption` specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > > - `follows_spot_price` accepts the current spot price without setting a maximum price. To set a maximum price, use `spot_pricing_policy = { id = "" }` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > When [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md): > > * Select a [platform that supports preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md#supported-platforms). > * Set the preemptible VM parameters in the code: > > ```go > resources := &compute.ResourcesSpec{ > Platform: "gpu-l40s-a", > Size: &compute.ResourcesSpec_Preset{ > Preset: "1gpu-24vcpu-96gb", > }, > } > bootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > } > networkInterface := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > instanceSpec := &compute.InstanceSpec{ > Resources: resources, > BootDisk: bootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > networkInterface, > }, > RecoveryPolicy: compute.InstanceRecoveryPolicy_FAIL, > Preemptible: &compute.PreemptibleSpec{ > OnPreemption: compute.PreemptibleSpec_STOP, > }, > PricingModel: &compute.InstanceSpec_FollowsSpotPrice{ > FollowsSpotPrice: &compute.FollowsSpotPriceSpec{}, > }, > } > preemptibleOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "preemptible-instance", > }, > Spec: instanceSpec, > }, > ) > if err != nil { > return err > } > if _, err = preemptibleOperation.Wait(ctx); err != nil { > return err > } > ``` > > In this configuration, the following values are specified: > > * `RecoveryPolicy` defines what Compute does with a VM after it's preempted or fails. Preemptible VMs support only the `FAIL` value, which stops the VM. They do not support the `RECOVER` value, which tries to restart the VM. Setting `RECOVER` for a preemptible VM results in an error. > * `OnPreemption` specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > * `FollowsSpotPrice` accepts the current spot price without setting a maximum price. To set a maximum price, use `SpotPricingPolicy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [tab] Python SDK > > When [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md): > > * Select a [platform that supports preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md#supported-platforms). > * Set the preemptible VM parameters in the code: > > ```python > instance_service = InstanceServiceClient(sdk) > preemptible_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="preemptible-instance", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="gpu-l40s-a", > preset="1gpu-24vcpu-96gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk(id=boot_disk_id), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > recovery_policy=InstanceRecoveryPolicy.FAIL, > preemptible=PreemptibleSpec( > on_preemption=( > PreemptibleSpec.PreemptionPolicy.STOP > ), > ), > follows_spot_price=FollowsSpotPriceSpec(), > ), > ), > ) > await preemptible_operation.wait() > ``` > > In this configuration, the following values are specified: > > * `recovery_policy` defines what Compute does with a VM after it's preempted or fails. Preemptible VMs support only the `FAIL` value, which stops the VM. They do not support the `RECOVER` value, which tries to restart the VM. Setting `RECOVER` for a preemptible VM results in an error. > > * `on_preemption` specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > > - `follows_spot_price` accepts the current spot price without setting a maximum price. To set a maximum price, use `spot_pricing_policy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [tab] JavaScript SDK > > When [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md): > > * Select a [platform that supports preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md#supported-platforms). > * Set the preemptible VM parameters in the code: > > ```ts > const instanceService = new InstanceService(sdk); > const preemptibleOperation = await instanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "preemptible-instance", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "gpu-l40s-a", > size: { > $case: "preset", > preset: "1gpu-24vcpu-96gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: > AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > recoveryPolicy: InstanceRecoveryPolicy.FAIL, > preemptible: PreemptibleSpec.create({ > onPreemption: > PreemptibleSpec_PreemptionPolicy.STOP, > }), > pricingModel: { > $case: "followsSpotPrice", > followsSpotPrice: FollowsSpotPriceSpec.create({}), > }, > }), > }), > ).result; > await preemptibleOperation.wait(); > ``` > > In this configuration, the following values are specified: > > * `recoveryPolicy` defines what Compute does with a VM after it's preempted or fails. Preemptible VMs support only the `FAIL` value, which stops the VM. They do not support the `RECOVER` value, which tries to restart the VM. Setting `RECOVER` for a preemptible VM results in an error. > * `onPreemption` specifies what happens when the VM is preempted. The only supported value is `STOP`: Compute stops the VM without deleting or restarting it. > * `followsSpotPrice` accepts the current spot price without setting a maximum price. To set a maximum price, use `spotPricingPolicy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [!TIP] > > A dynamic IP address is released when a preemptible VM stops. To keep your workload stable, consider using a static IP address instead. ## How to continue working with a stopped preemptible VM When Compute stops a preemptible VM, it preserves all data on the attached volumes. If the max price in the VM's pricing policy is lower than the current spot price, change the VM's spot pricing setting or wait for the price to drop. To resume work, [start the VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md) again. If you used a dynamic IP address, update all systems that depended on the old IP address. If the VM uses local SSD disks, use them with caution. Local SSD disks are ephemeral, meaning any data stored on them will be lost when the preemptible VM stops. You can also [create a regular VM](https://docs.nebius.com/compute/virtual-machines/create.md) with the same attached volumes. # How to update settings of a virtual machine in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/update.md You can update settings of an existing Compute virtual machine (VM) by using any Nebius AI Cloud interface. For a description of all VM settings, see [Parameters of a virtual machine configuration](https://docs.nebius.com/compute/virtual-machines/params.md). ## Preset A preset defines the resources, the number of vCPUs and the amount of RAM, allocated to a VM on its [platform](https://docs.nebius.com/compute/virtual-machines/types.md). Change a VM's preset when its workload is constrained by its current resources or it has too many of them. Regular and preemptible VMs use the same settings to change their presets. This action requires you to stop the VM. See available presets for [GPU platforms](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-gpu-platforms) and [non-GPU platforms](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-non-gpu-platforms). To update a preset: > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > > 2. Select the VM for which you want to change the preset. > > 3. Click **Stop** and confirm the action. > > Wait for the VM's status to change to `Stopped`. > > 4. On the VM's page, select the **Settings** tab. > > 5. Under **Computing resources**, select the **Preset** you want and click **Save changes**. > > 6. Click **Start VM** and confirm the action. > > Wait for the VM's status to change to `Running`. > [tab] CLI > > 1. Get the ID of the VM for which you want to change the preset: > > ```bash > nebius compute instance list > ``` > > 2. Stop the VM: > > ```bash > nebius compute instance stop --id > ``` > > 3. Update the resource preset: > > ```bash > nebius compute instance update \ > --id \ > --parent-id \ > --resources-preset > ``` > > 4. Start the VM: > > ```bash > nebius compute instance start --id > ``` > [tab] Terraform > > 1. Stop the VM: > > 1. Add `stopped = true` to the resource configuration: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > # ... > stopped = true > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > 2. With the VM stopped, update the resource preset: > > 1. Change the `preset` value in the `resources` section: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > # ... > resources = { > platform = "" # Keep the current platform ID. > preset = "" # Update the preset value only. > } > stopped = true > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > 3. Start the VM: > > 1. Change the `stopped` parameter to `false`: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > # ... > stopped = false > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the VM for which you want to change the preset: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List( > ctx, > &compute.ListInstancesRequest{}, > ) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > 2. Stop the VM: > > ```go > stopInstanceOperation, err := sdk.Services().Compute().V1(). > Instance().Stop( > ctx, > &compute.StopInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = stopInstanceOperation.Wait(ctx); err != nil { > return err > } > ``` > > 3. Update the resource preset: > > ```go > instanceToResize, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instanceToResize.GetSpec() == nil { > return errors.New("instance spec is missing") > } > instanceToResize.Spec.Resources. > Size = &compute.ResourcesSpec_Preset{ > Preset: "", > } > updatePresetOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instanceToResize.Metadata, > Spec: instanceToResize.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updatePresetOperation.Wait(ctx); err != nil { > return err > } > ``` > > 4. Start the VM: > > ```go > startOperation, err := sdk.Services().Compute().V1(). > Instance().Start( > ctx, > &compute.StartInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = startOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the VM for which you want to change the preset: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list(ListInstancesRequest()) > print(instances) > ``` > > 2. Stop the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > stop_instance_operation = await instance_service.stop( > StopInstanceRequest(id=""), > ) > await stop_instance_operation.wait() > ``` > > 3. Update the resource preset: > > ```python > instance_service = InstanceServiceClient(sdk) > instance_to_resize = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance_to_resize.spec is None: > raise ValueError("instance spec is missing") > instance_to_resize.spec.resources.preset = "" > update_preset_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance_to_resize.metadata, > spec=instance_to_resize.spec, > ), > ) > await update_preset_operation.wait() > ``` > > 4. Start the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > start_instance_operation = await instance_service.start( > StartInstanceRequest(id=""), > ) > await start_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the VM for which you want to change the preset: > > ```ts > const manageListInstanceService = new InstanceService(sdk); > const listedInstances = await manageListInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(listedInstances); > ``` > > 2. Stop the VM: > > ```ts > const stopInstanceService = new InstanceService(sdk); > const stopInstanceOperation = await stopInstanceService.stop( > StopInstanceRequest.create({ > id: "", > }), > ).result; > await stopInstanceOperation.wait(); > ``` > > 3. Update the resource preset: > > ```ts > const instanceService = new InstanceService(sdk); > const instanceToResize = await instanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceToResize.spec) { > throw new Error("instance spec is missing"); > } > instanceToResize.spec.resources.size = { > $case: "preset", > preset: "", > }; > const updatePresetOperation = await instanceService.update( > UpdateInstanceRequest.create({ > metadata: instanceToResize.metadata, > spec: instanceToResize.spec, > }), > ).result; > await updatePresetOperation.wait(); > ``` > > 4. Start the VM: > > ```ts > const startInstanceService = new InstanceService(sdk); > const startInstanceOperation = await startInstanceService.start( > StartInstanceRequest.create({ > id: "", > }), > ).result; > await startInstanceOperation.wait(); > ``` ## Hostname A VM's hostname is used to generate its [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). Change the hostname if you want the VM to be reachable by a custom internal DNS name instead of an autogenerated one. You do not need to stop the VM to change its hostname. To set the hostname: > [tab] Web console > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console) with a customized FQDN: > > In the VM creation wizard, on the **Network** step, in the **Hostname** field, select **Custom** and specify the hostname for the VM's FQDN. > > 2. Change the FQDN of the created VM: > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. Select either the **Standalone VMs** or **Kubernetes nodes** tab. > 3. Open the page of the required VM. > 4. Go to the **Settings** tab. > 5. Modify the **Hostname** field. > 6. Click **Save changes**. > [tab] CLI > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli) with a customized FQDN: > > ```bash > nebius compute instance create \ > ... \ > --hostname > ``` > > 2. Change an FQDN of an existing VM: > > ```bash > nebius compute instance update --id --hostname > ``` > [tab] Terraform > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform) with a customized FQDN: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > ... > hostname = "" > ... > } > ``` > > 2. Change the FQDN of the created VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > # ... > hostname = "" > } > ``` > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk) with a customized FQDN: > > ```go > instanceOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "vm-for-scenario", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-d3", > Size: &compute.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > DeviceId: "my-device", > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > Hostname: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > vmID := instanceOperation.ResourceID() > ``` > > 2. Change the FQDN of the created VM: > > ```go > instance, err = sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > instance.Spec.Hostname = "" > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instance.Metadata, > Spec: instance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk) with a customized FQDN: > > ```python > instance_service = InstanceServiceClient(sdk) > create_instance_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="vm-for-scenario"), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=boot_disk_id), > device_id="my-device", > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > hostname="", > ), > ), > ) > await create_instance_operation.wait() > vm_id = create_instance_operation.resource_id > ``` > > 2. Change the FQDN of the created VM: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > instance.spec.hostname = "" > update_instance_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance.metadata, > spec=instance.spec, > ), > ) > await update_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk) with a customized FQDN: > > ```ts > const instanceService = new InstanceService(sdk); > const createInstanceOperation = await instanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "vm-for-scenario", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "my-device", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > hostname: "", > }), > }), > ).result; > await createInstanceOperation.wait(); > const vmId = createInstanceOperation.resourceId(); > ``` > > 2. Change the FQDN of the created VM: > > ```ts > const updateInstanceService = new InstanceService(sdk); > const instanceForHostname = await updateInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceForHostname.spec) { > throw new Error("instance spec is missing"); > } > instanceForHostname.spec.hostname = ""; > const updateInstanceOperation = await updateInstanceService.update( > UpdateInstanceRequest.create({ > metadata: instanceForHostname.metadata, > spec: instanceForHostname.spec, > }), > ).result; > await updateInstanceOperation.wait(); > ``` ## Reservation policy If you apply the reservation policy, the VM's resources are allocated from reservations, which represent [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md). For more information, see [Capacity reservations for Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/reservations.md). Change the reservation policy in the following cases: * You got reservations after creating the VM and you want the VM to use them. * A reservation is about to expire or has run out of capacity and you want the VM to use another one. * You want to move the VM out of reservations. VMs of a regular type and with GPUs support reservations. [Preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) and VMs without GPUs do not support them. > [tab] Web console > > If you want to [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console) and you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md), on the **General** step, select **Reserved VM**. On the **Compute** step, select a platform and configure the **Reservation** settings. If you do not have capacity block groups, the wizard skips the **General** step and opens **Compute** instead. > > If you want to modify an existing VM, [stop it](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually-web-console) first and then go to its **Settings** tab on the VM page. Next, update the reservation settings. > > The **Reservation** section is only displayed if you have capacity block groups. > > In the **Reservation** section, you can configure the following options: > > * **Any (existing and future)** (default): Compute selects among your matching capacity block groups automatically. > * **Specific capacity block groups**: Select one or more capacity block groups. Each option shows the capacity block group ID, reservation period, and GPU usage. Make sure the selected groups have enough capacity and do not expire soon. > * **Switch to PAYG**: Choose whether the VM can start after you create or restart it without active intervals in selected capacity block groups: > > * **When reservation is exhausted** (default): The VM can start as a pay-as-you-go VM when no capacity is available in the selected capacity block groups. > * **Never**: The VM cannot start without available capacity in the selected capacity block groups. > > This does not affect the VM when it is running. If an interval in a selected capacity block group expires while the VM is running, the VM always continues as a pay-as-you-go VM, regardless of this setting. > > If you have capacity block groups in multiple regions, select a **Region** first. > [tab] CLI > > Use the `--reservation-policy-*` parameters when creating or updating a VM: > > * To create a VM, use the following command: > > ```bash > nebius compute instance create \ > ... \ > --reservation-policy-policy \ > --reservation-policy-reservation-ids > ``` > > * To update a VM, [stop it](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually-cli) first and then use the following command: > > ```bash > nebius compute instance update \ > ... \ > --reservation-policy-policy \ > --reservation-policy-reservation-ids > ``` > > Description of the parameters: > > * `--reservation-policy-policy`: Policy for reservation usage. Supports the following values: > > * `auto`: VM resources are allocated from reservations. If no reservations are currently available, the VM runs without them. In this case, resources for the VM are provided from the common pool. > > > [!NOTE] > > > > The `auto` value is the default. If you don't have any reservations and you don't set the `--reservation-policy-policy` parameter, the `auto` value applies and the VM runs without reservations. > * `forbid`: VM resources are provided from the common pool, and no reservations are used. > * `strict`: VM resources are exclusively allocated from reservations. The VM doesn't run without the reservations. > * `--reservation-policy-reservation-ids` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation-ids` | **Behavior** | > | - | - | - | > | `auto` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `auto` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `forbid` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `forbid` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `strict` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `strict` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] Terraform > > Use the `reservation_policy` parameter in the VM configuration: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > ... > reservation_policy = { > policy = "" > reservation_ids = "" > } > ... > } > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the following values: > > * `AUTO`: VM resources are allocated from reservations. If no reservations are currently available, the VM runs without them. In this case, resources for the VM are provided from the common pool. > > > [!NOTE] > > > > The `AUTO` value is the default. If you don't have any reservations and you don't set the `policy` parameter, the `AUTO` value applies and the VM runs without reservations. > * `FORBID`: VM resources are provided from the common pool, and no reservations are used. > * `STRICT`: VM resources are exclusively allocated from reservations. The VM doesn't run without the reservations. > * `reservation_ids`: IDs of specific reservations (capacity block groups). You can use this parameter with the `AUTO` and `STRICT` reservation usages: > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation_ids` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] Go SDK > > Use `ReservationPolicy` in `InstanceSpec` when creating or updating a VM: > > ```go > reservationPolicy := &compute.ReservationPolicy{ > Policy: compute.ReservationPolicy_STRICT, > ReservationIds: []string{ > "", > }, > } > ``` > > Description of the parameters: > > * `Policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `ReservationIds` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `Policy` | `ReservationIds` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] Python SDK > > Use `reservation_policy` in `InstanceSpec` when creating or updating a VM: > > ```python > reservation_policy = ReservationPolicy( > policy=ReservationPolicy.Policy.STRICT, > reservation_ids=[""], > ) > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `reservation_ids` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation_ids` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] JavaScript SDK > > Use `reservationPolicy` in `InstanceSpec` when creating or updating a VM: > > ```ts > const reservationPolicy = ReservationPolicy.create({ > policy: ReservationPolicy_Policy.STRICT, > reservationIds: [""], > }); > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `reservationIds` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservationIds` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | ## Network interfaces You can change the following parts of a VM's network configuration without recreating the VM: * [Enable a public IP address for an existing VM](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-enable-a-public-ip-address-for-an-existing-vm) * [Migrate a static public IP address from one VM to another](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-migrate-a-public-static-ip-address-from-one-vm-to-another) * [Detach an IP address from a VM](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-detach-an-ip-address-from-a-vm) * [Assign a secondary private IP address to a VM](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-assign-a-secondary-private-ip-address-to-a-vm) # Deleting a Compute virtual machine Source: https://docs.nebius.com/compute/virtual-machines/delete.md If [standalone disks](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks) or filesystems are attached to your virtual machine (VM), Compute doesn't automatically delete them. To stop being charged for volumes you no longer need, [delete](https://docs.nebius.com/compute/storage/manage.md#how-to-delete-a-volume) these volumes separately. If VM-managed disks are attached to your VM, they are deleted along with the VM automatically. Charges for these disks stop immediately. To delete a VM: > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. On the **Standalone VMs** tab, click the virtual machine you want to delete. > 2. On the VM page, go to the **Settings** tab. > 3. Click **Delete virtual machine**. > 4. In the window that opens, confirm the deletion. > [tab] CLI > > 1. Get the ID of the virtual machine you want to delete: > > ```bash > nebius compute instance list > ``` > > 2. Delete the virtual machine: > > ```bash > nebius compute instance delete > ``` > [tab] Terraform > > 1. Remove the corresponding `nebius_compute_v1_instance` resource from the configuration file. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the virtual machine you want to delete: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List( > ctx, > &compute.ListInstancesRequest{}, > ) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > 2. Delete the virtual machine: > > ```go > deleteFinalOperation, err := sdk.Services().Compute().V1(). > Instance().Delete( > ctx, > &compute.DeleteInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deleteFinalOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the virtual machine you want to delete: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list(ListInstancesRequest()) > print(instances) > ``` > > 2. Delete the virtual machine: > > ```python > instance_service = InstanceServiceClient(sdk) > delete_final_operation = await instance_service.delete( > DeleteInstanceRequest(id=""), > ) > await delete_final_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the virtual machine you want to delete: > > ```ts > const manageListInstanceService = new InstanceService(sdk); > const listedInstances = await manageListInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(listedInstances); > ``` > > 2. Delete the virtual machine: > > ```ts > const finalVmDeleteService = new InstanceService(sdk); > const deleteFinalVmOperation = > await finalVmDeleteService.delete( > DeleteInstanceRequest.create({ > id: "", > }), > ).result; > await deleteFinalVmOperation.wait(); > ``` # How to access VM metadata Source: https://docs.nebius.com/compute/virtual-machines/instance-metadata.md The *instance metadata service* (IMDS) provides information about a running virtual machine (VM), including metadata, labels, resources, user data, and network data. ## How to access IMDS IMDS is available only from within a VM itself. Once you connect to a VM, use the following base URL to request metadata: ``` http://metadata.nebius.internal ``` All IMDS requests must use the `GET` method and include the `Metadata: true` header. Requests without this header return `400 Bad Request`. Requests that use any method other than `GET` return `405 Method Not Allowed`. IMDS blocks requests containing any of the following forwarding headers and returns `403 Forbidden`: * `X-Forwarded-For` * `X-Forwarded-Host` * `X-Real-IP` * `Forwarded` ### Metadata updates IMDS provides metadata captured at VM start time. The following endpoints are not refreshed in real time: * `instance-data` * `parent-data` * `network-data` * `user-data` To get updated values from these endpoints after a change, stop and restart the VM. > [!NOTE] > > Unlike the other endpoints, `instance-events` provides live updates and does not require a VM restart. A maintenance event may take up to five minutes to appear in the response. ## Example requests The following examples show how to retrieve different types of metadata from IMDS. ### Getting all VM metadata To get all available VM metadata in JSON format, run: ```bash curl http://metadata.nebius.internal/v1/instance-data \ -H "Metadata: true" ``` Example output: ```json { "id": "computeinstance-***", "parent_id": "project-***", "name": "example-vm", "hostname": "example-hostname", "platform": "gpu-h200-sxm", "preset": "1gpu-16vcpu-200gb", "labels": { "env": "example-env", "runners_count": "24" }, "resource_version": 1, "created_at": "2025-11-11T08:03:31.754114Z", "service_account_id": "serviceaccount-***", "gpu_cluster_id": "computegpucluster-***", "infiniband_fabric": "fabric-5", "infiniband_topology_path": ["hash-1", "hash-2", "hash-3"], "region": "eu-west1" } ``` `labels` is always returned as a JSON object. If no labels were set, IMDS returns an empty object. The following fields are optional and are returned only when available for the VM: * `hostname` * `service_account_id` * `gpu_cluster_id` * `infiniband_fabric` * `infiniband_topology_path` ### Getting a specific metadata field To get a specific metadata field as plain text, run: ```bash curl http://metadata.nebius.internal/v1/instance-data/ \ -H "Metadata: true" ``` Example: ```bash curl http://metadata.nebius.internal/v1/instance-data/id \ -H "Metadata: true" ``` Example output: ``` computeinstance-*** ``` ### Getting VM labels To get all labels for the VM, run: ```bash curl http://metadata.nebius.internal/v1/instance-data/labels \ -H "Metadata: true" ``` Example output: ```json { "env": "example-env", "runners_count": "24" } ``` To get a specific label, run: ```bash curl http://metadata.nebius.internal/v1/instance-data/labels/ \ -H "Metadata: true" ``` Example: ```bash curl http://metadata.nebius.internal/v1/instance-data/labels/env \ -H "Metadata: true" ``` Example output: ``` example-env ``` ### Getting parent resource metadata To get parent resource metadata in JSON format, run: ```bash curl http://metadata.nebius.internal/v1/parent-data \ -H "Metadata: true" ``` Example output: ```json { "id": "project-***", "parent_id": "tenant-***", "name": "example-project", "created_at": "2025-11-11T08:03:30.754114Z", "labels": { "teamcity_build_id": "13672974" } } ``` > [!NOTE] > > To access `parent-data`, the VM must have an attached service account with permissions to read the parent resource metadata. Otherwise, the request returns `403 Forbidden`. ### Getting user data To get the user data that was provided when the VM was created, run: ```bash curl http://metadata.nebius.internal/v1/user-data \ -H "Metadata: true" ``` Example output: ```yaml #cloud-config package_update: true packages: - nginx runcmd: - systemctl enable --now nginx ``` ### Getting network data To get the VM network data, run: ```bash curl http://metadata.nebius.internal/v1/network-data \ -H "Metadata: true" ``` This request returns the network data that cloud-init used to initialize the VM during its first boot. Example output: ```yaml version: 2 ethernets: interface0: match: macaddress: "XX:XX:XX:XX:XX:XX" set-name: "eth0" dhcp4: true mtu: 1450 ``` ### Getting service account information To get information about the service account attached to the VM and its IAM token, run: ```bash curl http://metadata.nebius.internal/v1/iam/sa \ -H "Metadata: true" ``` Example output: ```json { "service_account_id": "serviceaccount-***", "token": { "access_token": "", "expires_at": "2027-01-01T00:00:00Z" } } ``` To get only the IAM token object (the access token and its expiration time), run: ```bash curl http://metadata.nebius.internal/v1/iam/sa/token \ -H "Metadata: true" ``` Example output: ```json { "access_token": "", "expires_at": "2027-01-01T00:00:00Z" } ``` To get only the raw access token string, run: ```bash curl http://metadata.nebius.internal/v1/iam/sa/token/access_token \ -H "Metadata: true" ``` Example output: ``` ``` ### Getting maintenance events To check if a maintenance event is scheduled for the VM, run: ```bash curl http://metadata.nebius.internal/v1/instance-events \ -H "Metadata: true" ``` Example output: ```json { "data": [ { "id": "computemaintenance-***", "type": "maintenance", "status": "scheduled", "created_at": "2026-02-28T15:10:00Z", "not_before": "2026-03-01T10:00:00Z", "extra": { "support_center_ticket_id": "123456", "is_planned": "false" } } ] } ``` If there are no active maintenance events, IMDS returns an empty array: ```json { "data": [] } ``` ## Request throttling Nebius AI Cloud applies throttling to IMDS requests on a per-VM basis to reduce accidental overload and abuse: * 10 requests per second for regular requests * 20 requests per second for burst requests If you exceed the limit, IMDS returns `429 Too Many Requests`. ## Status codes | HTTP status code | Description | | - | - | | `200 OK` | The request succeeded. | | `400 Bad Request` | The `Metadata: true` header is missing or invalid. | | `403 Forbidden` | The VM does not have permission to access the requested resource. | | `404 Not Found` | The requested resource or field does not exist. | | `405 Method Not Allowed` | The request used a method other than `GET`. | | `429 Too Many Requests` | The request rate limit was exceeded. Retry the request. | | `500 Internal Server Error` | The server encountered an error. Retry the request. | | `501 Not Implemented` | The requested feature is not implemented. | | `503 Service Unavailable` | The service is temporarily unavailable, or the request could not be attributed to this VM. Retry the request. | # Parameters of a virtual machine configuration in Compute Source: https://docs.nebius.com/compute/virtual-machines/params.md When you [create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md) (VM) or edit its configuration, you operate with VM settings. Below is the list of the VM settings available in the [web console](https://console.nebius.com) creation wizard and on the VM settings page. ## General If you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md), on the **General** step of the wizard, you choose how Compute allocates resources: * **Reserved VM**: Capacity is assured by your capacity block groups. This option is for regular VMs with GPUs. * **Pay-as-you-go VM**: Capacity is subject to availability. This option allows [preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) and VMs without GPUs. If you do not have capacity block groups, the wizard skips the **General** step and opens **Compute** instead. ## Compute On the **Compute** step, you configure computing resources. The available settings depend on whether you selected **Reserved VM** or **Pay-as-you-go VM** on the **General** step. If the **General** step was skipped, use the **Pay-as-you-go VM** settings below. ### Reserved VM * [Platform](https://docs.nebius.com/compute/virtual-machines/types.md). The list shows platforms that match your capacity block groups. * [**Reservation**](https://docs.nebius.com/compute/virtual-machines/reservations.md) settings: **Region**, **Any (existing and future)**, specific capacity block groups, and **Switch to PAYG** with **When reservation is exhausted** or **Never**. * Preset. * (Optional) [GPU cluster](https://docs.nebius.com/compute/clusters/gpu/index.md). Allows accelerating tasks that require high-performance computing (HPC) power, such as training a model. A GPU cluster only helps if you add at least two VMs with 8 GPUs each to the cluster. * VM name. * Project for the VM location. ### Pay-as-you-go VM * Select **With GPUs** or **Without GPUs** and the VM type **Regular** or [Preemptible](https://docs.nebius.com/compute/virtual-machines/preemptible.md). * [Platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). * **Max price** (for [preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md)): Select or create a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md), or choose **Follows spot price**. * (Optional) [GPU cluster](https://docs.nebius.com/compute/clusters/gpu/index.md). Allows accelerating tasks that require HPC power, such as training a model. A GPU cluster only helps if you add at least two VMs with 8 GPUs each to the cluster. * VM name. * Project for the VM location. ## Storage On the **Storage** step, you can add a boot disk, additional disks, and shared filesystems. For disks, you specify their type, size, and block size. A boot disk is additionally based on an operating system. For more information about these settings, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For shared filesystems, you specify the following settings: * [Name, size and block size](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). * 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. * **Auto mount** option enabled to mount the filesystem to the VM automatically. ## Network On the **Network** step, you select a [network and subnet](https://docs.nebius.com/vpc/overview.md) and manage the VM addresses: * **Private address**: Select whether to allocate a random private IP address for the VM or to attach an allocation of a private address. * **Public address**: Specify whether the VM should have a public IP address and whether it should be static or dynamic. * **Hostname**: Select **Same as VM ID** or specify a **Custom** hostname for the VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). 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](https://docs.nebius.com/compute/virtual-machines/wireguard.md). 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 about the settings of the addresses, see [Private and public IP addresses of Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/network.md). ## Configuration On the **Configuration** step, you configure access, identity and VM startup settings for the VM. ### Access In the **Username and SSH key** field, you add credentials of the user on behalf of whom you can [connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md). The access settings include the following: * Username of the VM user. Cannot be `root` or `admin`. These usernames are reserved for internal needs and are not allowed to connect to a VM by SSH. * [Public key of your SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#getting-the-public-key). * Name of credentials to recognize the key in the list of keys. ### Additional (Optional) **Service account**: Select an existing [service account](https://docs.nebius.com/iam/service-accounts/manage.md) or create a new one. The service account will perform actions on behalf of the VM, for example, run scripts. ### User data (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 to customize how the VM starts. ## Review On the **Review** step, you see a summary of all settings before creating the VM. To edit a section, click next to the corresponding block on the **Review** step. # Maintenance of Compute virtual machines Source: https://docs.nebius.com/compute/virtual-machines/maintenance.md The Compute service performs maintenance for all virtual machines, including nodes of [Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/index.md) clusters and [Soperator](https://docs.nebius.com/slurm-soperator/overview/why-slurm-soperator.md) clusters. To ensure that maintenance is performed successfully, [stop and start VMs](https://docs.nebius.com/compute/virtual-machines/stop-start.md) until the specified date. You can open the list of VMs via the red banner on the top of the screen. For example: ![maintenance-banner](https://mintcdn.com/nebius-ai-cloud/3vrg63wLg56IgavR/_assets/compute/maintenance-banner-for-all-vms.png?fit=max\&auto=format\&n=3vrg63wLg56IgavR\&q=85\&s=42a1d39ac2ff2bf9ddb13045e09e748a) > [!WARNING] > > If you do not stop VMs on time, the service will automatically stop them after the due date to perform maintenance. Delayed maintenance may cause VM instability. If you need to keep your VMs running, [contact the support team](https://console.nebius.com/support/create-ticket) to request rescheduling maintenance of the affected VMs. You can request to reschedule it up to two times, and you can postpone the maintenance by up to seven days each time. # Maintenance reasons in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/maintenance-reasons.md When Compute schedules maintenance for your virtual machine (VM), it assigns a *reason code* that describes why the maintenance was triggered. After you identify the reason, [stop and start your VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-compute-virtual-machines) to prepare it for maintenance. The reason code helps you assess the severity of the error and decide whether additional action is needed. ## How to identify the reason code for a maintenance event You can view the reason code for maintenance events by: * Checking the maintenance notification banner in the [web console](https://console.nebius.com/); * Using the [Nebius AI Cloud CLI](https://docs.nebius.com/cli/index.md) to list all active maintenance events scheduled for resources in a project. Run the following command, and specify your [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id). ```bash nebius compute maintenance list-active --parent-id ``` The output contains a list of all maintenance events that are scheduled for resources in the project you specified. ## Reason codes Maintenance events can be triggered by GPU, InfiniBand™ or node-level errors. The tables below show the reason codes that map to different types of errors. If maintenance was triggered by a condition that is not mapped to one of these reason codes, Compute assigns `OTHER` as the reason code. ### GPU errors | Reason code | Description | | - | - | | `HW_GPU_PCI_FALLEN_OFF_BUS` | A GPU or NVSwitch has fallen off the PCI bus, typically due to critical thermal or power issues. The affected node is taken out of service for hardware inspection. | | `HW_GPU_PCI_CONFIG_ERROR` | Unexpected GPU PCI configuration detected, or critical PCI errors observed between the GPU, deltaboard, and motherboard. Requires physical hardware maintenance. | | `HW_GPU_NVLINK_DOWN` | An NVLink connection is down on a Blackwell or newer GPU. Requires a GPU reset or VM restart to recover. | | `HW_GPU_XID_62` | The GPU internal micro-controller has halted (XID 62). Requires a GPU reset or VM restart. | | `HW_GPU_XID_109` | GPU context switch timeout (XID 109). Typically not fatal to running workloads, but may require a GPU reset or VM restart. | | `HW_GPU_XID_119` | GSP RPC timeout (XID 119). Requires a GPU reset or VM restart. | | `HW_GPU_FW_VERSION_UNAVAILABLE` | DCGM could not report the GPU firmware version. This is usually a symptom of other underlying hardware errors. | | `HW_GPU_DRIVER_INIT_FAILED` | The NVIDIA® driver failed to initialize one or more GPUs. Typically caused by other hardware errors. | ### InfiniBand™ errors | Reason code | Description | | - | - | | `HW_IB_LINK_DOWN` | The InfiniBand link has been in a physically down state for more than 3 minutes. | | `HW_IB_PCI_FALLEN_OFF_BUS` | The InfiniBand adapter has fallen off the PCI bus, typically due to critical thermal or power issues. | | `HW_IB_PCI_CONFIG_ERROR` | Unexpected InfiniBand PCI configuration detected, typically due to critical PCI errors. | ### Node-level errors | Reason code | Description | | - | - | | `HW_NODE_OFFLINE` | The node hosting the VM went offline. The cause may vary. Affected VMs are force-migrated and will experience an unexpected reboot. | *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # How to stop and start Compute virtual machines Source: https://docs.nebius.com/compute/virtual-machines/stop-start.md To proceed with [maintenance](https://docs.nebius.com/compute/virtual-machines/maintenance.md), stop and start virtual machines [manually](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually) or [automatically](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-automatically-by-using-autohealing). If you need to keep your VMs running, [contact the support team](https://console.nebius.com/support/create-ticket) and consult them about the possibility of rescheduling maintenance of the affected VMs. > [!WARNING] > > Do not stop your VM by using Linux commands, such as `shutdown` or `halt`. Compute considers this a failure, reboots the VM automatically, and continues charging for this VM. Use Nebius AI Cloud interfaces instead and follow the instructions below. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to stop and start VMs manually > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > > 2. On the **Standalone VMs** tab, find VMs with the maintenance label. > > > [accordion] Example > > > > ![maintenance-label](https://mintcdn.com/nebius-ai-cloud/3vrg63wLg56IgavR/_assets/compute/maintenance-label-for-one-vm.png?fit=max\&auto=format\&n=3vrg63wLg56IgavR\&q=85\&s=7e0e5645e6e70a1b07b0b31fb768ffb9) > > 3. Click  → **Stop** for these VMs. > > 4. In the window that opens, confirm stopping the VM. > > 5. When the VM status changes to **Stopped**, click  → **Start**. > > 6. In the window that opens, confirm starting the VM. > [tab] CLI > > 1. Check whether maintenance is scheduled for a VM: > > ```bash > nebius compute instance get --id > ``` > > If the output contains the `status.maintenance_event_id` parameter, this means that you need to stop and start this VM. > > 2. Stop the VM: > > ```bash > nebius compute instance stop --id > ``` > > 3. Start the VM: > > ```bash > nebius compute instance start --id > ``` > [tab] Go SDK > > 1. Check whether maintenance is scheduled for a VM: > > ```go > instance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(instance) > ``` > > If the response contains a maintenance event ID in the VM status, stop and start this VM. > > 2. Stop the VM: > > ```go > stopInstanceOperation, err := sdk.Services().Compute().V1(). > Instance().Stop( > ctx, > &compute.StopInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = stopInstanceOperation.Wait(ctx); err != nil { > return err > } > ``` > > 3. Start the VM: > > ```go > startOperation, err := sdk.Services().Compute().V1(). > Instance().Start( > ctx, > &compute.StartInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = startOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Check whether maintenance is scheduled for a VM: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > print(instance) > ``` > > If the response contains a maintenance event ID in the VM status, stop and start this VM. > > 2. Stop the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > stop_instance_operation = await instance_service.stop( > StopInstanceRequest(id=""), > ) > await stop_instance_operation.wait() > ``` > > 3. Start the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > start_instance_operation = await instance_service.start( > StartInstanceRequest(id=""), > ) > await start_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Check whether maintenance is scheduled for a VM: > > ```ts > const getInstanceService = new InstanceService(sdk); > const instance = await getInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > console.log(instance); > ``` > > If the response contains a maintenance event ID in the VM status, stop and start this VM. > > 2. Stop the VM: > > ```ts > const stopInstanceService = new InstanceService(sdk); > const stopInstanceOperation = await stopInstanceService.stop( > StopInstanceRequest.create({ > id: "", > }), > ).result; > await stopInstanceOperation.wait(); > ``` > > 3. Start the VM: > > ```ts > const startInstanceService = new InstanceService(sdk); > const startInstanceOperation = await startInstanceService.start( > StartInstanceRequest.create({ > id: "", > }), > ).result; > await startInstanceOperation.wait(); > ``` ## How to stop and start VMs automatically by using autohealing You can create a VM with the autohealing function. It allows a VM to automatically stop and start each time maintenance is scheduled. As a result, the applications on this VM are highly available. > [!WARNING] > > Use autohealing only if the automatic VM shutdown is safe for the workloads on this VM. If you cannot stop the VM at any time, it is better to manage the VM [manually](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually). To create a VM that stops and starts automatically during maintenance events: 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. [Create a service account](https://docs.nebius.com/iam/service-accounts/manage.md#create-a-service-account). 3. Add it to the default `viewers` group: > [tab] CLI > > 1. Get the ID of the `viewers` group: > > ```bash > nebius iam group get-by-name --name viewers \ > --parent-id \ > --format jsonpath='{.metadata.id}' > ``` > > In the command, specify your [Tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-cli). > > 2. Get the ID of the service account: > > ```bash > nebius iam service-account get-by-name \ > --name \ > --format jsonpath='{.metadata.id}' > ``` > > 3. Add the service account to the `viewers` group: > > ```bash > nebius iam group-membership create \ > --parent-id \ > --member-id > ``` > [tab] Go SDK > > 1. Get the ID of the `viewers` group: > > ```go > viewersGroup, err := sdk.Services().IAM().V1(). > Group().GetByName( > ctx, > &iam.GetGroupByNameRequest{ > ParentId: "", > Name: "viewers", > }, > ) > if err != nil { > return err > } > viewersID := viewersGroup.GetMetadata().GetId() > if viewersID == "" { > return errors.New("viewers group ID is missing") > } > ``` > > In the code, specify your [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-go-sdk). > > 2. Get the ID of the service account: > > ```go > serviceAccount, err := sdk.Services().IAM().V1(). > ServiceAccount().GetByName( > ctx, > &iam.GetServiceAccountByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > serviceAccountID := serviceAccount.GetMetadata().GetId() > if serviceAccountID == "" { > return errors.New("service account ID is missing") > } > ``` > > In the code, specify the service account name. > > 3. Add the service account to the `viewers` group: > > ```go > membershipOperation, err := sdk.Services().IAM().V1(). > GroupMembership().Create( > ctx, > &iam.CreateGroupMembershipRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.GroupMembershipSpec{ > MemberId: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = membershipOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, specify the IDs of the `viewers` group and the service account. > [tab] Python SDK > > 1. Get the ID of the `viewers` group: > > ```python > group_service = GroupServiceClient(sdk) > viewers_group = await group_service.get_by_name( > GetGroupByNameRequest( > parent_id="", > name="viewers", > ), > ) > viewers_id = viewers_group.metadata.id > ``` > > In the code, specify your [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-python-sdk). > > 2. Get the ID of the service account: > > ```python > service_account_service = ServiceAccountServiceClient(sdk) > service_account = await service_account_service.get_by_name( > GetServiceAccountByNameRequest(name=""), > ) > service_account_id = service_account.metadata.id > ``` > > In the code, specify the service account name. > > 3. Add the service account to the `viewers` group: > > ```python > membership_service = GroupMembershipServiceClient(sdk) > membership_operation = await membership_service.create( > CreateGroupMembershipRequest( > metadata=ResourceMetadata(parent_id=""), > spec=GroupMembershipSpec(member_id=""), > ), > ) > await membership_operation.wait() > ``` > > In the code, specify the IDs of the `viewers` group and the service account. > [tab] JavaScript SDK > > 1. Get the ID of the `viewers` group: > > ```ts > const groupService = new GroupService(sdk); > const viewersGroup = await groupService.getByName( > GetGroupByNameRequest.create({ > parentId: "", > name: "viewers", > }), > ); > const viewersId = viewersGroup.metadata?.id; > if (!viewersId) { > throw new Error("viewers group ID is missing"); > } > ``` > > In the code, specify your [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-javascript-sdk). > > 2. Get the ID of the service account: > > ```ts > const saService = new ServiceAccountService(sdk); > const serviceAccount = await saService.getByName( > GetServiceAccountByNameRequest.create({ > name: "", > }), > ); > const serviceAccountId = serviceAccount.metadata?.id; > if (!serviceAccountId) { > throw new Error("service account ID is missing"); > } > ``` > > In the code, specify the service account name. > > 3. Add the service account to the `viewers` group: > > ```ts > const membershipService = new GroupMembershipService(sdk); > const membershipOperation = await membershipService.create( > CreateGroupMembershipRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: GroupMembershipSpec.create({ > memberId: "", > }), > }), > ).result; > await membershipOperation.wait(); > ``` > > In the code, specify the IDs of the `viewers` group and the service account. 4. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md). In its configuration, specify the following: * [Settings that allow connections](https://docs.nebius.com/compute/virtual-machines/connect.md#set-up-the-vm) to this VM. * Created service account: > [tab] CLI > > ```bash > nebius compute instance create \ > ... \ > --service-account-id > ``` > [tab] Terraform > > In the `nebius_compute_v1_instance` resource, set `service_account_id` to the ID of the created service account: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "vm" > parent_id = "" > service_account_id = "" > resources = { > platform = "cpu-e2" > preset = "2vcpu-8gb" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > } > filesystems = [ > { > attach_mode = "READ_WRITE" > mount_tag = "filesystem-1" > existing_filesystem = { > id = "" > } > } > ] > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > [tab] Go SDK > > ```go > fsAttachMode := compute.AttachedFilesystemSpec_READ_WRITE > existingFS := &compute.ExistingFilesystem{ > Id: filesystemID, > } > fsType := &compute.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: existingFS, > } > instanceOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "vm", > }, > Spec: &compute.InstanceSpec{ > ServiceAccountId: "", > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > }, > Filesystems: []*compute.AttachedFilesystemSpec{ > { > AttachMode: fsAttachMode, > MountTag: "filesystem-1", > Type: fsType, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > instance_service = InstanceServiceClient(sdk) > create_instance_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="vm"), > spec=InstanceSpec( > service_account_id="", > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=boot_disk_id), > ), > filesystems=[ > AttachedFilesystemSpec( > attach_mode=( > AttachedFilesystemSpec.AttachMode.READ_WRITE > ), > existing_filesystem=ExistingFilesystem( > id=filesystem_id, > ), > mount_tag="filesystem-1", > ), > ], > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await create_instance_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const createInstanceService = new InstanceService(sdk); > const createInstanceOperation = await createInstanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "vm", > }), > spec: InstanceSpec.create({ > serviceAccountId: "", > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > filesystems: [ > AttachedFilesystemSpec.create({ > attachMode: AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "filesystem-1", > type: { > $case: "existingFilesystem", > existingFilesystem: ExistingFilesystem.create({ > id: filesystemId, > }), > }, > }), > ], > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await createInstanceOperation.wait(); > ``` 5. [Connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 6. Install `jq` on the VM: ```bash Ubuntu sudo apt-get install jq ``` ```bash macOS brew install jq ``` 7. Go to the `/usr/local/bin/` directory: ```bash cd /usr/local/bin/ ``` 8. Create the `vm_maintenance.sh` file: ```bash sudo nano vm_maintenance.sh ``` 9. Add the following Bash script to the file: ```bash #!/bin/bash INSTANCE_ID_FILE="/mnt/cloud-metadata/instance-id" CHECK_INTERVAL=600 # 10 minutes in seconds # Check if the Nebius AI Cloud CLI is installed check_nebius_installed() { if ! command -v nebius &> /dev/null; then echo "$(date) - Nebius utility not found, exiting..." exit 1 fi } get_instance_id() { if [[ -f "$INSTANCE_ID_FILE" ]]; then cat "$INSTANCE_ID_FILE" else echo "File with the virtual machine ID is not found" exit 1 fi } # Handle a maintenance event handle_maintenance_event() { # Add custom actions before stopping the virtual machine echo "$(date) - Custom actions before stopping the virtual machine" sudo shutdown -h +1 "Restarting virtual machine due to maintenance" } check_nebius_installed # main loop while true; do INSTANCE_ID=$(get_instance_id) if [[ -z "$INSTANCE_ID" ]]; then echo "Virtual machine ID is empty" exit 1 fi RESPONSE=$(nebius compute instance get --id "$INSTANCE_ID" --format json) if echo "$RESPONSE" | jq -e '.status.maintenance_event_id' >/dev/null; then echo "$(date) - Maintenance event detected" handle_maintenance_event else echo "$(date) - No maintenance event detected" fi sleep "$CHECK_INTERVAL" done ``` 10. Make the file executable: ```bash sudo chmod +x /usr/local/bin/vm_maintenance.sh ``` 11. To make the script run continuously and restart it when the VM fails or reboots, add a `systemd` unit to the script: ```bash sudo bash -c 'cat > /etc/systemd/system/vm_maintenance.service << EOF [Unit] Description=VM Maintenance Event Handler After=network.target [Service] ExecStart=/usr/local/bin/vm_maintenance.sh Restart=always User=root Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin WorkingDirectory=/usr/local/bin StandardOutput=append:/var/log/vm_maintenance.log StandardError=append:/var/log/vm_maintenance.log [Install] WantedBy=multi-user.target EOF' ``` 12. Start the service created with the `systemd` unit, and let it restart in case of the VM reboot: ```bash sudo systemctl daemon-reload sudo systemctl start vm_maintenance sudo systemctl enable vm_maintenance sudo systemctl status vm_maintenance ``` The output example is the following: ```text Created symlink /etc/systemd/system/multi-user.target.wants/vm_maintenance.service → /etc/systemd/system/vm_maintenance.service. ● vm_maintenance.service - VM Maintenance Event Handler Loaded: loaded (/etc/systemd/system/vm_maintenance.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2025-04-25 10:19:19 UTC; 214ms ago Main PID: 28530 (vm_maintenance.) Tasks: 6 (limit: 19056) Memory: 24.3M CPU: 25ms CGroup: /system.slice/vm_maintenance.service ├─28530 /bin/bash /usr/local/bin/vm_maintenance.sh └─28535 nebius compute instance get --id computeinstance-*** --format json Apr 25 10:19:19 computeinstance-*** systemd[1]: Started VM Maintenance Event Handler. ``` Now, the script runs continuously, and the VM stops and starts during maintenance events. # Lifecycle of a Compute virtual machine Source: https://docs.nebius.com/compute/virtual-machines/lifecycle.md Every virtual machine (VM) in Compute can have one of the following statuses: * `Stopped`: VM is stopped. * `Starting`: VM is launching. * `Running`: VM is running. * `Stopping`: VM is stopping. * `Deleting`: VM is being deleted. * `Error`: VM crashed and cannot be restored. When a VM assumes this status, delete this VM and create a new one. You cannot stop and start a VM with the `Error` status. ## Transitions between VM statuses ### VM is being created `Stopped` → `Starting` → `Running` If you [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) by using the CLI or Terraform, you can specify `"stopped": true` in the VM configuration. In this case, the VM is created with the `Stopped` status. The status does not change until you [launch this VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md). ### VM is being started `Stopped` → `Starting` → `Running` When a VM is `Starting`, its hypervisor launches the VM's operating system. Additionally, the service allocates computing resources to the VM, such as RAM, GPUs, and CPUs. When a VM is `Running`, it functions fully. This influences [billing](https://docs.nebius.com/compute/virtual-machines/lifecycle.md#when-compute-charges-for-the-vm-usage) and [quotas](https://docs.nebius.com/compute/virtual-machines/lifecycle.md#when-compute-quotas-are-released). The service charges you for a running VM. Also, the number of resources occupied in the tenant or project increases. ### VM is being stopped `Running` → `Stopping` → `Stopped` When a VM is `Stopping`, its hypervisor shuts down the operating system of this VM. Before the OS is turned off completely, the hypervisor gracefully terminates all running processes within 60 seconds to prevent data loss. After that, the VM is `Stopped`. ### VM is being deleted `Running` → `Deleting` After the `Deleting` status, a VM is removed from the list of VMs and the occupied quotas are released. ### VM crashed and is being recovered If the VM recovery is successful, statuses of this VM change in the following order: `Running` → `Stopping` → `Stopped` → `Running` If Compute cannot start the VM properly during the recovery, for example, because of a lack of available resources, the VM goes through one of the following lifecycles: * `Running` → `Stopping` → `Stopped` → `Starting` → `Stopping` → `Stopped` or `Error` * `Running` → `Stopping` → `Stopped` or `Error` ## When Compute charges for the VM usage When you create a VM, Compute starts [charging](https://docs.nebius.com/compute/resources/pricing.md) for it once the VM assumes the `Running` status. When you delete a VM, Compute stops charging for it once you send the deletion command. For example, you click the  **Delete** button or run a [CLI command](https://docs.nebius.com/cli/reference/compute/instance/delete.md). When a VM has crashed, Compute stops charging for it when recovery begins. If the VM is recovered successfully, the service continues charging. If not, the charging does not start again. ## When Compute quotas are released [Compute quotas](https://docs.nebius.com/compute/resources/quotas-limits.md) are only released after the VM deletion. If a VM is `Stopped`, the quotas are still occupied. To avoid running out of the quotas, revise your list of VMs from time to time and delete unused VMs. Stopping them will not help. # How to enable automatic security updates Source: https://docs.nebius.com/compute/storage/automatic-updates.md The Ubuntu [images](https://docs.nebius.com/compute/storage/boot-disk-images.md) used on boot disks of VMs include the `unattended-upgrades` package that can install security updates automatically. However, unexpected updates might break running GPU workloads. For this reason, unattended upgrades are disabled by default. We recommend that you check the compatibility of new library versions on a test VM, and then apply the updates manually to all running GPU nodes. If you do need constant security updates, you can enable `unattended-upgrades`. ## For an existing VM 1. [Connect](https://docs.nebius.com/compute/virtual-machines/connect.md) to the VM. 2. Check that the updates are enabled in the configuration: ```bash sudo nano /etc/apt/apt.conf.d/20auto-upgrades ``` The following values should be equal to 1. If they are set to 0, change them to 1: ```bash APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1"; ``` 3. Start the upgrade services: ```bash sudo systemctl unmask apt-daily.service apt-daily-upgrade.service sudo systemctl enable apt-daily.timer apt-daily-upgrade.timer sudo systemctl start apt-daily.timer apt-daily-upgrade.timer ``` 4. Check the service status: ```bash systemctl status apt-daily.timer apt-daily-upgrade.timer ``` Output for active updates should look like the following: ```bash ● apt-daily.timer - Daily apt download activities Loaded: loaded (/usr/lib/systemd/system/apt-daily.timer; enabled; preset: enabled) Active: active (waiting) since Wed 2025-10-01 14:59:29 UTC; 7s ago Trigger: Thu 2025-10-02 04:54:23 UTC; 13h left Triggers: ● apt-daily.service ● apt-daily-upgrade.timer - Daily apt upgrade and clean activities Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled) Active: active (waiting) since Wed 2025-10-01 14:59:29 UTC; 7s ago Trigger: Thu 2025-10-02 06:10:29 UTC; 15h left Triggers: ● apt-daily-upgrade.service ``` ## During VM creation When you create a new VM, you can enable unattended upgrades for the VM in the [user data configuration](https://docs.nebius.com/compute/virtual-machines/create.md#optional-create-a-user-data-configuration). > [tab] Web console > > On the VM creation page in to the **User data** section, enable the custom cloud-init configuration. The window below contains the code that specifies users who can connect to the VM. Add the following code to enable updates: > > ```yaml > users: > - name: $USER > sudo: ALL=(ALL) NOPASSWD:ALL > shell: /bin/bash > ssh_authorized_keys: > - $(cat ~/.ssh/id_ed25519.pub) > > package_update: true > packages: > - unattended-upgrades > > write_files: > - path: /etc/apt/apt.conf.d/20auto-upgrades > permissions: '0644' > content: | > APT::Periodic::Update-Package-Lists "1"; > APT::Periodic::Unattended-Upgrade "1"; > > runcmd: > - systemctl unmask apt-daily.service apt-daily-upgrade.service > - systemctl enable --now apt-daily.timer apt-daily-upgrade.timer > - systemctl restart unattended-upgrades > ``` > [tab] CLI > > Create a configuration in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/explanation/about-cloud-config.html) format. Add the following code to enable updates for users who can connect to the VM: > > ```bash > export USER_DATA=$(jq -Rrs '.' < #cloud-config > users: > - name: $USER > sudo: ALL=(ALL) NOPASSWD:ALL > shell: /bin/bash > ssh_authorized_keys: > - $(cat ~/.ssh/id_ed25519.pub) > > package_update: true > packages: > - unattended-upgrades > > write_files: > - path: /etc/apt/apt.conf.d/20auto-upgrades > permissions: '0644' > content: | > APT::Periodic::Update-Package-Lists "1"; > APT::Periodic::Unattended-Upgrade "1"; > > runcmd: > - systemctl unmask apt-daily.service apt-daily-upgrade.service > - systemctl enable --now apt-daily.timer apt-daily-upgrade.timer > - systemctl restart unattended-upgrades > EOF > ) > ``` > > Pass the configured user data to the `--cloud-init-user-data` parameter in the [nebius compute instance create](https://docs.nebius.com/cli/reference/compute/instance/create.md) command. > [tab] Terraform > > Create a configuration in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/explanation/about-cloud-config.html) format. Add the following code to enable updates for users who can connect to the VM: > > ```bash > export USER_DATA=$(jq -Rrs '.' < #cloud-config > users: > - name: $USER > sudo: ALL=(ALL) NOPASSWD:ALL > shell: /bin/bash > ssh_authorized_keys: > - $(cat ~/.ssh/id_ed25519.pub) > > package_update: true > packages: > - unattended-upgrades > > write_files: > - path: /etc/apt/apt.conf.d/20auto-upgrades > permissions: '0644' > content: | > APT::Periodic::Update-Package-Lists "1"; > APT::Periodic::Unattended-Upgrade "1"; > > runcmd: > - systemctl unmask apt-daily.service apt-daily-upgrade.service > - systemctl enable --now apt-daily.timer apt-daily-upgrade.timer > - systemctl restart unattended-upgrades > EOF > ) > ``` > > Pass the configured user data to the `cloud_init_user_data` parameter in the Terraform resource for the VM. > [tab] Go SDK > > Create a configuration in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/explanation/about-cloud-config.html) format. Add the following code to enable updates for users who can connect to the VM: > > ```go > publicKeyBytes, err := os.ReadFile( > os.ExpandEnv("$HOME/.ssh/id_ed25519.pub"), > ) > if err != nil { > return err > } > publicKey := strings.TrimSpace(string(publicKeyBytes)) > userData := "#cloud-config\nusers:\n" + > " - name: user\n" + > " sudo: ALL=(ALL) NOPASSWD:ALL\n" + > " shell: /bin/bash\n" + > " ssh_authorized_keys:\n" + > " - " + publicKey + "\n\n" + > "package_update: true\n" + > "packages:\n" + > " - unattended-upgrades\n\n" + > "write_files:\n" + > " - path: /etc/apt/apt.conf.d/20auto-upgrades\n" + > " permissions: '0644'\n" + > " content: |\n" + > " APT::Periodic::Update-Package-Lists \"1\";\n" + > " APT::Periodic::Unattended-Upgrade \"1\";\n\n" + > "runcmd:\n" + > " - systemctl unmask apt-daily.service apt-daily-upgrade.service\n" + > " - systemctl enable --now apt-daily.timer apt-daily-upgrade.timer\n" + > " - systemctl restart unattended-upgrades" > ``` > > Pass the configured user data to `InstanceSpec.CloudInitUserData` when creating the VM. > [tab] Python SDK > > Create a configuration in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/explanation/about-cloud-config.html) format. Add the following code to enable updates for users who can connect to the VM: > > ```python > public_key = ( > Path.home() > .joinpath(".ssh/id_ed25519.pub") > .read_text() > .strip() > ) > user_data = "\n".join( > [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > f" - {public_key}", > "", > "package_update: true", > "packages:", > " - unattended-upgrades", > "", > "write_files:", > " - path: /etc/apt/apt.conf.d/20auto-upgrades", > " permissions: '0644'", > " content: |", > ' APT::Periodic::Update-Package-Lists "1";', > ' APT::Periodic::Unattended-Upgrade "1";', > "", > "runcmd:", > " - systemctl unmask apt-daily.service apt-daily-upgrade.service", > " - systemctl enable --now apt-daily.timer apt-daily-upgrade.timer", > " - systemctl restart unattended-upgrades", > ], > ) > ``` > > Pass the configured user data to `InstanceSpec.cloud_init_user_data` when creating the VM. > [tab] JavaScript SDK > > Create a configuration in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/explanation/about-cloud-config.html) format. Add the following code to enable updates for users who can connect to the VM: > > ```ts > const publicKey = readFileSync( > `${process.env.HOME}/.ssh/id_ed25519.pub`, > "utf8", > ).trim(); > const userData = [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > " - " + publicKey, > "", > "package_update: true", > "packages:", > " - unattended-upgrades", > "", > "write_files:", > " - path: /etc/apt/apt.conf.d/20auto-upgrades", > " permissions: '0644'", > " content: |", > ' APT::Periodic::Update-Package-Lists "1";', > ' APT::Periodic::Unattended-Upgrade "1";', > "", > "runcmd:", > " - systemctl unmask apt-daily.service apt-daily-upgrade.service", > " - systemctl enable --now apt-daily.timer apt-daily-upgrade.timer", > " - systemctl restart unattended-upgrades", > ].join("\n"); > ``` > > Pass the configured user data to `InstanceSpec.cloudInitUserData` when creating the VM. # Private and public IP addresses of Compute virtual machines Source: https://docs.nebius.com/compute/virtual-machines/network.md Virtual machines (VMs) in Compute can be reached at their private and public IP addresses. Assign them to manage access to the VM in a network. In addition, you can also configure [security groups](https://docs.nebius.com/vpc/security-groups/overview.md) to enable a firewall for your VMs and control ingress and egress traffic. For more information, see [Managing security groups and security rules](https://docs.nebius.com/vpc/security-groups/manage.md). ## Private IP addresses Each VM is created with a network interface that has a private IPv4 address. VMs can communicate with each other without internet access by using their private addresses. Private address ranges are randomly allocated from subnets within the `10.0.0.0/8` and `192.168.0.0/16` IPv4 CIDR blocks. To reach a VM by a stable name rather than by an allocated address, use its fully qualified domain name ([FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md)), which Nebius AI Cloud registers in the [DNS zone](https://docs.nebius.com/vpc/dns/overview.md) of the VM's network. > [!NOTE] > > Don't assign a private IPv4 address within the `172.17.0.0/16` CIDR block to a VM. The VMs running Docker cannot reach this address because the default boot disk images come with Docker preinstalled. As a result, this affects most VMs in the network. For more information, see [Virtual machine is unreachable due to a Docker subnet conflict](https://docs.nebius.com/compute/virtual-machines/docker-subnet-conflict.md). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ### How to get a VM's private IP address > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. On the **Standalone VMs** tab, open the page of the required VM. > 3. Copy the **Private IPv4** value from the **Network** block. > [tab] CLI > > ```bash > export PRIVATE_IP_ADDRESS=$(nebius compute instance get-by-name \ > --name \ > --format json \ > | jq -r '.status.network_interfaces[0].ip_address.address | split("/")[0]') > echo $PRIVATE_IP_ADDRESS > ``` > [tab] Terraform > > 1. In the configuration that manages the VM, add the following output: > > ```hcl > output "private_ip_address" { > value = nebius_compute_v1_instance..status.network_interfaces[0].ip_address.address > } > ``` > > The output reads the `status.network_interfaces[0].ip_address.address` attribute of the `nebius_compute_v1_instance` resource. It holds the private IPv4 address of the first network interface of the VM. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > 4. To show the address, run `terraform output private_ip_address`. > [tab] Go SDK > > ```go > privateIPInstance, err := sdk.Services().Compute().V1(). > Instance().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > privateAddress := privateIPInstance.GetStatus(). > GetNetworkInterfaces()[0].GetIpAddress().GetAddress() > privateIPAddress := strings.Split(privateAddress, "/")[0] > fmt.Println(privateIPAddress) > ``` > [tab] Python SDK > > ```python > instance_service = InstanceServiceClient(sdk) > private_ip_instance = await instance_service.get_by_name( > GetByNameRequest(name=""), > ) > private_address = ( > private_ip_instance.status.network_interfaces[0] > .ip_address.address > ) > private_ip_address = private_address.split("/")[0] > print(private_ip_address) > ``` > [tab] JavaScript SDK > > ```ts > const privateIpService = new InstanceService(sdk); > const privateIpInstance = await privateIpService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const privateAddress = privateIpInstance.status > ?.networkInterfaces[0]?.ipAddress?.address; > const privateIpAddress = privateAddress?.split("/")[0]; > console.log(privateIpAddress); > ``` ### How to assign a secondary private IP address to a VM You can use secondary private IP addresses 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. > [tab] Web console > > To assign a secondary private address to a VM: > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. On the **Standalone VMs** tab, open the page of the required VM. > 3. Click **Attach resource** → **Secondary private IP**. > 4. In the window that opens, select whether you want to reuse an existing IP address as a secondary one or create a new address. > 5. For an existing IP address, select an allocation and then click **Assign address**. > 6. For a new address, specify the allocation name and address. After that, click **Create and assign address**. > [tab] CLI > > To assign a secondary private address to a VM, first create a private allocation with the required address. After that, add this allocation to the VM specification. > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) for the allocation. > > 2. Check what private CIDR blocks this subnet includes: > > ```bash > nebius vpc subnet get --id > ``` > > The available CIDR blocks are specified in the `status.ipv4_private_cidrs` parameter in the output. > > 3. Create an allocation that reserves a private address. Use the address that belongs to one of the received private CIDR blocks. > > ```bash > nebius vpc allocation create \ > --name private_allocation \ > --ipv4-private-subnet-id \ > --ipv4-private-cidr > ``` > > Copy the allocation ID from the output. > > 4. Assign the allocation to the required VM: > > ```bash > nebius compute instance update \ > --id \ > --network-interfaces "[{\"aliases\": [{\"allocation_id\": \"\"}] }]" > ``` > > For more information, see [Allocating custom private addresses to resources](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md#how-to-allocate-addresses-cli). > [tab] Terraform > > To assign a secondary private address to a VM, first create a private allocation with the required address. After that, add this allocation to the VM resource. > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the allocation. > > 2. Check what private CIDR blocks this subnet includes, for example, with the `nebius vpc subnet get` command. The available CIDR blocks are specified in the `status.ipv4_private_cidrs` parameter in the output. > > 3. In the configuration, add an allocation that reserves a private address. Use the address that belongs to one of the received private CIDR blocks: > > ```hcl > resource "nebius_vpc_v1_allocation" "" { > name = "" > parent_id = "" > ipv4_private = { > subnet_id = "" > cidr = "" > } > } > ``` > > The file contains the following parameters: > > * `name`: Allocation name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the allocation is created. > * `ipv4_private.subnet_id`: ID of the subnet that the allocation belongs to. > * `ipv4_private.cidr`: Private IP address to reserve. > > For the full resource reference, see [nebius\_vpc\_v1\_allocation](https://docs.nebius.com/terraform-provider/reference/resources/vpc_v1_allocation.md). > > 4. In the configuration file, update the `nebius_compute_v1_instance` resource: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > aliases = [ > { > allocation_id = nebius_vpc_v1_allocation..id > } > ] > } > ] > } > ``` > > `# ...` stands for the attributes that don't change. Keep the other attributes of the network interface, such as `public_ip_address`, as they are. The `aliases` list contains the following parameter: > > * `allocation_id`: ID of the allocation with the secondary private address. The example references the allocation created in the previous step. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 5. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 6. Apply the changes: > ```bash > terraform apply > ``` > > For more information, see [Allocating custom private addresses to resources](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md). > [tab] Go SDK > > To assign a secondary private address to a VM, first create a private allocation with the required address. After that, add this allocation to the VM specification. > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) for the allocation. > > 2. Check what private CIDR blocks this subnet includes: > > ```go > subnet, err := sdk.Services().VPC().V1(). > Subnet().Get( > ctx, > &vpc.GetSubnetRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(subnet) > ``` > > The response includes the available CIDR blocks. > > 3. Create an allocation that reserves a private address. Use the address that belongs to one of the received private CIDR blocks. > > ```go > privAllocOperation, err := sdk.Services().VPC().V1(). > Allocation().Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "private_allocation", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Private{ > Ipv4Private: &vpc.IPv4PrivateAllocationSpec{ > Cidr: "", > Pool: &vpc.IPv4PrivateAllocationSpec_SubnetId{ > SubnetId: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = privAllocOperation.Wait(ctx); err != nil { > return err > } > allocationID1 := privAllocOperation.ResourceID() > ``` > > Copy the allocation ID from the response. > > 4. Assign the allocation to the required VM: > > ```go > instanceForAlias, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instanceForAlias.GetSpec() == nil { > return errors.New("instance spec is missing") > } > networkInterfaces := instanceForAlias.Spec.NetworkInterfaces > networkInterfaces[0].Aliases = []*compute.IPAlias{ > { > AllocationId: "", > }, > } > aliasOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instanceForAlias.Metadata, > Spec: instanceForAlias.Spec, > }, > ) > if err != nil { > return err > } > if _, err = aliasOperation.Wait(ctx); err != nil { > return err > } > ``` > > For more information, see [Allocating custom private addresses to resources](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md#how-to-allocate-addresses-go-sdk). > [tab] Python SDK > > To assign a secondary private address to a VM, first create a private allocation with the required address. After that, add this allocation to the VM specification. > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) for the allocation. > > 2. Check what private CIDR blocks this subnet includes: > > ```python > subnet_service = SubnetServiceClient(sdk) > subnet = await subnet_service.get( > GetSubnetRequest(id=""), > ) > print(subnet) > ``` > > The response includes the available CIDR blocks. > > 3. Create an allocation that reserves a private address. Use the address that belongs to one of the received private CIDR blocks. > > ```python > allocation_service = AllocationServiceClient(sdk) > private_allocation_operation = await allocation_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata(name="private_allocation"), > spec=AllocationSpec( > ipv4_private=IPv4PrivateAllocationSpec( > cidr="", > subnet_id="", > ), > ), > ), > ) > await private_allocation_operation.wait() > allocation_id_1 = private_allocation_operation.resource_id > ``` > > Copy the allocation ID from the response. > > 4. Assign the allocation to the required VM: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > instance.spec.network_interfaces[0].aliases = [ > IPAlias(allocation_id=""), > ] > alias_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance.metadata, > spec=instance.spec, > ), > ) > await alias_operation.wait() > ``` > > For more information, see [Allocating custom private addresses to resources](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md#how-to-allocate-addresses-python-sdk). > [tab] JavaScript SDK > > To assign a secondary private address to a VM, first create a private allocation with the required address. After that, add this allocation to the VM specification. > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) for the allocation. > > 2. Check what private CIDR blocks this subnet includes: > > ```ts > const getSubnetService = new SubnetService(sdk); > const subnet = await getSubnetService.get( > GetSubnetRequest.create({ > id: "", > }), > ); > console.log(subnet); > ``` > > The response includes the available CIDR blocks. > > 3. Create an allocation that reserves a private address. Use the address that belongs to one of the received private CIDR blocks. > > ```ts > const privateAllocationService = new AllocationService(sdk); > const privateAllocationOperation = > await privateAllocationService.create( > CreateAllocationRequest.create({ > metadata: ResourceMetadata.create({ > name: "private_allocation", > }), > spec: AllocationSpec.create({ > ipSpec: { > $case: "ipv4Private", > ipv4Private: IPv4PrivateAllocationSpec.create({ > cidr: "", > pool: { > $case: "subnetId", > subnetId: "", > }, > }), > }, > }), > }), > ).result; > await privateAllocationOperation.wait(); > const allocationId1 = privateAllocationOperation.resourceId(); > ``` > > Copy the allocation ID from the response. > > 4. Assign the allocation to the required VM: > > ```ts > const aliasInstanceService = new InstanceService(sdk); > const instanceForAlias = await aliasInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceForAlias.spec) { > throw new Error("instance spec is missing"); > } > instanceForAlias.spec.networkInterfaces[0].aliases = [ > IPAlias.create({ > allocationId: "", > }), > ]; > const aliasOperation = await aliasInstanceService.update( > UpdateInstanceRequest.create({ > metadata: instanceForAlias.metadata, > spec: instanceForAlias.spec, > }), > ).result; > await aliasOperation.wait(); > ``` > > For more information, see [Allocating custom private addresses to resources](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md#how-to-allocate-addresses-javascript-sdk). ## Public IP addresses When creating a VM, you can enable public IPv4 addressing for it. A VM's public address is mapped to its private address by using one-to-one NAT. All IP addresses assigned to a VM are [allocations](https://docs.nebius.com/vpc/overview.md#allocation). When you create a VM and automatically assign a static or dynamic public address, Compute creates an allocation for it and assigns this address to this VM. After that, Compute manages the lifecycle of this allocation. In particular, Compute deletes the allocation when the VM is deleted. Public IP addresses are allocated from the public IPv4 ranges available for a given project. The available range depends on the [region](https://docs.nebius.com/overview/regions.md) where you create a VM. For instructions on how to get these ranges, see [Getting public IPv4 ranges for projects](https://docs.nebius.com/vpc/addressing/public-address-ranges.md). If you assign an already existing allocation when you create a VM, Virtual Networks manages the lifecycle of this allocation. In this case, the allocation is preserved even if you delete the VM. 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](https://docs.nebius.com/compute/virtual-machines/wireguard.md). 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. ### How to enable a public IP address for a VM To enable a public address, either [create a VM](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-create-a-vm-with-a-public-ip-address) with it or [assign a public address to an existing VM](https://docs.nebius.com/compute/virtual-machines/network.md#how-to-enable-a-public-ip-address-for-an-existing-vm). A VM must be in the same [region](https://docs.nebius.com/overview/regions.md) as the VM's subnet. An allocation assigned to a VM must belong to the VM's subnet. For more information, see [Virtual Networks documentation](https://docs.nebius.com/vpc/overview.md). #### How to create a VM with a public IP address > [tab] Web console > > On the **Network** step of the [VM creation wizard](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console), in the **Public IP address** field, select one of the following options: > > * **Auto assign dynamic IP** (default): A dynamic public IP address is randomly allocated from the [public IPv4 ranges available for the project](https://docs.nebius.com/vpc/addressing/public-address-ranges.md#how-to-get-public-ipv4-ranges-web-console). > > Dynamic public IP addresses are not persistent. If a VM with a dynamic address has the `Stopped` status for more than one hour, the address automatically returns to the IPv4 public range of Nebius AI Cloud. After that, Compute may allocate this address to a different VM. > > If you want to preserve the address, assign a static address or an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) to the VM. > > * **Auto assign static IP**: A static public IP address is randomly allocated from the public IPv4 ranges available for the project. > > 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. > > * **Select from already allocated**: A preliminarily created allocation is assigned to a VM. > > If you use an allocation, its address will not return to the IPv4 range even if you delete the VM. > > If you want to create a VM with a private address only, select the **No public IP** option. > [tab] CLI > > You can [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) with a public IP address. This can be either a dynamic address, a static address, or an [allocation](https://docs.nebius.com/vpc/overview.md#allocation): > > * A dynamic public IP address is randomly allocated from the [IPv4 public range](https://docs.nebius.com/compute/virtual-machines/network.md#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. > * 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. > * 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 with a **dynamic public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) for the VM. > 2. Run the following command and specify the subnet ID in it: > > ```bash > nebius compute instance create \ > ... \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"public_ip_address\": {}, \"subnet_id\": \"\"}]" > ``` > > To create a VM with a **static public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) for the VM. > 2. Run the following command and specify the subnet ID in it: > > ```bash > nebius compute instance create \ > ... \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"public_ip_address\": {\"static\": true}, \"subnet_id\": \"\"}]" > ``` > > To create a VM with an **already allocated public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```bash > nebius vpc allocation create \ > --ipv4-public-subnet-id \ > --name > ``` > > 3. Create the VM. Specify the subnet ID and the allocation ID in the command: > > ```bash > nebius compute instance create \ > ... \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"public_ip_address\": {\"allocation_id\": \"\"}, \"subnet_id\": \"\"}]" > ``` > > If you want to create a VM with a private address only, omit the `public_ip_address` parameter in the `nebius compute instance create` command. > [tab] Terraform > > You can [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) with a public IP address. This can be a dynamic address, a static address, or an [allocation](https://docs.nebius.com/vpc/overview.md#allocation): > > * A dynamic public IP address is randomly allocated from the [IPv4 public range](https://docs.nebius.com/compute/virtual-machines/network.md#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. > * 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. > * 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 with a **dynamic public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the VM. > > 2. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > } > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > The file contains the following parameters: > > * `name`: VM name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the VM is created. > * `resources.platform` and `resources.preset`: [Platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md) of the VM. > * `boot_disk.existing_disk.id`: ID of the boot disk to attach. `attach_mode` sets the access mode for the disk. > * `network_interfaces`: Network interface of the VM. `subnet_id` is the subnet ID, `ip_address = {}` requests a private address, and an empty `public_ip_address = {}` requests a dynamic public address. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > > To create a VM with a **static public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the VM. > > 2. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > } > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > static = true > } > } > ] > } > ``` > > The file contains the same parameters as for a dynamic address, except `public_ip_address`, where `static = true` requests a static public address. > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > > To create a VM with an **already allocated public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```hcl > resource "nebius_vpc_v1_allocation" "" { > name = "" > parent_id = "" > ipv4_public = { > subnet_id = "" > } > } > ``` > > The file contains the following parameters: > > * `name`: Allocation name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the allocation is created. > * `ipv4_public.subnet_id`: ID of the subnet that the allocation belongs to. > > For the full resource reference, see [nebius\_vpc\_v1\_allocation](https://docs.nebius.com/terraform-provider/reference/resources/vpc_v1_allocation.md). > > 3. Add the VM to the same configuration. In `public_ip_address`, `allocation_id` references the ID of the allocation: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > } > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > allocation_id = nebius_vpc_v1_allocation..id > } > } > ] > } > ``` > > 4. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 5. Apply the changes: > ```bash > terraform apply > ``` > > To create a VM with a **private address only**, omit the `public_ip_address` attribute of the network interface: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the VM. > > 2. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > } > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > } > ] > } > ``` > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > You can [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) with a public IP address. This can be either a dynamic address, a static address, or an [allocation](https://docs.nebius.com/vpc/overview.md#allocation). > > To create a VM with a **dynamic public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) for the VM. > 2. Use the following code: > > ```go > publicVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: publicBootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = publicVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > To create a VM with a **static public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) for the VM. > 2. Use the following code: > > ```go > staticVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: staticBootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{ > Static: true, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = staticVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > To create a VM with an **already allocated public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```go > publicAllocationOperation, err := sdk.Services().VPC().V1(). > Allocation().Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Public{ > Ipv4Public: &vpc.IPv4PublicAllocationSpec{ > Pool: &vpc.IPv4PublicAllocationSpec_SubnetId{ > SubnetId: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = publicAllocationOperation.Wait(ctx); err != nil { > return err > } > allocationID := publicAllocationOperation.ResourceID() > ``` > > 3. Create the VM: > > ```go > allocationIP := &compute.PublicIPAddress_AllocationId{ > AllocationId: "", > } > allocationVMOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: allocationBootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{ > Allocation: allocationIP, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = allocationVMOperation.Wait(ctx); err != nil { > return err > } > ``` > > Create a VM with a private address only: > > ```go > privateOnlyOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: privateBootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = privateOnlyOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > You can [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) with a public IP address. This can be either a dynamic address, a static address, or an [allocation](https://docs.nebius.com/vpc/overview.md#allocation). > > To create a VM with a **dynamic public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) for the VM. > 2. Use the following code: > > ```python > instance_service = InstanceServiceClient(sdk) > public_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=public_boot_disk_id), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await public_vm_operation.wait() > ``` > > To create a VM with a **static public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) for the VM. > 2. Use the following code: > > ```python > instance_service = InstanceServiceClient(sdk) > static_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=static_boot_disk_id), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(static=True), > ), > ], > ), > ), > ) > await static_vm_operation.wait() > ``` > > To create a VM with an **already allocated public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```python > allocation_service = AllocationServiceClient(sdk) > public_allocation_operation = await allocation_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata(name=""), > spec=AllocationSpec( > ipv4_public=IPv4PublicAllocationSpec( > subnet_id="", > ), > ), > ), > ) > await public_allocation_operation.wait() > allocation_id = public_allocation_operation.resource_id > ``` > > 3. Create the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > allocation_vm_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk( > id=allocation_boot_disk_id, > ), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress( > allocation_id="", > ), > ), > ], > ), > ), > ) > await allocation_vm_operation.wait() > ``` > > Create a VM with a private address only: > > ```python > instance_service = InstanceServiceClient(sdk) > private_only_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name=""), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=private_boot_disk_id), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > ), > ], > ), > ), > ) > await private_only_operation.wait() > ``` > [tab] JavaScript SDK > > You can [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) with a public IP address. This can be either a dynamic address, a static address, or an [allocation](https://docs.nebius.com/vpc/overview.md#allocation). > > To create a VM with a **dynamic public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) for the VM. > 2. Use the following code: > > ```ts > const publicVmService = new InstanceService(sdk); > const publicVmOperation = await publicVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: publicBootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await publicVmOperation.wait(); > ``` > > To create a VM with a **static public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) for the VM. > 2. Use the following code: > > ```ts > const staticVmService = new InstanceService(sdk); > const staticVmOperation = await staticVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: staticBootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({ > static: true, > }), > }), > ], > }), > }), > ).result; > await staticVmOperation.wait(); > ``` > > To create a VM with an **already allocated public IP address**: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```ts > const publicAllocationService = new AllocationService(sdk); > const publicAllocationOperation = > await publicAllocationService.create( > CreateAllocationRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: AllocationSpec.create({ > ipSpec: { > $case: "ipv4Public", > ipv4Public: IPv4PublicAllocationSpec.create({ > pool: { > $case: "subnetId", > subnetId: "", > }, > }), > }, > }), > }), > ).result; > await publicAllocationOperation.wait(); > const allocationId = publicAllocationOperation.resourceId(); > ``` > > 3. Create the VM: > > ```ts > const allocationVmService = new InstanceService(sdk); > const allocationVmOperation = await allocationVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: allocationBootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({ > allocation: { > $case: "allocationId", > allocationId: "", > }, > }), > }), > ], > }), > }), > ).result; > await allocationVmOperation.wait(); > ``` > > Create a VM with a private address only: > > ```ts > const privateOnlyService = new InstanceService(sdk); > const privateOnlyOperation = await privateOnlyService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: privateBootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > }), > ], > }), > }), > ).result; > await privateOnlyOperation.wait(); > ``` > [!NOTE] > > If an allocation with a public address has not been assigned to any resource for 30 days, Nebius AI Cloud can delete this allocation and release its address. If you want to preserve the address, assign its allocation to a Nebius AI Cloud resource. #### How to enable a public IP address for an existing VM You can only assign one public IP address to a VM. If the VM already has a public address, you cannot assign one more. > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Compute** → **Virtual machines**. > 2. On the **Standalone VMs** tab, open the page of the required VM. > 3. Click **Attach resource** → **Public IP address**. > 4. In the window that opens, select whether you want to assign an existing IP address or create a new one. > 5. For an existing IP address, select the required one and then click **Assign address**. > 6. For a new address, specify the address type: dynamic or static. After that, click **Create and assign address**. > > After you enable an IP address for a VM, you can change the type of this address: make it static or dynamic. To do so, go to the VM page, open the **Network interface** tab, and then click  → **Edit type** next to the required address. > [tab] CLI > > To enable a **dynamic public IP address** for a VM, run the following command: > > ```bash > nebius compute instance update \ > --id \ > --network-interfaces "[{\"public_ip_address\": {} }]" > ``` > > To enable a **static public IP address** for a VM, run the following command: > > ```bash > nebius compute instance update \ > --id \ > --network-interfaces "[{\"public_ip_address\": {\"static\": true}}]" > ``` > > To assign an **already allocated public IP address** to a VM: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```bash > nebius vpc allocation create \ > --ipv4-public-subnet-id \ > --name > ``` > > 3. Assign this allocation to the VM: > > ```bash > nebius compute instance update \ > --id \ > --network-interfaces "[{\"public_ip_address\": {\"allocation_id\": \"\"}}]" > ``` > [tab] Terraform > > In the following examples, `# ...` stands for the attributes of the `nebius_compute_v1_instance` resource that don't change. Keep the other attributes of the network interface as they are. > > To enable a **dynamic public IP address** for a VM: > > 1. In the configuration file, update the `nebius_compute_v1_instance` resource. Add an empty `public_ip_address = {}` to the network interface: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > To enable a **static public IP address** for a VM: > > 1. In the configuration file, update the `nebius_compute_v1_instance` resource. Add `public_ip_address` with `static = true` to the network interface: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > static = true > } > } > ] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > To assign an **already allocated public IP address** to a VM: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the VM. > > 2. In the configuration, add an allocation that reserves a static public address: > > ```hcl > resource "nebius_vpc_v1_allocation" "" { > name = "" > parent_id = "" > ipv4_public = { > subnet_id = "" > } > } > ``` > > The file contains the following parameters: > > * `name`: Allocation name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the allocation is created. > * `ipv4_public.subnet_id`: ID of the subnet that the allocation belongs to. > > For the full resource reference, see [nebius\_vpc\_v1\_allocation](https://docs.nebius.com/terraform-provider/reference/resources/vpc_v1_allocation.md). > > 3. In the configuration file, update the `nebius_compute_v1_instance` resource. In `public_ip_address`, `allocation_id` references the ID of the allocation: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > allocation_id = nebius_vpc_v1_allocation..id > } > } > ] > } > ``` > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 4. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 5. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Enable a **dynamic public IP address** for a VM: > > ```go > privateInstance1, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if privateInstance1.GetSpec() == nil { > return errors.New("instance spec is missing") > } > privateInstance1.Spec.NetworkInterfaces[0]. > PublicIpAddress = &compute.PublicIPAddress{} > dynamicIPOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: privateInstance1.Metadata, > Spec: privateInstance1.Spec, > }, > ) > if err != nil { > return err > } > if _, err = dynamicIPOperation.Wait(ctx); err != nil { > return err > } > ``` > > Enable a **static public IP address** for a VM: > > ```go > privateInstance2, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if privateInstance2.GetSpec() == nil { > return errors.New("instance spec is missing") > } > privateInstance2.Spec.NetworkInterfaces[0]. > PublicIpAddress = &compute.PublicIPAddress{Static: true} > staticIPOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: privateInstance2.Metadata, > Spec: privateInstance2.Spec, > }, > ) > if err != nil { > return err > } > if _, err = staticIPOperation.Wait(ctx); err != nil { > return err > } > ``` > > To assign an **already allocated public IP address** to a VM: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```go > publicAllocationOperation, err := sdk.Services().VPC().V1(). > Allocation().Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Public{ > Ipv4Public: &vpc.IPv4PublicAllocationSpec{ > Pool: &vpc.IPv4PublicAllocationSpec_SubnetId{ > SubnetId: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = publicAllocationOperation.Wait(ctx); err != nil { > return err > } > allocationID := publicAllocationOperation.ResourceID() > ``` > > 3. Assign this allocation to the VM: > > ```go > privateInstance3, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if privateInstance3.GetSpec() == nil { > return errors.New("instance spec is missing") > } > privateInstance3.Spec.NetworkInterfaces[0]. > PublicIpAddress = &compute.PublicIPAddress{ > Allocation: &compute.PublicIPAddress_AllocationId{ > AllocationId: "", > }, > } > allocationIPOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: privateInstance3.Metadata, > Spec: privateInstance3.Spec, > }, > ) > if err != nil { > return err > } > if _, err = allocationIPOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > Enable a **dynamic public IP address** for a VM: > > ```python > instance_service = InstanceServiceClient(sdk) > private_instance_1 = await instance_service.get( > GetInstanceRequest(id=""), > ) > if private_instance_1.spec is None: > raise ValueError("instance spec is missing") > private_instance_1.spec.network_interfaces[0].public_ip_address = ( > PublicIPAddress() > ) > dynamic_ip_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=private_instance_1.metadata, > spec=private_instance_1.spec, > ), > ) > await dynamic_ip_operation.wait() > ``` > > Enable a **static public IP address** for a VM: > > ```python > instance_service = InstanceServiceClient(sdk) > private_instance_2 = await instance_service.get( > GetInstanceRequest(id=""), > ) > if private_instance_2.spec is None: > raise ValueError("instance spec is missing") > private_instance_2.spec.network_interfaces[0].public_ip_address = ( > PublicIPAddress(static=True) > ) > static_ip_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=private_instance_2.metadata, > spec=private_instance_2.spec, > ), > ) > await static_ip_operation.wait() > ``` > > To assign an **already allocated public IP address** to a VM: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```python > allocation_service = AllocationServiceClient(sdk) > public_allocation_operation = await allocation_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata(name=""), > spec=AllocationSpec( > ipv4_public=IPv4PublicAllocationSpec( > subnet_id="", > ), > ), > ), > ) > await public_allocation_operation.wait() > allocation_id = public_allocation_operation.resource_id > ``` > > 3. Assign this allocation to the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > private_instance_3 = await instance_service.get( > GetInstanceRequest(id=""), > ) > if private_instance_3.spec is None: > raise ValueError("instance spec is missing") > private_instance_3.spec.network_interfaces[0].public_ip_address = ( > PublicIPAddress(allocation_id="") > ) > allocation_ip_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=private_instance_3.metadata, > spec=private_instance_3.spec, > ), > ) > await allocation_ip_operation.wait() > ``` > [tab] JavaScript SDK > > Enable a **dynamic public IP address** for a VM: > > ```ts > const dynamicIpService = new InstanceService(sdk); > const privateInstance1 = await dynamicIpService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!privateInstance1.spec) { > throw new Error("instance spec is missing"); > } > privateInstance1.spec.networkInterfaces[0].publicIpAddress = > PublicIPAddress.create({}); > const dynamicIpOperation = await dynamicIpService.update( > UpdateInstanceRequest.create({ > metadata: privateInstance1.metadata, > spec: privateInstance1.spec, > }), > ).result; > await dynamicIpOperation.wait(); > ``` > > Enable a **static public IP address** for a VM: > > ```ts > const staticIpService = new InstanceService(sdk); > const privateInstance2 = await staticIpService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!privateInstance2.spec) { > throw new Error("instance spec is missing"); > } > privateInstance2.spec.networkInterfaces[0].publicIpAddress = > PublicIPAddress.create({ > static: true, > }); > const staticIpOperation = await staticIpService.update( > UpdateInstanceRequest.create({ > metadata: privateInstance2.metadata, > spec: privateInstance2.spec, > }), > ).result; > await staticIpOperation.wait(); > ``` > > To assign an **already allocated public IP address** to a VM: > > 1. Get the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) for the VM. > > 2. Create an allocation that reserves a static public address: > > ```ts > const publicAllocationService = new AllocationService(sdk); > const publicAllocationOperation = > await publicAllocationService.create( > CreateAllocationRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: AllocationSpec.create({ > ipSpec: { > $case: "ipv4Public", > ipv4Public: IPv4PublicAllocationSpec.create({ > pool: { > $case: "subnetId", > subnetId: "", > }, > }), > }, > }), > }), > ).result; > await publicAllocationOperation.wait(); > const allocationId = publicAllocationOperation.resourceId(); > ``` > > 3. Assign this allocation to the VM: > > ```ts > const allocationIpService = new InstanceService(sdk); > const privateInstance3 = await allocationIpService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!privateInstance3.spec) { > throw new Error("instance spec is missing"); > } > privateInstance3.spec.networkInterfaces[0].publicIpAddress = > PublicIPAddress.create({ > allocation: { > $case: "allocationId", > allocationId: "", > }, > }); > const allocationIpOperation = await allocationIpService.update( > UpdateInstanceRequest.create({ > metadata: privateInstance3.metadata, > spec: privateInstance3.spec, > }), > ).result; > await allocationIpOperation.wait(); > ``` ### How to get a VM's public IP address > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. On the **Standalone VMs** tab, open the page of the required VM. > 3. Copy the **Public IPv4** value from the **Network** block. > [tab] CLI > > ```bash > export PUBLIC_IP_ADDRESS=$(nebius compute instance get-by-name \ > --name \ > --format json \ > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > echo $PUBLIC_IP_ADDRESS > ``` > [tab] Terraform > > 1. In the configuration that manages the VM, add the following output: > > ```hcl > output "public_ip_address" { > value = nebius_compute_v1_instance..status.network_interfaces[0].public_ip_address.address > } > ``` > > The output reads the `status.network_interfaces[0].public_ip_address.address` attribute of the `nebius_compute_v1_instance` resource. It holds the public IPv4 address of the first network interface of the VM. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > 4. To show the address, run `terraform output public_ip_address`. > [tab] Go SDK > > ```go > publicIPInstance, err := sdk.Services().Compute().V1(). > Instance().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > publicAddress := publicIPInstance.GetStatus(). > GetNetworkInterfaces()[0].GetPublicIpAddress().GetAddress() > publicIPAddress := strings.Split(publicAddress, "/")[0] > fmt.Println(publicIPAddress) > ``` > [tab] Python SDK > > ```python > instance_service = InstanceServiceClient(sdk) > public_ip_instance = await instance_service.get_by_name( > GetByNameRequest(name=""), > ) > public_address = ( > public_ip_instance.status.network_interfaces[0] > .public_ip_address.address > ) > public_ip_address = public_address.split("/")[0] > print(public_ip_address) > ``` > [tab] JavaScript SDK > > ```ts > const publicIpLookupService = new InstanceService(sdk); > const publicIpInstance = await publicIpLookupService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const publicAddress = publicIpInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.address; > const publicIpAddress = publicAddress?.split("/")[0]; > console.log(publicIpAddress); > ``` ### How to migrate a public static IP address from one VM to another To reassign a public static IP address from one VM to another, detach this address from the source VM and attach it to the target VM. Before you begin, make sure that you have a VM with a public static IP address (the source VM) and a VM without a public address (the target VM). For information about creating VMs, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). To migrate the address, do the following: > [tab] CLI > > 1. To get IDs of the source and target VMs, list all VMs: > > ```bash > nebius compute instance list > ``` > > 2. Store the VMs' IDs in environment variables: > > ```bash > SOURCE_VM="" > TARGET_VM="" > ``` > > 3. Extract the allocation ID of the public static IP address currently attached to the source VM. This value is required to reassign the IP address to another VM. > > ```bash > ALLOC_ID=$(nebius compute instance get \ > --id "$SOURCE_VM" \ > --format json | jq -r '.status.network_interfaces[] | select(.name=="eth0") > | .public_ip_address.allocation_id') > ``` > > 4. Pin the allocation in the source VM specification. This prevents the allocation from being deleted when you detach it in the next step. > > ```bash > nebius compute instance update --patch \ > --id "$SOURCE_VM" \ > "$(jq -n --arg alloc "$ALLOC_ID" '{"spec":{"network_interfaces":[{"name":"eth0","public_ip_address":{"static":true,"allocation_id":$alloc}}]}}')" > ``` > > 5. Remove the public IP address from the source VM. This makes the allocation available for reuse. > > ```bash > nebius compute instance update --patch \ > --id "$SOURCE_VM" \ > '{"spec":{"network_interfaces": > [{"name":"eth0","public_ip_address":null}]}}' > ``` > > 6. Assign the same allocation ID to the target VM: > > ```bash > nebius compute instance update --patch \ > --id "$TARGET_VM" \ > "$(jq -n --arg alloc "$ALLOC_ID" '{"spec":{"network_interfaces": > [{"name":"eth0","public_ip_address":{"static":true,"allocation_id":$alloc}}]}}')" > ``` > > The output of this command shows that the allocation is attached to the target VM. > [tab] Terraform > > Both VMs must be managed by your Terraform configuration. In the following examples, `# ...` stands for the attributes of the `nebius_compute_v1_instance` resource that don't change. > > 1. Get the allocation ID of the public static IP address currently attached to the source VM. This value is required to reassign the IP address to another VM. In the Terraform state, it's the `status.network_interfaces[0].public_ip_address.allocation_id` attribute of the source VM resource, which you can see with `terraform state show nebius_compute_v1_instance.`. > > 2. Pin the allocation in the source VM specification. This prevents the allocation from being deleted when you detach it in the next step. > > 1. In the configuration file, update the `nebius_compute_v1_instance` resource of the source VM. In `public_ip_address`, set `static = true` and `allocation_id` to the allocation ID: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > static = true > allocation_id = "" > } > } > ] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > 3. Remove the public IP address from the source VM. This makes the allocation available for reuse. > > 1. In the configuration file, remove `public_ip_address` from the network interface of the source VM: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > } > ] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > 4. Assign the same allocation ID to the target VM: > > 1. In the configuration file, update the `nebius_compute_v1_instance` resource of the target VM. In `public_ip_address`, set `static = true` and `allocation_id` to the allocation ID: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > static = true > allocation_id = "" > } > } > ] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > [tab] Go SDK > > 1. To get IDs of the source and target VMs, list all VMs: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List( > ctx, > &compute.ListInstancesRequest{}, > ) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > 2. Set `sourceVM` to the ID of the source VM and `targetVM` to the ID of the target VM. > > 3. Extract the allocation ID of the public static IP address currently attached to the source VM. This value is required to reassign the IP address to another VM. > > ```go > sourceInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: sourceVM, > }, > ) > if err != nil { > return err > } > allocID := sourceInstance.GetStatus(). > GetNetworkInterfaces()[0].GetPublicIpAddress().GetAllocationId() > if allocID == "" { > return errors.New("allocation ID is missing") > } > ``` > > 4. Pin the allocation in the source VM specification. This prevents the allocation from being deleted when you detach it in the next step. > > ```go > sourceInstanceForPin, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: sourceVM, > }, > ) > if err != nil { > return err > } > if sourceInstanceForPin.GetSpec() == nil { > return errors.New("instance spec is missing") > } > sourceInstanceForPin.Spec.NetworkInterfaces[0]. > PublicIpAddress = &compute.PublicIPAddress{ > Static: true, > Allocation: &compute.PublicIPAddress_AllocationId{ > AllocationId: allocID, > }, > } > pinAllocationOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: sourceInstanceForPin.Metadata, > Spec: sourceInstanceForPin.Spec, > }, > ) > if err != nil { > return err > } > if _, err = pinAllocationOperation.Wait(ctx); err != nil { > return err > } > ``` > > 5. Remove the public IP address from the source VM. This makes the allocation available for reuse. > > ```go > removeInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: sourceVM, > }, > ) > if err != nil { > return err > } > if removeInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > removeInstance.Spec.NetworkInterfaces[0]. > PublicIpAddress = nil > removeAddressOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: removeInstance.Metadata, > Spec: removeInstance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = removeAddressOperation.Wait(ctx); err != nil { > return err > } > ``` > > 6. Assign the same allocation ID to the target VM: > > ```go > assignInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: targetVM, > }, > ) > if err != nil { > return err > } > if assignInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > assignInstance.Spec.NetworkInterfaces[0]. > PublicIpAddress = &compute.PublicIPAddress{ > Static: true, > Allocation: &compute.PublicIPAddress_AllocationId{ > AllocationId: allocID, > }, > } > assignAddressOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: assignInstance.Metadata, > Spec: assignInstance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = assignAddressOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. To get IDs of the source and target VMs, list all VMs: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list(ListInstancesRequest()) > print(instances) > ``` > > 2. Set `source_vm` to the ID of the source VM and `target_vm` to the ID of the target VM. > > 3. Extract the allocation ID of the public static IP address currently attached to the source VM. This value is required to reassign the IP address to another VM. > > ```python > instance_service = InstanceServiceClient(sdk) > source_instance = await instance_service.get( > GetInstanceRequest(id=source_vm), > ) > alloc_id = ( > source_instance.status.network_interfaces[0] > .public_ip_address.allocation_id > ) > if not alloc_id: > raise ValueError("allocation ID is missing") > ``` > > 4. Pin the allocation in the source VM specification. This prevents the allocation from being deleted when you detach it in the next step. > > ```python > instance_service = InstanceServiceClient(sdk) > source_instance_for_pin = await instance_service.get( > GetInstanceRequest(id=source_vm), > ) > if source_instance_for_pin.spec is None: > raise ValueError("instance spec is missing") > source_interfaces = source_instance_for_pin.spec.network_interfaces > source_interfaces[0].public_ip_address = ( > PublicIPAddress(static=True, allocation_id=alloc_id) > ) > pin_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=source_instance_for_pin.metadata, > spec=source_instance_for_pin.spec, > ), > ) > await pin_operation.wait() > ``` > > 5. Remove the public IP address from the source VM. This makes the allocation available for reuse. > > ```python > instance_service = InstanceServiceClient(sdk) > source_instance_for_removal = await instance_service.get( > GetInstanceRequest(id=source_vm), > ) > if source_instance_for_removal.spec is None: > raise ValueError("instance spec is missing") > source_instance_for_removal.spec.network_interfaces[ > 0 > ].public_ip_address = None > remove_address_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=source_instance_for_removal.metadata, > spec=source_instance_for_removal.spec, > ), > ) > await remove_address_operation.wait() > ``` > > 6. Assign the same allocation ID to the target VM: > > ```python > instance_service = InstanceServiceClient(sdk) > target_instance = await instance_service.get( > GetInstanceRequest(id=target_vm), > ) > if target_instance.spec is None: > raise ValueError("instance spec is missing") > target_instance.spec.network_interfaces[0].public_ip_address = ( > PublicIPAddress(static=True, allocation_id=alloc_id) > ) > assign_address_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=target_instance.metadata, > spec=target_instance.spec, > ), > ) > await assign_address_operation.wait() > ``` > [tab] JavaScript SDK > > 1. To get IDs of the source and target VMs, list all VMs: > > ```ts > const listInstanceService = new InstanceService(sdk); > const instances = await listInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(instances); > ``` > > 2. Set `sourceVm` to the ID of the source VM and `targetVm` to the ID of the target VM. > > 3. Extract the allocation ID of the public static IP address currently attached to the source VM. This value is required to reassign the IP address to another VM. > > ```ts > const sourceInstanceService = new InstanceService(sdk); > const sourceInstance = await sourceInstanceService.get( > GetInstanceRequest.create({ > id: sourceVm, > }), > ); > const allocId = sourceInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.allocationId; > if (!allocId) { > throw new Error("allocation ID is missing"); > } > ``` > > 4. Pin the allocation in the source VM specification. This prevents the allocation from being deleted when you detach it in the next step. > > ```ts > const pinAllocationService = new InstanceService(sdk); > const sourceInstanceForPin = await pinAllocationService.get( > GetInstanceRequest.create({ > id: sourceVm, > }), > ); > if (!sourceInstanceForPin.spec) { > throw new Error("instance spec is missing"); > } > sourceInstanceForPin.spec.networkInterfaces[0].publicIpAddress = > PublicIPAddress.create({ > static: true, > allocation: { > $case: "allocationId", > allocationId: allocId, > }, > }); > const pinAllocationOperation = await pinAllocationService.update( > UpdateInstanceRequest.create({ > metadata: sourceInstanceForPin.metadata, > spec: sourceInstanceForPin.spec, > }), > ).result; > await pinAllocationOperation.wait(); > ``` > > 5. Remove the public IP address from the source VM. This makes the allocation available for reuse. > > ```ts > const removeAddressService = new InstanceService(sdk); > const sourceInstanceForRemoval = await removeAddressService.get( > GetInstanceRequest.create({ > id: sourceVm, > }), > ); > if (!sourceInstanceForRemoval.spec) { > throw new Error("instance spec is missing"); > } > sourceInstanceForRemoval.spec.networkInterfaces[0].publicIpAddress = > undefined; > const removeAddressOperation = await removeAddressService.update( > UpdateInstanceRequest.create({ > metadata: sourceInstanceForRemoval.metadata, > spec: sourceInstanceForRemoval.spec, > }), > ).result; > await removeAddressOperation.wait(); > ``` > > 6. Assign the same allocation ID to the target VM: > > ```ts > const assignAddressService = new InstanceService(sdk); > const targetInstance = await assignAddressService.get( > GetInstanceRequest.create({ > id: targetVm, > }), > ); > if (!targetInstance.spec) { > throw new Error("instance spec is missing"); > } > targetInstance.spec.networkInterfaces[0].publicIpAddress = > PublicIPAddress.create({ > static: true, > allocation: { > $case: "allocationId", > allocationId: allocId, > }, > }); > const assignAddressOperation = await assignAddressService.update( > UpdateInstanceRequest.create({ > metadata: targetInstance.metadata, > spec: targetInstance.spec, > }), > ).result; > await assignAddressOperation.wait(); > ``` ## How to detach an IP address from a VM To detach a public address or a secondary private address from a VM: > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Compute** → **Virtual machines**. > 2. On the **Standalone VMs** tab, open the page of the required VM and then go to the **Network interface** tab. > 3. In the line of the allocation that you want to detach from a VM, click  → **Detach**. > 4. In the window that opens, confirm the action. > [tab] CLI > > To detach a public IP address, set the `SOURCE_VM` environment variable to the VM ID and run the following command: > > ```bash > nebius compute instance update --patch \ > --id "$SOURCE_VM" \ > '{"spec":{"network_interfaces": > [{"name":"eth0","public_ip_address":null}]}}' > ``` > > To detach a secondary private IP address, run the following command: > > ```bash > nebius compute instance update \ > --id \ > --network-interfaces "[{\"aliases\": []}]" > ``` > > If the VM has several secondary private IP addresses, keep the aliases that you do not want to detach in the `aliases` list. > [tab] Terraform > > In the following examples, `# ...` stands for the attributes of the `nebius_compute_v1_instance` resource that don't change. Keep the other attributes of the network interface as they are. > > 1. In the configuration file, update the `nebius_compute_v1_instance` resource. > > To detach a public IP address, remove `public_ip_address` from the network interface: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > } > ] > } > ``` > > To detach a secondary private IP address, set `aliases` to an empty list: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > aliases = [] > } > ] > } > ``` > > If the VM has several secondary private IP addresses, keep the aliases that you don't want to detach in the `aliases` list. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > To detach a public IP address, set `sourceVM` to the VM ID: > > ```go > removeInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: sourceVM, > }, > ) > if err != nil { > return err > } > if removeInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > removeInstance.Spec.NetworkInterfaces[0]. > PublicIpAddress = nil > removeAddressOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: removeInstance.Metadata, > Spec: removeInstance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = removeAddressOperation.Wait(ctx); err != nil { > return err > } > ``` > > Detach a secondary private IP address: > > ```go > detachAliasInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if detachAliasInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > detachNetworkInterfaces := detachAliasInstance.Spec.NetworkInterfaces > aliases := detachNetworkInterfaces[0].Aliases[:0] > for _, alias := range detachNetworkInterfaces[0].Aliases { > if alias.GetAllocationId() != "" { > aliases = append(aliases, alias) > } > } > detachNetworkInterfaces[0].Aliases = aliases > detachAliasOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: detachAliasInstance.Metadata, > Spec: detachAliasInstance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = detachAliasOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > To detach a public IP address, set `source_vm` to the VM ID: > > ```python > instance_service = InstanceServiceClient(sdk) > source_instance_for_removal = await instance_service.get( > GetInstanceRequest(id=source_vm), > ) > if source_instance_for_removal.spec is None: > raise ValueError("instance spec is missing") > source_instance_for_removal.spec.network_interfaces[ > 0 > ].public_ip_address = None > remove_address_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=source_instance_for_removal.metadata, > spec=source_instance_for_removal.spec, > ), > ) > await remove_address_operation.wait() > ``` > > Detach a secondary private IP address: > > ```python > instance_service = InstanceServiceClient(sdk) > detach_alias_instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if detach_alias_instance.spec is None: > raise ValueError("instance spec is missing") > aliases = detach_alias_instance.spec.network_interfaces[0].aliases > detach_alias_instance.spec.network_interfaces[0].aliases = [ > alias > for alias in aliases > if alias.allocation_id != "" > ] > detach_alias_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=detach_alias_instance.metadata, > spec=detach_alias_instance.spec, > ), > ) > await detach_alias_operation.wait() > ``` > [tab] JavaScript SDK > > To detach a public IP address, set `sourceVm` to the VM ID: > > ```ts > const removeAddressService = new InstanceService(sdk); > const sourceInstanceForRemoval = await removeAddressService.get( > GetInstanceRequest.create({ > id: sourceVm, > }), > ); > if (!sourceInstanceForRemoval.spec) { > throw new Error("instance spec is missing"); > } > sourceInstanceForRemoval.spec.networkInterfaces[0].publicIpAddress = > undefined; > const removeAddressOperation = await removeAddressService.update( > UpdateInstanceRequest.create({ > metadata: sourceInstanceForRemoval.metadata, > spec: sourceInstanceForRemoval.spec, > }), > ).result; > await removeAddressOperation.wait(); > ``` > > Detach a secondary private IP address: > > ```ts > const detachAliasService = new InstanceService(sdk); > const detachAliasInstance = await detachAliasService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!detachAliasInstance.spec) { > throw new Error("instance spec is missing"); > } > const aliases = > detachAliasInstance.spec.networkInterfaces[0].aliases ?? []; > detachAliasInstance.spec.networkInterfaces[0].aliases = > aliases.filter( > (alias) => alias.allocationId !== "", > ); > const detachAliasOperation = await detachAliasService.update( > UpdateInstanceRequest.create({ > metadata: detachAliasInstance.metadata, > spec: detachAliasInstance.spec, > }), > ).result; > await detachAliasOperation.wait(); > ``` # Tuning TCP window sizes on Linux virtual machines Source: https://docs.nebius.com/compute/virtual-machines/tcp-window-tuning.md TCP throughput depends on how much unacknowledged data a sender and receiver can keep in flight. On long-distance or high-latency connections, the default Linux TCP buffer limits can constrain a single flow before the network link is saturated. This article shows how to increase TCP receive and send window limits on a Linux virtual machine (VM) in Nebius AI Cloud. Use this tuning if your workload transfers large amounts of data over connections with both: * High bandwidth * Noticeable round-trip latency Typical examples include: * Cross-region replication * Large model or dataset transfers * Long-lived TCP sessions that need higher per-flow throughput If your traffic is short-lived, latency-sensitive, or limited by the application rather than the network path, this tuning may have little effect. ## Recommended values The following settings increase the maximum TCP buffer sizes while keeping default behavior unchanged: ```text net.ipv4.tcp_rmem = 4096 131072 268435456 net.ipv4.tcp_wmem = 4096 16384 268435456 net.core.rmem_max = 536870912 net.core.wmem_max = 536870912 net.ipv4.tcp_adv_win_scale = 1 ``` These values keep the minimum and default TCP buffer settings close to the Linux defaults, while increasing the maximum values for high-bandwidth links. The recommended maximum TCP window targets a single flow of about 3 Gbit/s over a 300 ms round-trip-time path. That bandwidth-delay product is about 108 MB, which is rounded up to 128 MiB and then doubled to account for the effect of `net.ipv4.tcp_adv_win_scale=1`. > [!WARNING] > > Larger TCP buffers can increase memory consumption under heavy connection fan-out. Verify available memory before applying this tuning on smaller VMs or on hosts with many simultaneous high-throughput flows. ## How to tune TCP window sizes ### Prerequisites Make sure that: 1. The VM runs Linux. 2. You can connect to the VM by using SSH. For more information, see [How to connect to virtual machines in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/connect.md). 3. You have `sudo` privileges on the VM. ### Apply the changes 1. Connect to the VM: ```bash ssh @ ``` 2. Create a sysctl configuration file: ```bash sudo tee /etc/sysctl.d/90-nebius-tcp-window.conf >/dev/null <<'EOF' net.ipv4.tcp_rmem = 4096 131072 268435456 net.ipv4.tcp_wmem = 4096 16384 268435456 net.core.rmem_max = 536870912 net.core.wmem_max = 536870912 net.ipv4.tcp_adv_win_scale = 1 EOF ``` 3. Apply the configuration: ```bash sudo sysctl --system ``` ### Verify the configuration Check that the VM reports the configured values: ```bash sysctl \ net.ipv4.tcp_rmem \ net.ipv4.tcp_wmem \ net.core.rmem_max \ net.core.wmem_max \ net.ipv4.tcp_adv_win_scale ``` Expected output: ```text net.ipv4.tcp_rmem = 4096 131072 268435456 net.ipv4.tcp_wmem = 4096 16384 268435456 net.core.rmem_max = 536870912 net.core.wmem_max = 536870912 net.ipv4.tcp_adv_win_scale = 1 ``` If your application still does not reach the expected throughput, check the end-to-end path for other limits such as application-level buffer sizing, rate limiting, packet loss, or congestion on the remote side. ### Roll back the changes To remove the configuration: ```bash sudo rm /etc/sysctl.d/90-nebius-tcp-window.conf sudo sysctl --system ``` After rollback, the VM uses the remaining sysctl configuration from the operating system image and any other files in `/etc/sysctl.d`. # FQDN and hostname of a virtual machine Source: https://docs.nebius.com/compute/virtual-machines/fqdn.md When you create a virtual machine (VM), the service assigns an [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) to this VM. By using this FQDN, other VMs can access your VM within a single [network](https://docs.nebius.com/vpc/overview.md#network). The FQDN is registered in the [DNS zone](https://docs.nebius.com/vpc/dns/overview.md) that Nebius AI Cloud creates for this network. You can configure the FQDN on your own or you can use the default FQDN: * The format of the default FQDN is the following: ```text ..compute.internal. ``` In this case, the FQDN (as well as the VM's ID) is only known after the VM is created. * The format of a custom FQDN is the following: ```text ..compute.internal. ``` You can [set the hostname](https://docs.nebius.com/compute/virtual-machines/fqdn.md#how-to-customize-an-fqdn) when you create or update a VM. You can configure an FQDN, but you cannot delete it. The guest OS hostname of the VM is set up during the VM creation; it matches the FQDN. If the FQDN is changed later, the guest OS hostname does not change; and it remains the same as the FQDN was when the VM was created. ## Prerequisites > [!TIP] > > You do not need to complete any prerequisites if you use the web console. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to get an FQDN > [tab] Web console > > To get an FQDN of a VM: > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > 2. Select either the **Standalone VMs** or **Kubernetes nodes** tab. > 3. Open the page of the required VM. > 4. On the **Overview** tab, from the **Network** section, copy the FQDN value. > [tab] CLI > > To get an FQDN of a VM, run the following command: > > ```bash > nebius compute instance get-by-name \ > --name \ > --format json \ > | jq -r '.status.network_interfaces[0].fqdn | split("/")[0]' > ``` > > The FQDN is specified in the `status.network_interfaces.fqdn` field of the output. > [tab] Terraform > > To get an FQDN of a VM, add an output that reads it from the VM status: > > ```hcl > output "fqdn" { > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].fqdn)[0] > } > ``` > > Apply the configuration and get the value with `terraform output -raw fqdn`. > [tab] Go SDK > > Get an FQDN of a VM: > > ```go > fqdnInstance, err := sdk.Services().Compute().V1(). > Instance().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fqdn := fqdnInstance.GetStatus().GetNetworkInterfaces()[0].GetFqdn() > fmt.Println(strings.Split(fqdn, "/")[0]) > ``` > [tab] Python SDK > > Get an FQDN of a VM: > > ```python > fqdn_service = InstanceServiceClient(sdk) > fqdn_instance = await fqdn_service.get_by_name( > GetByNameRequest(name=""), > ) > fqdn = fqdn_instance.status.network_interfaces[0].fqdn > print(fqdn.split("/")[0]) > ``` > [tab] JavaScript SDK > > Get an FQDN of a VM: > > ```ts > const fqdnInstanceService = new InstanceService(sdk); > const fqdnInstance = await fqdnInstanceService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const fqdn = fqdnInstance.status?.networkInterfaces[0]?.fqdn; > console.log(fqdn?.split("/")[0]); > ``` ## How to customize an FQDN If you do not want to use the default FQDN, you can use your own hostname instead of the VM's ID. To customize an FQDN, use the `hostname` parameter: > [tab] Web console > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console) with a customized FQDN: > > In the VM creation wizard, on the **Network** step, in the **Hostname** field, select **Custom** and specify the hostname for the VM's FQDN. > > 2. Change the FQDN of the created VM: > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. Select either the **Standalone VMs** or **Kubernetes nodes** tab. > 3. Open the page of the required VM. > 4. Go to the **Settings** tab. > 5. Modify the **Hostname** field. > 6. Click **Save changes**. > [tab] CLI > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli) with a customized FQDN: > > ```bash > nebius compute instance create \ > ... \ > --hostname > ``` > > 2. Change an FQDN of an existing VM: > > ```bash > nebius compute instance update --id --hostname > ``` > [tab] Terraform > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform) with a customized FQDN: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > ... > hostname = "" > ... > } > ``` > > 2. Change the FQDN of the created VM: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > # ... > hostname = "" > } > ``` > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk) with a customized FQDN: > > ```go > instanceOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "vm-for-scenario", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-d3", > Size: &compute.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > DeviceId: "my-device", > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > Hostname: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > vmID := instanceOperation.ResourceID() > ``` > > 2. Change the FQDN of the created VM: > > ```go > instance, err = sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > instance.Spec.Hostname = "" > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instance.Metadata, > Spec: instance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk) with a customized FQDN: > > ```python > instance_service = InstanceServiceClient(sdk) > create_instance_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="vm-for-scenario"), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=boot_disk_id), > device_id="my-device", > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > hostname="", > ), > ), > ) > await create_instance_operation.wait() > vm_id = create_instance_operation.resource_id > ``` > > 2. Change the FQDN of the created VM: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > instance.spec.hostname = "" > update_instance_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance.metadata, > spec=instance.spec, > ), > ) > await update_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk) with a customized FQDN: > > ```ts > const instanceService = new InstanceService(sdk); > const createInstanceOperation = await instanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "vm-for-scenario", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "my-device", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > hostname: "", > }), > }), > ).result; > await createInstanceOperation.wait(); > const vmId = createInstanceOperation.resourceId(); > ``` > > 2. Change the FQDN of the created VM: > > ```ts > const updateInstanceService = new InstanceService(sdk); > const instanceForHostname = await updateInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceForHostname.spec) { > throw new Error("instance spec is missing"); > } > instanceForHostname.spec.hostname = ""; > const updateInstanceOperation = await updateInstanceService.update( > UpdateInstanceRequest.create({ > metadata: instanceForHostname.metadata, > spec: instanceForHostname.spec, > }), > ).result; > await updateInstanceOperation.wait(); > ``` The hostname must be unique, and it cannot contain a full stop (`.`). For example, if you set `hostname` to `my-host`, the FQDN is the following: ```text my-host.vpcnetwork-e00***.compute.internal. ``` If you do not set `hostname`, the VM's ID is used instead of the hostname, according to the default FQDN. # How to generate SSH keys Source: https://docs.nebius.com/compute/virtual-machines/ssh-keys.md An *SSH key pair* is used to authenticate with a remote resource over SSH. It consists of: * A *public key* that you add to the resource or share with an administrator. * A *private key* that you keep on your local machine and use when connecting. You need an SSH key pair to: * Configure SSH access when [creating a virtual machine (VM)](https://docs.nebius.com/compute/virtual-machines/create.md) and to [connect to your Compute VM](https://docs.nebius.com/compute/virtual-machines/connect.md) over SSH. * [Create a job](https://docs.nebius.com/serverless/jobs/manage.md#how-to-create-a-job) or [endpoint](https://docs.nebius.com/serverless/endpoints/manage.md#how-to-create-an-endpoint) with SSH access. * [Give another user access to a VM](https://docs.nebius.com/compute/virtual-machines/connect.md#shared-access-to-the-vm). * [Connect to login and worker nodes in a Soperator cluster](https://docs.nebius.com/slurm-soperator/clusters/connect.md). * [Access a VM through a jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md) when the VM does not have a public IP address. ## Generating a key pair 1. In the terminal, create the `.ssh` directory if it does not exist: ```bash mkdir -p ~/.ssh chmod 700 ~/.ssh ``` 2. Go to the `~/.ssh` directory: ```bash cd ~/.ssh ``` 3. Generate an SSH key pair: ```bash ssh-keygen -t ed25519 ``` * To add a comment that identifies the key, add the optional `-C` parameter: ```bash ssh-keygen -t ed25519 -C "" ``` 4. When prompted, enter the file path where you want to save the key pair. * To save the key pair to the default location, press `Enter`. * If you already have a key in the default location, specify a custom file name, for example: ```bash /home//.ssh/nebius_ed25519 ``` 5. (Optional) When prompted, enter a passphrase for the private key. Press `Enter` to generate a key without a passphrase. However, using a passphrase protects the private key if someone gets access to your local machine. 6. Repeat the passphrase when prompted. The command creates two files: * The private key, for example `~/.ssh/id_ed25519`. * The public key, for example `~/.ssh/id_ed25519.pub`. ## Getting the public key You need the contents of the public key when a resource or configuration asks for an SSH public key. For example, you can add it to a VM to configure SSH access or send it to an administrator who manages access to the resource. To get the contents of the public key, run: ```bash cat ~/.ssh/id_ed25519.pub ``` If you saved the public key to a custom file when you generated the key, specify the name with the `.pub` extension: ```bash cat ~/.ssh/.pub ``` The output contains the contents of the public key, for example: ```text ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI*** user@example.com ``` ## Protecting the private key Follow these recommendations when using SSH keys: * Keep the private key only on your local machine and don't share it with others. * Share only the public key, which is stored in the file with the `.pub` extension. * Use a passphrase for the private key. * Use a separate key pair for each user. * Remove public keys that are no longer used from the resource. # How to connect to virtual machines in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/connect.md Safe connection to the VM over SSH uses a key pair: you place the public key on the VM and store the private key on your device. ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## Set up the VM To be able to connect to the VM, define specific information during the [VM creation](https://docs.nebius.com/compute/virtual-machines/create.md). ### Generate a key pair Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). You will need the [contents of the public key](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#getting-the-public-key) and the path to your private key in later steps. ### Configure the user data User configuration helps to quickly create VMs with identical user data: it stores your username and the public key for the access to the VM. > [tab] CLI > > Create a configuration in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format: > > ```bash > export USER_DATA=$(jq -Rrs '.' < #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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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] Go SDK > > Define `userData` as a string in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format: > > ```go > publicKeyBytes, err := os.ReadFile( > os.ExpandEnv("$HOME/.ssh/id_ed25519.pub"), > ) > if err != nil { > return err > } > publicKey := strings.TrimSpace(string(publicKeyBytes)) > userData := "#cloud-config\nusers:\n" + > " - name: user\n" + > " sudo: ALL=(ALL) NOPASSWD:ALL\n" + > " shell: /bin/bash\n" + > " ssh_authorized_keys:\n" + > " - " + publicKey > ``` > > The configuration contains the following parameters: > > * `name`: Username for connecting to the VM. The example sets `user`; replace it with your username. > > 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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > Pass `userData` to `InstanceSpec.CloudInitUserData` when you create the VM. > [tab] Python SDK > > Define `user_data` as a string in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format: > > ```python > public_key = ( > Path.home() > .joinpath(".ssh/id_ed25519.pub") > .read_text() > .strip() > ) > user_data = "\n".join( > [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > f" - {public_key}", > ], > ) > ``` > > The configuration contains the following parameters: > > * `name`: Username for connecting to the VM. The example sets `user`; replace it with your username. > > 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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > Pass `user_data` to `InstanceSpec.cloud_init_user_data` when you create the VM. > [tab] JavaScript SDK > > Define `userData` as a string in the [cloud-init](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) format: > > ```ts > const publicKey = readFileSync( > `${process.env.HOME}/.ssh/id_ed25519.pub`, > "utf8", > ).trim(); > const userData = [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > ` - ${publicKey}`, > ].join("\n"); > ``` > > The configuration contains the following parameters: > > * `name`: Username for connecting to the VM. The example sets `user`; replace it with your username. > > 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](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 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). > > Pass `userData` to `InstanceSpec.cloudInitUserData` when you create the VM. ### Configure the VM When you [create the VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm), specify the user data, network settings, and boot disk: > [tab] CLI > > In the `nebius compute instance create` command, set the following parameters: > > * `--cloud-init-user-data`: Pass the user data with your username and public key. > > * `--network-interfaces`: To enable public access to the VM, include `"public_ip_address": {}` in the network interface specification. > > Alternatively, to enable public access to the VM, set `"public_ip_address": {"allocation_id": ""}` with an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) ID. This way the public IP address is preserved as an allocation object and you can reuse it for another VM after deleting this one. > > > [accordion] How to create an allocation > > > > 1. Get the default subnet's ID: > > > > ```bash > > export SUBNET_ID=$(nebius vpc subnet list \ > > --format jsonpath='{.items[0].metadata.id}') > > ``` > > > > 2. Create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) by using the default subnet's ID: > > > > ```bash > > export ALLOCATION_ID=$(nebius vpc allocation create \ > > --ipv4-public-subnet-id $SUBNET_ID \ > > --name allocation-name \ > > --format jsonpath='{.metadata.id}') > > ``` > > > > > [!NOTE] > > > > > > If an allocation with a public address has not been assigned to any resource for 30 days, Nebius AI Cloud can delete this allocation and release its address. If you want to preserve the address, assign its allocation to a Nebius AI Cloud resource. > > Example: > > ```bash > nebius compute instance create \ > --name inference-vm \ > --resources-platform \ > --resources-preset \ > --boot-disk-existing-disk-id \ > --boot-disk-attach-mode READ_WRITE \ > --cloud-init-user-data "$USER_DATA" \ > --network-interfaces '[{"name": "eth0", "subnet_id": "", "ip_address": {}, "public_ip_address": {"allocation_id": ""}}]' > ``` > [tab] Terraform > > 1. Create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) for the public IP address: > > ```hcl > resource "nebius_vpc_v1_allocation" "" { > name = "" > parent_id = "" > ipv4_public = { > subnet_id = "" > } > } > ``` > > The file contains the following parameters: > > * `name`: Allocation name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the allocation is created. > * `ipv4_public.subnet_id`: ID of the subnet in which the public IP address is allocated. > > This way the public IP address is preserved as an allocation object and you can reuse it for another VM after deleting this one. > > > [!NOTE] > > > > If an allocation with a public address has not been assigned to any resource for 30 days, Nebius AI Cloud can delete this allocation and release its address. If you want to preserve the address, assign its allocation to a Nebius AI Cloud resource. > > For the full resource reference, see [nebius\_vpc\_v1\_allocation](https://docs.nebius.com/terraform-provider/reference/resources/vpc_v1_allocation.md). > > 2. Add the VM configuration with the user data, network settings, and boot disk: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > existing_disk = { > id = "" > } > attach_mode = "READ_WRITE" > } > cloud_init_user_data = file("") > network_interfaces = [ > { > name = "eth0" > subnet_id = "" > ip_address = {} > public_ip_address = { > allocation_id = "" > } > } > ] > } > ``` > > The file contains the following parameters: > > * `name`: VM name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the VM is created. > * `resources.platform` and `resources.preset`: [Platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md) of the VM. > * `boot_disk.existing_disk.id`: ID of the boot disk. > * `boot_disk.attach_mode`: Write permission of the boot disk. The only supported value is `READ_WRITE`. > * `cloud_init_user_data`: User data with your username and public key. Save the [cloud-init configuration](https://docs.nebius.com/compute/virtual-machines/connect.md#configure-the-user-data) to a file and pass its path to the `file()` function. > * `network_interfaces`: Network interface settings. `subnet_id` is the ID of the subnet, `ip_address = {}` assigns a private IP address, and `public_ip_address.allocation_id` enables public access to the VM by using the allocation ID. > > Alternatively, to enable public access with a dynamic public IP address, set `public_ip_address = {}` without an allocation. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the subnet ID: > > ```go > subnets, err := sdk.Services().VPC().V1(). > Subnet().List( > ctx, > &vpc.ListSubnetsRequest{}, > ) > if err != nil { > return err > } > if len(subnets.GetItems()) == 0 { > return errors.New("no subnets found") > } > subnetID := subnets.GetItems()[0].GetMetadata().GetId() > ``` > > 2. Create a public allocation: > > ```go > allocationOperation, err := sdk.Services().VPC().V1(). > Allocation().Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "allocation-name", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Public{ > Ipv4Public: &vpc.IPv4PublicAllocationSpec{ > Pool: &vpc.IPv4PublicAllocationSpec_SubnetId{ > SubnetId: subnetID, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = allocationOperation.Wait(ctx); err != nil { > return err > } > allocationID := allocationOperation.ResourceID() > ``` > > 3. Set the platform, preset, existing boot disk ID, and cloud-init user data: > > ```go > publicAllocation := &compute.PublicIPAddress_AllocationId{ > AllocationId: allocationID, > } > instanceOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "inference-vm", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: "", > }, > }, > }, > CloudInitUserData: userData, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "eth0", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{ > Allocation: publicAllocation, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the subnet ID: > > ```python > subnet_service = SubnetServiceClient(sdk) > subnets = await subnet_service.list(ListSubnetsRequest()) > if not subnets.items: > raise ValueError("no subnets found") > subnet_id = subnets.items[0].metadata.id > ``` > > 2. Create a public allocation: > > ```python > allocation_service = AllocationServiceClient(sdk) > allocation_operation = await allocation_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata(name="allocation-name"), > spec=AllocationSpec( > ipv4_public=IPv4PublicAllocationSpec( > subnet_id=subnet_id, > ), > ), > ), > ) > await allocation_operation.wait() > allocation_id = allocation_operation.resource_id > ``` > > 3. Set the platform, preset, existing boot disk ID, and cloud-init user data: > > ```python > instance_service = InstanceServiceClient(sdk) > create_instance_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata(name="inference-vm"), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=""), > ), > cloud_init_user_data=user_data, > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress( > allocation_id=allocation_id, > ), > ), > ], > ), > ), > ) > await create_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the subnet ID: > > ```ts > const subnetService = new SubnetService(sdk); > const subnets = await subnetService.list( > ListSubnetsRequest.create({}), > ); > const subnetId = subnets.items[0]?.metadata?.id; > if (!subnetId) { > throw new Error("no subnets found"); > } > ``` > > 2. Create a public allocation: > > ```ts > const allocationService = new AllocationService(sdk); > const allocationOperation = await allocationService.create( > CreateAllocationRequest.create({ > metadata: ResourceMetadata.create({ > name: "allocation-name", > }), > spec: AllocationSpec.create({ > ipSpec: { > $case: "ipv4Public", > ipv4Public: IPv4PublicAllocationSpec.create({ > pool: { > $case: "subnetId", > subnetId, > }, > }), > }, > }), > }), > ).result; > await allocationOperation.wait(); > const allocationId = allocationOperation.resourceId(); > ``` > > 3. Set the platform, preset, existing boot disk ID, and cloud-init user data: > > ```ts > const connectInstanceService = new InstanceService(sdk); > const connectInstanceOperation = await connectInstanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "inference-vm", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: "", > }), > }, > }), > cloudInitUserData: userData, > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "eth0", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({ > allocation: { > $case: "allocationId", > allocationId, > }, > }), > }), > ], > }), > }), > ).result; > await connectInstanceOperation.wait(); > ``` For the full set of parameters and more examples, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md#examples). ## Connect to the VM by using SSH > [!NOTE] > > **Requirements to connect to a private IP address or FQDN** > > To connect to a VM from another VM by using a [private IP address](https://docs.nebius.com/compute/virtual-machines/network.md#private-ip-addresses) or an [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md), both VMs must be in the same network. An FQDN resolves only from workloads in the network whose [DNS zone](https://docs.nebius.com/vpc/dns/overview.md) holds it. Within that network, the VM's hostname alone is enough. 1. Get your VM's IP address: > [tab] Connecting from the internet > > To connect to the VM from the internet (if you have enabled public access to it), get its public IP address: > > > [tab] CLI > > > > ```bash > > export PUBLIC_IP_ADDRESS=$(nebius compute instance get-by-name \ > > --name \ > > --format json \ > > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > > ``` > > > [tab] Terraform > > > > Add an output that reads the public IP address from the VM status: > > > > ```hcl > > output "public_ip_address" { > > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].public_ip_address.address)[0] > > } > > ``` > > > > Apply the configuration and get the value with `terraform output -raw public_ip_address`. > > > [tab] Go SDK > > > > ```go > > publicInstance, err := sdk.Services().Compute().V1(). > > Instance().GetByName( > > ctx, > > &common.GetByNameRequest{ > > Name: "", > > }, > > ) > > if err != nil { > > return err > > } > > publicAddress := publicInstance.GetStatus(). > > GetNetworkInterfaces()[0].GetPublicIpAddress().GetAddress() > > publicIPAddress := strings.Split(publicAddress, "/")[0] > > if publicIPAddress == "" { > > return fmt.Errorf("public IP address is missing") > > } > > ``` > > > [tab] Python SDK > > > > ```python > > public_ip_service = InstanceServiceClient(sdk) > > public_instance = await public_ip_service.get_by_name( > > GetByNameRequest(name=""), > > ) > > public_address = ( > > public_instance.status.network_interfaces[0] > > .public_ip_address.address > > ) > > public_ip_address = public_address.split("/")[0] > > ``` > > > [tab] JavaScript SDK > > > > ```ts > > const publicIpInstanceService = new InstanceService(sdk); > > const publicIpInstance = await publicIpInstanceService.getByName( > > GetByNameRequest.create({ > > name: "", > > }), > > ); > > const publicAddress = publicIpInstance.status > > ?.networkInterfaces[0]?.publicIpAddress?.address; > > let publicIpAddress = publicAddress?.split("/")[0]; > > ``` > [tab] Connecting from another VM > > To connect to the VM from another Compute VM, get the private IP address or FQDN of the VM that you connect to: > > > [tab] CLI > > > > * Private IP address: > > > > ```bash > > nebius compute instance get-by-name \ > > --name \ > > --format json \ > > | jq -r '.status.network_interfaces[0].ip_address.address | split("/")[0]' > > ``` > > > > * FQDN: > > > > ```bash > > nebius compute instance get-by-name \ > > --name \ > > --format json \ > > | jq -r '.status.network_interfaces[0].fqdn | split("/")[0]' > > ``` > > > [tab] Terraform > > > > Add outputs that read the values from the VM status: > > > > * Private IP address: > > > > ```hcl > > output "private_ip_address" { > > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].ip_address.address)[0] > > } > > ``` > > > > * FQDN: > > > > ```hcl > > output "fqdn" { > > value = split("/", nebius_compute_v1_instance..status.network_interfaces[0].fqdn)[0] > > } > > ``` > > > > Apply the configuration and get the values with `terraform output -raw private_ip_address` and `terraform output -raw fqdn`. > > > [tab] Go SDK > > > > * Private IP address: > > > > ```go > > privateInstance, err := sdk.Services().Compute().V1(). > > Instance().GetByName( > > ctx, > > &common.GetByNameRequest{ > > Name: "", > > }, > > ) > > if err != nil { > > return err > > } > > privateAddress := privateInstance.GetStatus(). > > GetNetworkInterfaces()[0].GetIpAddress().GetAddress() > > fmt.Println(strings.Split(privateAddress, "/")[0]) > > ``` > > > > * FQDN: > > > > ```go > > fqdnInstance, err := sdk.Services().Compute().V1(). > > Instance().GetByName( > > ctx, > > &common.GetByNameRequest{ > > Name: "", > > }, > > ) > > if err != nil { > > return err > > } > > fqdn := fqdnInstance.GetStatus().GetNetworkInterfaces()[0].GetFqdn() > > fmt.Println(strings.Split(fqdn, "/")[0]) > > ``` > > > [tab] Python SDK > > > > * Private IP address: > > > > ```python > > private_ip_service = InstanceServiceClient(sdk) > > private_instance = await private_ip_service.get_by_name( > > GetByNameRequest(name=""), > > ) > > private_address = ( > > private_instance.status.network_interfaces[0] > > .ip_address.address > > ) > > print(private_address.split("/")[0]) > > ``` > > > > * FQDN: > > > > ```python > > fqdn_service = InstanceServiceClient(sdk) > > fqdn_instance = await fqdn_service.get_by_name( > > GetByNameRequest(name=""), > > ) > > fqdn = fqdn_instance.status.network_interfaces[0].fqdn > > print(fqdn.split("/")[0]) > > ``` > > > [tab] JavaScript SDK > > > > * Private IP address: > > > > ```ts > > const privateIpInstanceService = new InstanceService(sdk); > > const privateIpInstance = await privateIpInstanceService.getByName( > > GetByNameRequest.create({ > > name: "", > > }), > > ); > > const privateAddress = privateIpInstance.status > > ?.networkInterfaces[0]?.ipAddress?.address; > > console.log(privateAddress?.split("/")[0]); > > ``` > > > > * FQDN: > > > > ```ts > > const fqdnInstanceService = new InstanceService(sdk); > > const fqdnInstance = await fqdnInstanceService.getByName( > > GetByNameRequest.create({ > > name: "", > > }), > > ); > > const fqdn = fqdnInstance.status?.networkInterfaces[0]?.fqdn; > > console.log(fqdn?.split("/")[0]); > > ``` 2. Connect to the VM: > [tab] Connecting from the internet > > ```bash > ssh @ > ``` > > If your private key is stored in a custom location, specify the path to it with the `-i` parameter: > > ```bash > ssh -i ~/.ssh/ @ > ``` > [tab] Connecting from another VM > > Use the received private address or FQDN: > > ```bash > ssh @ > ``` > > If your private key is stored in a custom location, specify the path to it with the `-i` parameter: > > ```bash > ssh -i ~/.ssh/ @ > ``` ## Shared access to the VM To let the other users connect to your VM: 1. Ask them to [generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#generating-a-key-pair) and share the [contents of their public key](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#getting-the-public-key) with you. 2. Connect to the VM under the name used when creating the VM: ```bash ssh @ ``` 3. Create a new user for VM access, named `newuser` in this example: ```bash sudo useradd -m -d /home/newuser -s /bin/bash newuser ``` 4. Switch to the new user: ```bash sudo su - newuser ``` 5. Create the `ssh` directory: ```bash mkdir .ssh ``` 6. In the directory, create the `authorized_keys` file: ```bash cd .ssh touch authorized_keys ``` 7. Add the new user's public key to the created file: ```bash echo "" > /home/newuser/.ssh/authorized_keys ``` 8. Change the directory's access permissions: ```bash chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys ``` 9. Exit the new user's shell: ```bash exit ``` 10. Restart the VM: ```bash sudo reboot ``` 11. Ask the other user to check the connection: ```bash ssh newuser@ ``` ## Example Example of getting the public IP address of the VM named `training-instance` and connecting to it from the internet: > [tab] CLI > > ```bash > export PUBLIC_IP_ADDRESS=$(nebius compute instance get-by-name \ > --name training-instance \ > --format json \ > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > ssh $USER@$PUBLIC_IP_ADDRESS > ``` > [tab] Terraform > > Add an output that reads the public IP address from the status of the `training_instance` resource: > > ```hcl > output "training_instance_public_ip_address" { > value = split("/", nebius_compute_v1_instance.training_instance.status.network_interfaces[0].public_ip_address.address)[0] > } > ``` > > Apply the configuration and connect to the VM: > > ```bash > ssh @$(terraform output -raw training_instance_public_ip_address) > ``` > [tab] Go SDK > > ```go > trainingInstance, err := sdk.Services().Compute().V1(). > Instance().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "training-instance", > }, > ) > if err != nil { > return err > } > trainingAddress := trainingInstance.GetStatus(). > GetNetworkInterfaces()[0].GetPublicIpAddress().GetAddress() > publicIPAddress = strings.Split(trainingAddress, "/")[0] > fmt.Printf("ssh user@%s\n", publicIPAddress) > ``` > [tab] Python SDK > > ```python > training_ip_service = InstanceServiceClient(sdk) > training_instance = await training_ip_service.get_by_name( > GetByNameRequest(name="training-instance"), > ) > training_address = ( > training_instance.status.network_interfaces[0] > .public_ip_address.address > ) > public_ip_address = training_address.split("/")[0] > print(f"ssh user@{public_ip_address}") > ``` > [tab] JavaScript SDK > > ```ts > const trainingInstanceService = new InstanceService(sdk); > const trainingInstance = await trainingInstanceService.getByName( > GetByNameRequest.create({ > name: "training-instance", > }), > ); > const trainingAddress = trainingInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.address; > publicIpAddress = trainingAddress?.split("/")[0]; > console.log(`ssh user@${publicIpAddress}`); > ``` # Creating a jump server with WireGuard installed on it Source: https://docs.nebius.com/compute/virtual-machines/wireguard.md You can create a jump server to build a reliable tunnel between two zones: * Secure zone that consists of virtual machine (VMs) created in Nebius AI Cloud * Demilitarized zone (DMZ) that consists of machines outside Nebius AI Cloud All connections from the DMZ to the secure zone go through the jump server. This solution provides several benefits: * You can use one public IP address to access all VMs. * You can keep the number of public addresses within a [quota](https://docs.nebius.com/compute/resources/quotas-limits.md#network). * You can limit access to the secure zone and allow only authorized machines to connect to the secure zone. To create a jump server, deploy a VM with [WireGuard](https://www.wireguard.com) installed and configure a VPN. The traffic between the zones is routed in an encrypted form via the jump server. To create a VM with WireGuard deployed, Nebius AI Cloud offers a Terraform-based solution. You can apply manifests that contain configuration of a VM with a WireGuard image. ## Costs The tutorial includes the following chargeable resources: * [Compute virtual machines](https://docs.nebius.com/compute/resources/pricing.md#virtual-machines-gpus-vcpus-ram) * [Compute disks](https://docs.nebius.com/compute/resources/pricing.md#disks) ## Prerequisites 1. [Install Terraform](https://developer.hashicorp.com/terraform/install). 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. The Terraform-based solution uses the CLI to get credentials. For enhanced security, [use a service account](https://docs.nebius.com/cli/configure.md#how-to-set-up-the-cli-for-a-service-account) to configure the CLI. Make sure that this account is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 3. Install `jq`: ```bash Ubuntu sudo apt-get install jq ``` ```bash macOS brew install jq ``` 4. Clone the [nebius-solution-library](https://github.com/nebius/nebius-solution-library/tree/main) repository from where the WireGuard solution is going to be deployed: ```bash git clone git@github.com:nebius/nebius-solution-library.git ``` 5. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). ## Steps ### Deploy infrastructure 1. In your terminal, go to the `wireguard` directory in the cloned repository: ```bash cd nebius-solution-library/wireguard ``` 2. In the `environment.sh` file in this directory, uncomment the following variables and specify values for them: * `NEBIUS_TENANT_ID`: [Tenant ID](https://docs.nebius.com/iam/get-tenants.md). * `NEBIUS_PROJECT_ID`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). * `NEBIUS_REGION`: [Region](https://docs.nebius.com/overview/regions.md) where your project is located. You can find the region in the web console, in the list of projects. 3. Run the script that creates an access token for Terraform, saves the token to environment variables and configures Terraform state to be saved in Object Storage: ```bash source ./environment.sh ``` 4. Initialize Terraform in the `wireguard` directory: ```bash terraform init ``` 5. In the `terraform.tfvars` file in this directory, uncomment the following variables and specify values for them: * `ssh_user_name`: User required for an SSH connection to the VM, for example `user1`. * `ssh_public_key`: Public SSH key that you [created earlier](https://docs.nebius.com/compute/virtual-machines/wireguard.md#prerequisites). Specify either the key body or the path to this key. * `public_ip_allocation_id`: ID of an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) with a public IP address. The WireGuard UI will be available at this address. To preserve the address even in case of the VM deletion, create the allocation: ```bash nebius vpc allocation create \ --ipv4-public-subnet-id \ --name wireguard_allocation \ --parent-id \ --format jsonpath='{.metadata.id}' ``` The command returns the allocation ID. Specify it in the `public_ip_allocation_id` variable. 6. Preview the configuration that you are going to deploy: ```bash terraform plan ``` 7. Apply the changes: ```bash terraform apply ``` When the command is finished, it returns the VM public address: ```text Outputs: wg_instance_pib = "" ``` Copy the address: It is required to connect to the deployed VM. ### Access WireGuard 1. Connect to the VM: ```bash ssh -i @ ``` The command contains: * Path to the private SSH key that you [created earlier](https://docs.nebius.com/compute/virtual-machines/wireguard.md#prerequisites) * Username specified in the `terraform.tfvars` file * Public IP address of the deployed VM 2. Get the WireGuard UI password: ```bash sudo cat /var/lib/wireguard-ui/initial_password ``` 3. In the browser, open the WireGuard UI at `http://:5000`. 4. In the window that opens, sign in with the `admin` username and the password retrieved from the VM. The working space of the WireGuard UI opens. ### Configure WireGuard Set up a VPN and grant access to the VMs in the secure zone. To do this, add the DMZ machines as WireGuard clients: 1. Click  **New client**. 2. In the window that opens, specify details of the machines that require access. In the **Allowed IPs** field, enter CIDRs of these machines. 3. Click **Submit**. 4. After the window is closed, click **Apply config**. Click this button every time after you create, change, or delete WireGuard clients. After that, the DMZ machines are able to connect to the VMs in the secure zone. You do not need to configure the same access for the jump server because it is located in the same subnet as the VMs in the secure zone. ## How to delete the created resources The created Compute virtual machine and its boot disk are chargeable. If you do not need them, delete these resources, so Nebius AI Cloud does not charge for it. Use the following command to delete all the created infrastructure at once: ```bash terraform destroy ``` # InfiniBand™ networking for Compute virtual machines with GPUs Source: https://docs.nebius.com/compute/clusters/gpu/index.md You can group your virtual machines with GPUs into a *GPU cluster*. The cluster accelerates high-performance computing (HPC) tasks such as training and inference. These tasks require a lot of processing power that a single VM cannot provide. The GPU clusters are built with InfiniBand™ secure high-speed networking. Each GPU in a VM is connected through a network interface card (NIC) that provides 400 Gbps. As a compute VM for GPU clusters consists of 8 GPUs, the total bandwidth for a node is 3.2 Tbps. Nebius AI Cloud uses GPUDirect RDMA, an NVIDIA® technology of remote direct memory access (RDMA) that allows data to flow directly between each GPU and its NIC, avoiding CPU, thus boosting the data exchange speed. ## InfiniBand™ fabrics Each GPU cluster is created in one of the physical *InfiniBand™ fabrics*. This is where GPUs interconnected over InfiniBand™ are located. Each fabric has limited GPU capacity. When creating a GPU cluster, select an InfiniBand™ fabric for it. Take into account the type of GPUs you are going to use. For example, if you select `fabric-7`, you can only add NVIDIA® H200 NVLink GPUs to this cluster. Available fabrics and corresponding regions: | Fabric | GPU platform | [Region](https://docs.nebius.com/overview/regions.md) | | - | - | - | | `fabric-2` | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `eu-north1` | | `fabric-3` | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `eu-north1` | | `fabric-4` | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `eu-north1` | | `fabric-5` | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `eu-west1` | | `fabric-6` | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `eu-north1` | | `fabric-7` | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `eu-north1` | | `eu-north2-a` | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `eu-north2` | | `eu-west2-a` | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `eu-west2` | | `me-west1-a` | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `me-west1` | | `uk-south1-a` | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `uk-south1` | | `us-central1-a` | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `us-central1` | | `us-central1-b` | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `us-central1` | | `us-north1-a` | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `us-north1` | > [!NOTE] > > In most cases, you do not need to change the preselected fabric. We recommend that you create a GPU cluster in another fabric only if it is better suited for a different platform or if you experience capacity issues with an existing GPU cluster. ## Isolation and security of InfiniBand™ traffic Nebius AI Cloud isolates InfiniBand™ traffic between GPU clusters by using InfiniBand™ *partition keys* (P-Keys). Each GPU cluster is assigned a unique P-Key to create isolation inside shared [physical InfiniBand™ fabrics](https://docs.nebius.com/compute/clusters/gpu/topology.md). This way, nodes in different GPU clusters cannot communicate over InfiniBand™ even if they use the same fabric infrastructure. This creates isolation between [tenants](https://docs.nebius.com/iam/overview.md#tenants) without requiring a dedicated physical fabric for each cluster. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to enable InfiniBand™ for VMs with GPUs > [tab] Web console > > 1. Create a GPU cluster: > > 1. In the sidebar, go to  **Compute** → **GPU clusters**. > 2. Click  **Create GPU cluster**. > 3. On the page that opens, specify the cluster name. It should contain from 3 to 63 characters: lowercase letters, numbers, and hyphens. > 4. Select the InfiniBand™ fabric. > 5. Click **Create GPU cluster**. > 2. Add VMs to the cluster. You can assign a GPU cluster only when creating a VM: > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > 2. Click **Create resource** → **Virtual machine**. > 3. On the **Compute** step of the VM creation wizard, select a platform and preset compatible with GPU clusters. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > 4. In the **Settings** section, select an existing GPU cluster in the **GPU cluster** field, or create a new one. > 5. On the **Storage** step, select the boot disk for NVIDIA® GPUs. For details, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > You can also create a GPU cluster while [creating the first VM in it](https://docs.nebius.com/compute/virtual-machines/create.md): > > 1. On the **Compute** step of the VM creation wizard: > > 1. Select a platform and a preset compatible with GPU clusters. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > 2. In the **Settings** section, create or select a GPU cluster in the **GPU cluster** field. > 2. On the **Storage** step, select the boot disk for NVIDIA® GPUs. For details, see [Boot disk images for Compute virtual machines](https://docs.nebius.com/compute/storage/boot-disk-images.md). > [tab] CLI > > 1. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > ```bash > cat ~/.nebius/config.yaml > ``` > > 2. If you have not set your project ID as `parent-id`, or you want to create resources in a different project, [get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id) and update your [CLI profile](https://docs.nebius.com/cli/configure.md): > ```bash > nebius profile update --parent-id > ``` > > 3. Depending on the [region](https://docs.nebius.com/overview/regions.md) of your project, select an [InfiniBand™ fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics) for VM interconnection and save it to an environment variable: > > ```bash > export INFINIBAND_FABRIC= > ``` > > 4. Create a GPU cluster and save its ID: > > ```bash > export GPU_CLUSTER_ID=$(nebius compute gpu-cluster create \ > --name \ > --infiniband-fabric $INFINIBAND_FABRIC \ > --format jsonpath='{.metadata.id}') > ``` > > Where: > > * `Name`: Cluster name that you can use to quickly find the cluster. > > 5. Create a boot disk optimized for VMs with NVIDIA® GPUs: > > ```bash > export BOOT_DISK_ID=$(nebius compute disk create \ > --name \ > --size-gibibytes 200 \ > --type network_ssd \ > --source-image-family-image-family ubuntu24.04-cuda13.0 \ > --block-size-bytes 4096 \ > --format jsonpath='{.metadata.id}') > ``` > > For compatible boot disk images (`--source-image-family-image-family`), see [Boot disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 6. [Create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli) with GPUs and specify the GPU cluster ID in its parameters. > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > For example: > > ```bash > nebius compute instance create \ > --resources-platform gpu-h100-sxm \ > --resources-preset 8gpu-128vcpu-1600gb \ > --gpu-cluster-id $GPU_CLUSTER_ID \ > --boot-disk-existing-disk-id $BOOT_DISK_ID \ > ... > ``` > > Specify a VM platform with GPUs in `--resources-platform`, and a preset compatible with GPU clusters in `--resources-preset`. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > [tab] Terraform > > 1. Depending on the [region](https://docs.nebius.com/overview/regions.md) of your project, select an [InfiniBand™ fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics) for VM interconnection and set it in a local value: > > ```hcl > locals { > infiniband_fabric = "" > } > ``` > > 2. Create a GPU cluster: > > ```hcl > resource "nebius_compute_v1_gpu_cluster" "" { > name = "" > parent_id = "" > infiniband_fabric = local.infiniband_fabric > } > ``` > > The file contains the following parameters: > > * `name`: A cluster name that you can use to quickly find the cluster. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the cluster is created. > * `infiniband_fabric`: The fabric from the local value. > > For the full resource reference, see [nebius\_compute\_v1\_gpu\_cluster](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_gpu_cluster.md). > > 3. Create a boot disk optimized for VMs with NVIDIA® GPUs: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "" > parent_id = "" > type = "NETWORK_SSD" > size_gibibytes = 200 > block_size_bytes = 4096 > source_image_family = { > image_family = "ubuntu24.04-cuda13.0" > } > } > ``` > > For compatible boot disk images (`source_image_family.image_family`), see [Boot disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md). For the full resource reference, see [nebius\_compute\_v1\_disk](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md). > > 4. [Create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform) with GPUs and reference the GPU cluster in its configuration. > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > For example: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > stopped = false > resources = { > platform = "gpu-h100-sxm" > preset = "8gpu-128vcpu-1600gb" > } > gpu_cluster = { > id = nebius_compute_v1_gpu_cluster..id > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = nebius_compute_v1_disk..id > } > } > network_interfaces = [ > { > name = "ni" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > Specify a VM platform with GPUs in `resources.platform`, and a preset compatible with GPU clusters in `resources.preset`. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > The `gpu_cluster.id` parameter references the GPU cluster and `boot_disk.existing_disk.id` references the boot disk created earlier. In `network_interfaces.subnet_id`, specify the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 5. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 6. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Depending on the [region](https://docs.nebius.com/overview/regions.md) of your project, select an [InfiniBand™ fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics) for VM interconnection and set it in the code: > > ```go > infinibandFabric := "" > ``` > > 2. Create a GPU cluster and save its ID: > > ```go > gpuClusterOperation, err := sdk.Services().Compute().V1(). > GpuCluster().Create( > ctx, > &compute.CreateGpuClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.GpuClusterSpec{ > InfinibandFabric: infinibandFabric, > }, > }, > ) > if err != nil { > return err > } > if _, err = gpuClusterOperation.Wait(ctx); err != nil { > return err > } > gpuClusterID := gpuClusterOperation.ResourceID() > ``` > > Where: > > * `Metadata.Name`: Cluster name that you can use to quickly find the cluster. > > 3. Create a boot disk optimized for VMs with NVIDIA® GPUs: > > ```go > diskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 200, > }, > BlockSizeBytes: 4096, > Type: compute.DiskSpec_NETWORK_SSD, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = diskOperation.Wait(ctx); err != nil { > return err > } > bootDiskID := diskOperation.ResourceID() > ``` > > For compatible boot disk images, see [Boot disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 4. [Create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk) with GPUs and specify the GPU cluster ID in its parameters. > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > ```go > attachMode := compute.AttachedDiskSpec_READ_WRITE > instanceOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "vm", > }, > Spec: &compute.InstanceSpec{ > Stopped: true, > Resources: &compute.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &compute.ResourcesSpec_Preset{ > Preset: "8gpu-128vcpu-1600gb", > }, > }, > GpuCluster: &compute.InstanceGpuClusterSpec{ > Id: gpuClusterID, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: attachMode, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID, > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "ni", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > > Specify a VM platform with GPUs and a preset compatible with GPU clusters. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > [tab] Python SDK > > 1. Depending on the [region](https://docs.nebius.com/overview/regions.md) of your project, select an [InfiniBand™ fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics) for VM interconnection and set it in the code: > > ```python > infiniband_fabric = "" > ``` > > 2. Create a GPU cluster and save its ID: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > create_cluster_operation = await gpu_cluster_service.create( > CreateGpuClusterRequest( > metadata=ResourceMetadata( > name="", > ), > spec=GpuClusterSpec( > infiniband_fabric=infiniband_fabric, > ), > ), > ) > await create_cluster_operation.wait() > gpu_cluster_id = create_cluster_operation.resource_id > ``` > > Where: > > * `metadata.name`: Cluster name that you can use to quickly find the cluster. > > 3. Create a boot disk optimized for VMs with NVIDIA® GPUs: > > ```python > disk_service = DiskServiceClient(sdk) > create_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="", > ), > spec=DiskSpec( > block_size_bytes=4096, > type=DiskSpec.DiskType.NETWORK_SSD, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ), > size_gibibytes=200, > ), > ), > ) > await create_disk_operation.wait() > boot_disk_id = create_disk_operation.resource_id > ``` > > For compatible boot disk images, see [Boot disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 4. [Create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk) with GPUs and specify the GPU cluster ID in its parameters. > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > ```python > instance_service = InstanceServiceClient(sdk) > create_instance_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="vm", > ), > spec=InstanceSpec( > stopped=True, > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="8gpu-128vcpu-1600gb", > ), > gpu_cluster=InstanceGpuClusterSpec( > id=gpu_cluster_id, > ), > boot_disk=AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk(id=boot_disk_id), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="ni", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await create_instance_operation.wait() > ``` > > Specify a VM platform with GPUs and a preset compatible with GPU clusters. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > [tab] JavaScript SDK > > 1. Depending on the [region](https://docs.nebius.com/overview/regions.md) of your project, select an [InfiniBand™ fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics) for VM interconnection and set it in the code: > > ```ts > const infinibandFabric = ""; > ``` > > 2. Create a GPU cluster and save its ID: > > ```ts > const gpuClusterService = new GpuClusterService(sdk); > const createGpuClusterOperation = await gpuClusterService.create( > CreateGpuClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: GpuClusterSpec.create({ > infinibandFabric, > }), > }), > ).result; > await createGpuClusterOperation.wait(); > const gpuClusterId = createGpuClusterOperation.resourceId(); > ``` > > Where: > > * `metadata.name`: Cluster name that you can use to quickly find the cluster. > > 3. Create a boot disk optimized for VMs with NVIDIA® GPUs: > > ```ts > const diskService = new DiskService(sdk); > const createDiskOperation = await diskService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSpec.create({ > blockSizeBytes: 4096, > type: DiskSpec_DiskType.NETWORK_SSD, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }), > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 200, > }, > }), > }), > ).result; > await createDiskOperation.wait(); > const bootDiskId = createDiskOperation.resourceId(); > ``` > > For compatible boot disk images, see [Boot disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md). > > 4. [Create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk) with GPUs and specify the GPU cluster ID in its parameters. > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > ```ts > const instanceService = new InstanceService(sdk); > const createInstanceOperation = await instanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "vm", > }), > spec: InstanceSpec.create({ > stopped: true, > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "8gpu-128vcpu-1600gb", > }, > }), > gpuCluster: InstanceGpuClusterSpec.create({ > id: gpuClusterId, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId, > }), > }, > }), > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "ni", > subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await createInstanceOperation.wait(); > ``` > > Specify a VM platform with GPUs and a preset compatible with GPU clusters. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). ## How to test the connection with the NCCL tests To test InfiniBand™ performance in a Compute cluster, you can run the NVIDIA® Collective Communications Library (NCCL) test in it. For instructions, see our tutorial on running distributed jobs with [MPIrun](https://docs.nebius.com/3p-integrations/mpirun.md): it uses the NCCL test as an example. ## How to delete a GPU cluster Before deleting a GPU cluster, make sure all virtual machines in the cluster are deleted or moved to another cluster. > [tab] Web console > > 1. In the sidebar, go to **Compute** → **GPU clusters**. > 2. In the row of the GPU cluster you want to delete, click → **Delete**. > 3. In the window that opens, confirm the deletion. > [tab] CLI > > 1. Get the ID of the GPU cluster you want to delete: > > ```bash > nebius compute gpu-cluster list > ``` > > 2. Delete the GPU cluster: > > ```bash > nebius compute gpu-cluster delete > ``` > [tab] Terraform > > 1. In your Terraform configuration, remove the `nebius_compute_v1_gpu_cluster` resource for the GPU cluster that you want to delete. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the GPU cluster you want to delete: > > ```go > gpuClusters, err := sdk.Services().Compute().V1(). > GpuCluster().List( > ctx, > &compute.ListGpuClustersRequest{ > ParentId: nbProject, > }, > ) > if err != nil { > return err > } > fmt.Println(gpuClusters) > ``` > > 2. Delete the GPU cluster: > > ```go > delClusterOp, err := sdk.Services().Compute().V1(). > GpuCluster().Delete( > ctx, > &compute.DeleteGpuClusterRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = delClusterOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the GPU cluster you want to delete: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > gpu_clusters = await gpu_cluster_service.list( > ListGpuClustersRequest(parent_id=nb_project), > ) > print(gpu_clusters) > ``` > > 2. Delete the GPU cluster: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > delete_cluster_operation = await gpu_cluster_service.delete( > DeleteGpuClusterRequest(id=""), > ) > await delete_cluster_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the GPU cluster you want to delete: > > ```ts > const listGpuClusterService = new GpuClusterService(sdk); > const gpuClusters = await listGpuClusterService.list( > ListGpuClustersRequest.create({ > parentId: nbProject, > }), > ); > console.log(gpuClusters); > ``` > > 2. Delete the GPU cluster: > > ```ts > const deleteGpuClusterService = new GpuClusterService(sdk); > const deleteClusterOperation = await deleteGpuClusterService.delete( > DeleteGpuClusterRequest.create({ > id: "", > }), > ).result; > await deleteClusterOperation.wait(); > ``` ## See also * [How to test a GPU cluster physical state in Compute](https://docs.nebius.com/compute/clusters/gpu/test.md) * [InfiniBand™ networking for Compute virtual machines with GPUs](https://docs.nebius.com/kubernetes/gpu/clusters.md) * [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md) * [Running the all-reduce NCCL performance test in Soperator clusters](https://docs.nebius.com/slurm-soperator/jobs/examples/nccl-all-reduce.md) *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # How to test a GPU cluster physical state in Compute Source: https://docs.nebius.com/compute/clusters/gpu/test.md In this article, you will learn how to test the physical state of the InfiniBand™ connection. The guides below will help you to check that InfiniBand connections are established between GPUs in a GPU cluster. ## Testing the port state 1. [Connect to the VM using SSH](https://docs.nebius.com/compute/virtual-machines/connect.md). 2. In the VM's shell, run `ibstatus` command that displays operational information about InfiniBand network devices. Result: ```bash Infiniband device 'mlx5_0' port 1 status: default gid: fe80:0000:0000:0000:****:****:****:03c5 base lid: 0x*** sm lid: 0x* state: 4: ACTIVE phys state: 5: LinkUp rate: 400 Gb/sec (4X NDR) link_layer: InfiniBand Infiniband device 'mlx5_1' port 1 status: default gid: fe80:0000:0000:0000:****:****:****:03c6 base lid: 0x*** sm lid: 0x* state: 4: ACTIVE phys state: 5: LinkUp rate: 400 Gb/sec (4X NDR) link_layer: InfiniBand ... ``` 3. For each device in the result, check the physical state (`phys state`): it should be `LinkUp`. ## Testing network performance You can also emulate the network activity by sending some data from GPUs on one VM to GPUs on another: 1. Install the [perftest](https://github.com/linux-rdma/perftest) package on each one of the test VMs: ```bash sudo apt install perftest ``` 2. [Connect to the first VM using SSH](https://docs.nebius.com/compute/virtual-machines/connect.md). 3. Run `ib_send_bw --report_gbits`. 4. Copy the first VM's [private IP address](https://docs.nebius.com/compute/virtual-machines/network.md). 5. [Connect to the second VM using SSH](https://docs.nebius.com/compute/virtual-machines/connect.md). 6. Run `ib_send_bw --report_gbits`. In the commands output, you should see non-zero values for the bytes sent, average bandwith speed, and average message rate. The bandwidth peak speed might not reach the theoretical maximum 400 Gbps. Example: ```text +--------------------------------------------------------------------------------+ | #bytes #iterations #BW peak[Gb/sec] #BW average[Gb/sec] #MsgRate[Mpps] | +--------------------------------------------------------------------------------+ | 65536 1000 360.39 359.91 0.686466 | +--------------------------------------------------------------------------------+ ``` ## See also * [InfiniBand™ networking for Compute virtual machines with GPUs](https://docs.nebius.com/compute/clusters/gpu/index.md) * [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md) *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # InfiniBand™ topology of a GPU cluster Source: https://docs.nebius.com/compute/clusters/gpu/topology/index.md ## Why InfiniBand topology is important Workload managers like [Slurm](https://slurm.schedmd.com) and [Volcano](https://volcano.sh/en/docs/) allow you to specify the network topology of your virtual machines within a GPU cluster for *topology-aware job scheduling*. Topology files describe how the VMs are located relative to each other. When you provide a topology file to a workload manager, it schedules distributed jobs on the worker nodes that are topologically closest to each other. This reduces network latency in such jobs and leads to better performance in both real workloads and synthetic tests. > For example, the [AllReduce](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#allreduce) tests from the [NCCL Tests suite](https://github.com/NVIDIA/nccl-tests) that we ran in Nebius AI Cloud as topology-aware jobs have shown performance gains of up to 20%, depending on cluster size, compared to the same tests without the topology provided. ## Architecture of InfiniBand topology Every virtual machine with GPUs is connected to a set of three nodes related to a particular [InfiniBand fabric](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). Every node is located on a separate network layer. The hierarchy of an InfiniBand network includes the following layers with different types of switches: 1. InfiniBand fabric layer. Contains a root switch. 2. Point of delivery (POD). Represents a set of racks with servers. Core switches interconnect PODs. 3. Scalable unit (SU). Consists of a set of servers. Leaf switches interconnect scalable units. ![image](https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/compute/infiniband-topology.svg?fit=max\&auto=format\&n=1Ha0sWR6e1mnIaHS\&q=85\&s=7102c09389941e8bfbd15e9ead1ec842) ## Cost of network communication The cost of network communication increases as you go to a higher layer. For example, if you need to transfer data from one POD to another, the data goes through a root switch. This leads to a higher cost of resources. Mutual connections between PODs or SUs do not influence the cost. If a connection or data exchange takes place within one entity (POD or SU), the cost of network communication does not change. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Working with InfiniBand™ topology of a GPU cluster Source: https://docs.nebius.com/compute/clusters/gpu/topology/manage.md [InfiniBand™ topology](https://docs.nebius.com/compute/clusters/gpu/topology.md) can help you increase performance of multi-VM jobs in GPU clusters. ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to get InfiniBand™ topology of a GPU cluster After you [create a GPU cluster and add VMs to it](https://docs.nebius.com/compute/clusters/gpu/index.md#how-to-enable-infiniband-for-vms-with-gpus), you can view the InfiniBand™ topology of this cluster and its VMs. > [tab] Cluster topology > > To get the topology for all VMs in a GPU cluster: > > > [tab] CLI > > > > Run the following command: > > > > ```bash > > nebius compute gpu-cluster get --id computegpucluster-*** > > ``` > > > > In the `--id` parameter, specify the GPU cluster ID. > > > > The output example is the following: > > > > ```text > > ... > > status: > > infiniband_topology_path: > > instances: > > - instance_id: computeinstance-***rnqz > > path: > > - ***27bf > > - ***bb9b > > - ***b7ad > > - instance_id: computeinstance-***pepp > > path: > > - ***27bf > > - ***bb9b > > - ***e1ff > > - ... > > ``` > > > [tab] Go SDK > > > > ```go > > gpuCluster, err := sdk.Services().Compute().V1(). > > GpuCluster().Get( > > ctx, > > &compute.GetGpuClusterRequest{ > > Id: "computegpucluster-***", > > }, > > ) > > if err != nil { > > return err > > } > > fmt.Println(gpuCluster) > > ``` > > > > In the code, specify the GPU cluster ID. > > > [tab] Python SDK > > > > ```python > > gpu_cluster_service = GpuClusterServiceClient(sdk) > > gpu_cluster = await gpu_cluster_service.get( > > GetGpuClusterRequest(id="computegpucluster-***"), > > ) > > print(gpu_cluster) > > ``` > > > > In the code, specify the GPU cluster ID. > > > [tab] JavaScript SDK > > > > ```ts > > const getGpuClusterService = new GpuClusterService(sdk); > > const gpuCluster = await getGpuClusterService.get( > > GetGpuClusterRequest.create({ > > id: "computegpucluster-***", > > }), > > ); > > console.log(gpuCluster); > > ``` > > > > In the code, specify the GPU cluster ID. > [tab] VM topology > > To get the topology for an individual VM: > > > [tab] CLI > > > > Run the following command: > > > > ```bash > > nebius compute instance get --id computeinstance-*** > > ``` > > > > In the `--id` parameter, specify the ID of the VM attached to the GPU cluster. > > > > The output example is the following: > > > > ```text > > ... > > status: > > infiniband_topology_path: > > path: > > - ***27bf > > - ***bb9b > > - ***e1ff > > ``` > > > [tab] Go SDK > > > > ```go > > instance, err := sdk.Services().Compute().V1(). > > Instance().Get( > > ctx, > > &compute.GetInstanceRequest{ > > Id: "computeinstance-***", > > }, > > ) > > if err != nil { > > return err > > } > > fmt.Println(instance) > > ``` > > > > In the code, specify the ID of the VM attached to the GPU cluster. > > > [tab] Python SDK > > > > ```python > > instance_service = InstanceServiceClient(sdk) > > instance = await instance_service.get( > > GetInstanceRequest(id="computeinstance-***"), > > ) > > print(instance) > > ``` > > > > In the code, specify the ID of the VM attached to the GPU cluster. > > > [tab] JavaScript SDK > > > > ```ts > > const getInstanceService = new InstanceService(sdk); > > const instance = await getInstanceService.get( > > GetInstanceRequest.create({ > > id: "computeinstance-***", > > }), > > ); > > console.log(instance); > > ``` > > > > In the code, specify the ID of the VM attached to the GPU cluster. In the topology data, the `path` list shows components of the [InfiniBand™ network layers](https://docs.nebius.com/compute/clusters/gpu/topology.md#architecture-of-infiniband-topology): ```text ***27bf # 1st network layer (InfiniBand™ fabric) ***bb9b # 2nd network layer (point of delivery, POD) ***e1ff # 3rd network layer (scalable unit, SU) ``` ## How to create the Slurm topology configuration To set up topology in [Slurm](https://slurm.schedmd.com) and run jobs for ML workloads, you need the [topology.conf](https://slurm.schedmd.com/topology.conf.html) file. This file shows the network hierarchy: how nodes are interconnected, what layers they are located at and what switches are used. The `topology.conf` file represents InfiniBand™ topology. You can create this file based on the [information about a given GPU cluster](https://docs.nebius.com/compute/clusters/gpu/topology/manage.md#how-to-get-infiniband-topology-of-a-gpu-cluster). To create the file, run one of the scripts from the [Nebius AI Cloud solution library](https://github.com/nebius/nebius-solution-library/tree/main/scripts/ib-topology) on GitHub. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Capacity advisor for GPU availability in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/capacity-advisor.md Nebius AI Cloud's *capacity advisor* provides insights into GPU capacity availability for launching virtual machines (VMs) with specific hardware presets. It helps you understand where you can launch VMs based on your [quotas](https://docs.nebius.com/compute/resources/quotas-limits.md) and the current physical capacity in Nebius AI Cloud [regions](https://docs.nebius.com/overview/regions.md). ## Scope The capacity advisor provides data for the following virtual machines with GPUs: * **By service**: * VMs that you create directly in Compute * [Managed Soperator](https://docs.nebius.com/slurm-soperator/index.md) nodes * [Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/index.md) nodes * VMs launched by [Serverless AI](https://docs.nebius.com/serverless/index.md) for running Devlabs, jobs, and endpoints * **By type**: * [Regular VMs](https://docs.nebius.com/compute/virtual-machines/create.md) * [Preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) * [VMs with reservations](https://docs.nebius.com/compute/virtual-machines/reservations.md) Data about computing resource availability of VMs without GPUs isn't provided. > [!WARNING] > > Data provided by the capacity advisor is accurate as of a specific timestamp included in the data and doesn't guarantee availability of GPU resources at creation time. ## Prerequisites > [tab] Web console > > Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `viewer` role within your tenant > ; for example, the default `viewers` group. > You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `viewer` role within your tenant > ; for example, the default `viewers` group. > You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `viewer` role within your tenant > ; for example, the default `viewers` group. > You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `viewer` role within your tenant > ; for example, the default `viewers` group. > You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `viewer` role within your tenant > ; for example, the default `viewers` group. > You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. Nebius AI Cloud provider for Terraform doesn't support the capacity advisor. ## How to get data from the capacity advisor > [!NOTE] > > For preemptible VMs, the capacity advisor estimates availability by using the current [spot price](https://docs.nebius.com/signup-billing/pricing-policy.md), as if the **Follows spot price** option were selected. If you use a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) with a max price lower than the current spot price, the actual number of VMs you can start may be lower than shown, including zero. > [tab] Web console > > In the sidebar, go to **Administration** → **Capacity dashboard**. > > For each VM platform, preset, region, InfiniBand™ fabric and VM type (regular, preemptible or with reservations), the capacity advisor shows: > > * How many VMs you can launch, based on your quotas and the current physical capacity (for regular and [preemptible](https://docs.nebius.com/compute/virtual-machines/preemptible.md) VMs) or on your active [capacity reservations](https://docs.nebius.com/compute/virtual-machines/reservations.md) (for VMs with reservations). > * How likely you are to be able to launch the displayed number of regular or preemptible VMs. > > > For example, if your quota for a certain kind of VMs is 10 VMs, you have a high chance of launching them all when the overall capacity is in the hundreds, but a low chance when the capacity is less than 10 VMs. > > As reservations guarantee you a certain number of GPUs that aren't subject to quotas, the chance of launch isn't displayed for VMs with reservations. > [tab] CLI > > 1. Get the tenant ID. > > To get the tenant ID, go to the [web console](https://console.nebius.com) and expand the list of tenants. Next to the tenant’s name, click → **Copy tenant ID**. > > 2. Run `nebius capacity resource-advice list` to get the capacity advisor data: > > ```bash > nebius capacity resource-advice list --parent-id > ``` > > In the output, each list item contains data for a single combination of VM platform, preset, region, InfiniBand™ fabric and VM type: > > ```yaml highlight={3-8,15-16,19-22,25-28} > items: > - spec: > region: eu-north1 > fabric: fabric-2 > compute_instance: > platform: gpu-h100-sxm > preset: > name: 1gpu-16vcpu-200gb > resources: > vcpu_count: 16 > memory_gibibytes: 200 > gpu_count: 1 > gpu_memory_gigabytes: 80 > status: > reserved: > availability_level: AVAILABILITY_LEVEL_LIMIT_REACHED > data_state: DATA_STATE_FRESH > effective_at: "2026-03-27T11:25:55.695087Z" > on_demand: > available: 24 > limit: 32 > availability_level: AVAILABILITY_LEVEL_HIGH > data_state: DATA_STATE_FRESH > effective_at: "2026-03-27T11:08:07.360Z" > preemptible: > available: 22 > limit: 128 > availability_level: AVAILABILITY_LEVEL_MEDIUM > data_state: DATA_STATE_FRESH > effective_at: "2026-03-27T11:08:07.360Z" > ... > ``` > > In the `.items[*].status` fields, `on_demand`, `preemptible` and `reserved` contain data about regular VMs, preemptible VMs and VMs with reservations, respectively. Each of these fields contains the following data: > > * `available`: Maximum number of VMs that you can launch, based on your quotas and the current physical capacity. > > * `limit`: Your current quota. > > * `availability_level`: Level of resource availability. Possible values: > > * `AVAILABILITY_LEVEL_LOW`: **Low chance of launch** — Available capacity is significantly lower than your quota. Creating resources might not be possible. > * `AVAILABILITY_LEVEL_MEDIUM`: **Medium chance of launch** — Available capacity is lower than your quota. Creating resources is possible, but may fail. > * `AVAILABILITY_LEVEL_HIGH`: **High chance of launch** — Available capacity is enough to fully satisfy your quota. > * `AVAILABILITY_LEVEL_LIMIT_REACHED`: **Launch impossible** — No available capacity. > > * `data_state`: State of the data. Possible values: > > * `DATA_STATE_FRESH`: Data is up to date (fetched recently). > * `DATA_STATE_STALE`: Data is stale (fetched a long time ago). > * `DATA_STATE_UNKNOWN`: Capacity advisor failed to fetch data. > > * `effective_at`: Timestamp of the last update. > [tab] Go SDK > > 1. Get the tenant ID. > > To get the tenant ID, go to the [web console](https://console.nebius.com) and expand the list of tenants. Next to the tenant’s name, click → **Copy tenant ID**. > > 2. List the capacity advisor data: > > ```go > advice, err := sdk.Services().Capacity().V1(). > ResourceAdvice().List( > ctx, > &capacity.ListResourceAdviceRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(advice) > ``` > > In the code, set `ParentId` to the tenant ID. > > The response contains `Items`, where each item has a `Spec` and a `Status`. `Spec` includes `Region`, `Fabric` and `ComputeInstance` (with `Platform`, `Preset.Name` and `GpuMemoryGigabytes`). `Status` contains `OnDemand`, `Preemptible` and `Reserved`, each with: > > * `Available`: Maximum number of VMs you can launch. > * `Limit`: Your current quota. > * `AvailabilityLevel`: Level of resource availability. > * `DataState`: State of the data. > * `EffectiveAt`: Timestamp of the last update. > [tab] Python SDK > > 1. Get the tenant ID. > > To get the tenant ID, go to the [web console](https://console.nebius.com) and expand the list of tenants. Next to the tenant’s name, click → **Copy tenant ID**. > > 2. List the capacity advisor data: > > ```python > resource_advice_service = ResourceAdviceServiceClient(sdk) > advice = await resource_advice_service.list( > ListResourceAdviceRequest(parent_id=""), > ) > print(advice) > ``` > > In the code, set `parent_id` to the tenant ID. > > The response contains `items`, where each item has a `spec` and a `status`. `spec` includes `region`, `fabric` and `compute_instance` (with `platform`, `preset.name` and `gpu_memory_gigabytes`). `status` contains `on_demand`, `preemptible` and `reserved`, each with: > > * `available`: Maximum number of VMs you can launch. > * `limit`: Your current quota. > * `availability_level`: Level of resource availability. > * `data_state`: State of the data. > * `effective_at`: Timestamp of the last update. > [tab] JavaScript SDK > > 1. Get the tenant ID. > > To get the tenant ID, go to the [web console](https://console.nebius.com) and expand the list of tenants. Next to the tenant’s name, click → **Copy tenant ID**. > > 2. List the capacity advisor data: > > ```ts > const resourceAdviceService = > new ResourceAdviceService(sdk); > const advice = await resourceAdviceService.list( > ListResourceAdviceRequest.create({ > parentId: "", > }), > ); > console.log(advice); > ``` > > In the code, set `parentId` to the tenant ID. > > The response contains `items`, where each item has a `spec` and a `status`. `spec` includes `region`, `fabric` and `computeInstance` (with `platform`, `preset.name` and `gpuMemoryGigabytes`). `status` contains `onDemand`, `preemptible` and `reserved`, each with: > > * `available`: Maximum number of VMs you can launch. > * `limit`: Your current quota. > * `availabilityLevel`: Level of resource availability. > * `dataState`: State of the data. > * `effectiveAt`: Timestamp of the last update. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Capacity reservations for Compute virtual machines Source: https://docs.nebius.com/compute/virtual-machines/reservations.md To make sure that GPU capacity is always available for your virtual machines (VMs), you can reserve GPUs. A *reservation* represents a [capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md), and it reserves a specific number of GPUs that are allocated to your infrastructure. GPUs from a reservation remain available, even if a VM is stopped. Without reservations, GPU capacity is taken from a shared pool and returned when a VM is stopped (for example, by you or a [maintenance event](https://docs.nebius.com/compute/virtual-machines/maintenance.md)). To start using reservations, send a request to your Nebius manager. In this request, specify how many GPUs you would like to reserve and for what period. If you are not in contact with a Nebius manager, you can ask [technical support](https://console.nebius.com/support/create-ticket) to connect you with one. After reservations are ready, you can add them to your VMs when you create or update these VMs. You can also check your capacity block groups on the **Limits** page and get detailed information about them. For more information, see [List of capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md#list-of-capacity-block-groups). > [!NOTE] > > GPUs allocated from reservations do not count towards [quotas on the number of GPUs](https://docs.nebius.com/compute/resources/quotas-limits.md#gpu-virtual-machines). ## How to add reservations to VMs VMs of a regular type and with GPUs support reservations. [Preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) and VMs without GPUs do not support them. > [tab] Web console > > If you want to [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console) and you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md), on the **General** step, select **Reserved VM**. On the **Compute** step, select a platform and configure the **Reservation** settings. If you do not have capacity block groups, the wizard skips the **General** step and opens **Compute** instead. > > If you want to modify an existing VM, [stop it](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually-web-console) first and then go to its **Settings** tab on the VM page. Next, update the reservation settings. > > The **Reservation** section is only displayed if you have capacity block groups. > > In the **Reservation** section, you can configure the following options: > > * **Any (existing and future)** (default): Compute selects among your matching capacity block groups automatically. > * **Specific capacity block groups**: Select one or more capacity block groups. Each option shows the capacity block group ID, reservation period, and GPU usage. Make sure the selected groups have enough capacity and do not expire soon. > * **Switch to PAYG**: Choose whether the VM can start after you create or restart it without active intervals in selected capacity block groups: > > * **When reservation is exhausted** (default): The VM can start as a pay-as-you-go VM when no capacity is available in the selected capacity block groups. > * **Never**: The VM cannot start without available capacity in the selected capacity block groups. > > This does not affect the VM when it is running. If an interval in a selected capacity block group expires while the VM is running, the VM always continues as a pay-as-you-go VM, regardless of this setting. > > If you have capacity block groups in multiple regions, select a **Region** first. > [tab] CLI > > Use the `--reservation-policy-*` parameters when creating or updating a VM: > > * To create a VM, use the following command: > > ```bash > nebius compute instance create \ > ... \ > --reservation-policy-policy \ > --reservation-policy-reservation-ids > ``` > > * To update a VM, [stop it](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually-cli) first and then use the following command: > > ```bash > nebius compute instance update \ > ... \ > --reservation-policy-policy \ > --reservation-policy-reservation-ids > ``` > > Description of the parameters: > > * `--reservation-policy-policy`: Policy for reservation usage. Supports the following values: > > * `auto`: VM resources are allocated from reservations. If no reservations are currently available, the VM runs without them. In this case, resources for the VM are provided from the common pool. > > > [!NOTE] > > > > The `auto` value is the default. If you don't have any reservations and you don't set the `--reservation-policy-policy` parameter, the `auto` value applies and the VM runs without reservations. > * `forbid`: VM resources are provided from the common pool, and no reservations are used. > * `strict`: VM resources are exclusively allocated from reservations. The VM doesn't run without the reservations. > * `--reservation-policy-reservation-ids` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation-ids` | **Behavior** | > | - | - | - | > | `auto` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `auto` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `forbid` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `forbid` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `strict` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `strict` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] Terraform > > Use the `reservation_policy` parameter in the VM configuration: > > ```hcl > resource "nebius_compute_v1_instance" "my_vm" { > ... > reservation_policy = { > policy = "" > reservation_ids = "" > } > ... > } > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the following values: > > * `AUTO`: VM resources are allocated from reservations. If no reservations are currently available, the VM runs without them. In this case, resources for the VM are provided from the common pool. > > > [!NOTE] > > > > The `AUTO` value is the default. If you don't have any reservations and you don't set the `policy` parameter, the `AUTO` value applies and the VM runs without reservations. > * `FORBID`: VM resources are provided from the common pool, and no reservations are used. > * `STRICT`: VM resources are exclusively allocated from reservations. The VM doesn't run without the reservations. > * `reservation_ids`: IDs of specific reservations (capacity block groups). You can use this parameter with the `AUTO` and `STRICT` reservation usages: > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation_ids` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] Go SDK > > Use `ReservationPolicy` in `InstanceSpec` when creating or updating a VM: > > ```go > reservationPolicy := &compute.ReservationPolicy{ > Policy: compute.ReservationPolicy_STRICT, > ReservationIds: []string{ > "", > }, > } > ``` > > Description of the parameters: > > * `Policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `ReservationIds` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `Policy` | `ReservationIds` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] Python SDK > > Use `reservation_policy` in `InstanceSpec` when creating or updating a VM: > > ```python > reservation_policy = ReservationPolicy( > policy=ReservationPolicy.Policy.STRICT, > reservation_ids=[""], > ) > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `reservation_ids` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation_ids` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | > [tab] JavaScript SDK > > Use `reservationPolicy` in `InstanceSpec` when creating or updating a VM: > > ```ts > const reservationPolicy = ReservationPolicy.create({ > policy: ReservationPolicy_Policy.STRICT, > reservationIds: [""], > }); > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `reservationIds` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservationIds` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, VM resources are provided from the common pool, not from a reservation. | > | `AUTO` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), VM resources are provided from the common pool. | > | `FORBID` | Not specified | VM resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. If you apply this combination, it will result in a validation error. | > | `STRICT` | Not specified | Compute tries to launch a VM in any available and suitable reservation. If none is found, a request for creating or updating a VM fails. | > | `STRICT` | Specified | Compute tries to launch a VM in one of the specified reservations. If none of them fit, a request for creating or updating a VM fails. | ## How to find information about reservations for an already configured VM You can check the list of VMs and an overview of a given VM to find information about the VM reservations. ### List of VMs The [list of VMs](https://console.nebius.com/compute) provides the following: * The **Platform and VM type** column shows what configuration you have set up for a given VM. * The **Current reservations** column shows what reservations are currently used. Data in these columns does not always match: * If a VM is preemptible or stopped, **Current reservations** do not show any data (**N/A** is displayed). * If capacity in reservations is exhausted, **Current reservations** show that there are no reservations currently consumed. ### VM overview On the VM page, on the **VM overview** tab, in the **Resource capacity** block, you can find more detailed information: * The **VM type**, **Reservation usage** and **If no capacity** fields show the configuration that you have set up. * The **Current reservations** and **Next interval** fields show the current consumption of reservations. If the VM runs without reservations, no data about them is displayed. ## Billing for reservations Reservations and [billing models](https://docs.nebius.com/signup-billing/billing-models/overview.md) do not match directly. If your VMs run without reservations, this does not mean that the pay-as-you-go (PAYG) pricing applies by default for these VMs. It depends on whether you have an addendum for the commitment discounts. When a Nebius manager creates reservations for you, they also prepare an addendum for the commitment discounts. After the addendum comes into force, you are charged for VMs based on this billing model. If your VM runs without reservations, the service still charges you based on the commitment discounts because of the addendum. If you do not have the addendum, your VMs are based on PAYG. ## See also * [Capacity block groups in Nebius AI Cloud](https://docs.nebius.com/overview/limits/capacity-block-groups.md) * [Capacity reservations for Managed Service for Kubernetes® node groups](https://docs.nebius.com/kubernetes/node-groups/reservations.md) # Running AI workloads on VMs Source: https://docs.nebius.com/compute/clusters/ai-workloads.md You can run AI workloads on Compute VMs by using third-party tools. Information about how to do it is now located in separate documentation. See [Third-party integrations with Nebius AI Cloud](https://docs.nebius.com/3p-integrations/index.md). # Types of storage volumes in Compute Source: https://docs.nebius.com/compute/storage/types.md In Compute, storage resources that can be added to virtual machines (VMs) as separate managed resources are called *volumes*. Compute offers two types of managed volumes and one host-local storage option: * [Disks](https://docs.nebius.com/compute/storage/types.md#disks): * **Network SSD disks**: managed *block storage* volumes. * **Local SSD disks**: *ephemeral* host-local block storage. * [Shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems) are *file storage* volumes. A filesystem can be shared by multiple VMs. Nebius AI Cloud also provides *object storage* through a separate service, [Object Storage](https://docs.nebius.com/object-storage/index.md). Together, these block, file and object storage options cover all [use cases](https://docs.nebius.com/compute/storage/types.md#use-cases-and-suggestions) for data preparation, training and inference workloads, as well as associated infrastructure (boot disks, database hosts etc.) ## Disks *Disks* provide block storage for Compute VMs. Data that you put on disks is divided into blocks that are stored efficiently and reliably on underlying physical drives. You can create boot disks and additional disks. A *boot disk* is a core disk in a VM, and an *additional disk* is mainly for data storage. Compute provides different disk sources: * [Public disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md) supported by the platform. * [Custom disk images](https://docs.nebius.com/compute/storage/custom-disk-images.md) that you create and tailor to your needs. * Custom image families that contain a series of custom images and provide the latest image for the disk. * [Disk snapshots](https://docs.nebius.com/compute/storage/disk-snapshots.md), which are point-in-time copies of a disk state. Alternatively, you can [create](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-disk) a blank disk. Images and image families are only supported for boot disks. ### Network and local SSD disks Compute offers two kinds of disks: * [Network SSD disks](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks) can be created as a boot disk for a VM, from one of the boot disk images provided by Nebius AI Cloud, or as an empty additional disk. One Compute network SSD disk can only be added to one running VM at a time. * [Local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) are Non-Volatile Memory Express (NVMe) drives physically attached to the Compute host that runs a virtual machine (VM). They are not created or managed as separate storage resources, and you can only add them when [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). #### Network SSD disks * **Network SSD** (`network_ssd`) Reliable disks backed by solid state drives (SSDs). Best used for infrastructure purposes: as VM boot disks, disks on Slurm controller VMs, etc. Reliability of Network SSD disks is ensured by means of [erasure coding](https://en.wikipedia.org/wiki/Erasure_code). A disk will tolerate up to two concurrent hardware failures in the Nebius AI Cloud [region](https://docs.nebius.com/overview/regions.md). * **Network SSD Non-replicated** (Network SSD NRD, `network_ssd_non_replicated`) High-performance disks backed by SSDs. Best used as temporary storage without strict reliability requirements, for example, a boot disk for nodes in Managed Service for Kubernetes® clusters where redundancy is less important. Data blocks of Network SSD Non-replicated disks are stored in [NVMe namespaces](https://nvmexpress.org/resource/nvme-namespaces/) on underlying SSDs. The size of each namespace is 93 GiB, so the disk size must be a multiple of 93 GiB. > [!WARNING] > > Network SSD Non-replicated disks have no redundancy. It's not recommended to store any persistent data on these disks. If a disk fails, its data will be lost. * **Network SSD IO M3** (`network_ssd_io_m3`) High-performance and reliable disks backed by SSDs. Best used in performance-critical storage solutions, for example, as storage disks in GlusterFS clusters. In addition to performance levels similar to Network SSD Non-replicated disks, Network SSD IO M3 disks are reliable through replication, with each disk's data mirrored to three physical drives. In the disk type name, "IO" stands for "input/output (optimized)" and "M3" stands for "mirrors 3". #### Local SSD disks Consider local SSD disks if your workload needs high-performance, low-latency storage for data that can be recreated. Local SSD disks are ephemeral, meaning temporary: their data is erased when the VM is stopped or deleted. Local SSD disks are available only on some platforms, presets, and regions. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). Local SSD disks are useful for: * Scratch space for files and intermediate outputs that can be recreated. * Training or inference workloads that require low latency. * Read or write caches for data that can be recreated. ### Disk types comparison Network SSD disk types are differentiated by several characteristics: * **Performance** (bandwidth and IOPS): Local SSD > SSD IO M3 = SSD Non-replicated > SSD * **Reliability**: SSD IO M3 > SSD > SSD Non-replicated = Local SSD * **Price per 1 GiB per month**: SSD Non-replicated \< Local SSD \< SSD \< SSD IO M3 You can choose the size of a network disk, but local SSD disks are attached to the VM host as part of a predefined configuration for the selected platform and preset. For more details, see the following comparison table. The values for local SSD disks are the performance numbers per one local SSD disk. The bandwidth and IOPS values below are upper bounds; actual performance depends on workload. | **Disk type** | **Network SSD** | **Network SSD NRD** | **Network SSD IO M3** | **Local SSD disk**¹ | | - | - | - | - | - | | Capacity | 1–8192 GiB (= 8 TiB) | 93–262,074 GiB (\~ 256 TiB), multiples of 93 GiB | 93–262,074 GiB (\~ 256 TiB), multiples of 93 GiB | 3.5 TiB | | Read/write bandwidth | 450 MiB/s | 2 GiB/s | 2 GiB/s | Read: 6.8 GB/s Write: 2.6 GB/s | | Read IOPS | 20,000 | 75,000 | 75,000 | 510,000 | | Write IOPS | 20,000 | 75,000 | 75,000 | 350,000 | | Reliability features | Erasure coding – tolerates two concurrent hardware failures | None | Replication – data mirrored to three drives | None | | [Price per 1 GiB per month](https://docs.nebius.com/compute/resources/pricing.md)² | \$0.071 | \$0.053 | \$0.118 | \$0.065 | ¹ For local SSD disks, the listed values are achieved under synthetic workload. ² The listed prices are valid as of March 9, 2026. For up-to-date prices, see [Price per 1 GiB per month](https://docs.nebius.com/compute/resources/pricing.md). ### VM-managed and standalone disks When you [create a VM](https://docs.nebius.com/compute/virtual-machines/create.md), you can use either VM-managed or standalone disks: * *VM-managed disks* are the disks that you create along with the VM. Their lifecycle is tied to the VM. When you delete the VM, all of its VM-managed disks are deleted with the VM in a single operation. This makes VM-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. * *Standalone disks* are the disks that you create separately from the VM and attach them later to the VM by using the disk ID. Use standalone disks when you need them to persist independently after the VM is deleted, for example, to reattach them to another VM or to enable deletion protection. Renaming a VM-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 VM-managed disk without data loss, [convert it to a standalone disk](https://docs.nebius.com/compute/storage/manage.md#how-to-make-a-disk-vm-managed-or-standalone) and then rename it. ### Encryption of disks Data encryption helps protect personal and other sensitive data and reduces the risk of unauthorized access. Whether encryption is enabled by default depends on the disk type. For Network SSD disks, encryption is enabled by default and cannot be disabled. For Network SSD NRD and Network SSD IO M3 disks, encryption is optional, and you can [enable it when you create a disk](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-disk). Encryption is available for both boot disks and secondary disks. Local SSD disks are not encrypted and no other data protection method is applied to them. Ensuring the protection of data stored on these devices is your responsibility. We don't recommend using local SSD disks for data that can't be recreated. For more information, see [Encryption in Nebius AI Cloud](https://docs.nebius.com/security/encryption.md). ### Disk performance Disk performance depends on both the disk type and its size — it increases as you add more allocation units. Every allocation unit contributes equally to the overall bandwidth and IOPS until you reach the [upper bounds](https://docs.nebius.com/compute/storage/types.md#disk-types-comparison) for the disk. While you have fewer allocation units than needed to reach the upper bounds, the disk performance equals the sum of each unit's performance. Once the sum reaches the upper bound for bandwidth or IOPS, adding more capacity does not increase performance any further. Disk performance metrics per allocation unit are shown in the following table. The bandwidth and IOPS values below are upper bounds; actual performance depends on workload. | **Disk type** | **Network SSD** | **Network SSD NRD** | **Network SSD IO M3** | **Local SSD disk**¹ | | - | - | - | - | - | | Allocation unit size | 32 GiB | 93 GiB | 93 GiB | 3.5 TiB | | Read bandwidth per unit | 15 MiB/s | 110 MiB/s | 110 MiB/s | 6.8 GB/s | | Write bandwidth per unit | 15 MiB/s | 82 MiB/s | 82 MiB/s | 2.6 GB/s | | Read IOPS per unit | 1,000 | 28,000 | 28,000 | 510,000 | | Write IOPS per unit | 1,000 | 5,600 | 5,600 | 350,000 | ¹ For local SSD disks, the listed values are peak numbers achieved per disk under synthetic workload. Disk encryption also affects the disk performance. Encryption requires additional processing of write operations; therefore, it can reduce performance by up to 15%. Local SSD disks can only be enabled during VM creation, cannot be scaled later, and are available only in fixed configurations. For supported configurations, see [Using local SSD disks on Compute virtual machines](https://docs.nebius.com/compute/storage/local-disks.md#availability). For other disks, you can choose your disk size in multiples of its allocation units to achieve the desired performance. Examples: > [tab] SSD disk > > How to reach the maximum for each disk performance metric: > > * Read/write bandwidth: > * Maximum overall bandwidth is 450 MiB/s. > * Number of allocation units needed to achieve it = Maximum overall read/write bandwidth ÷ Maximum read/write bandwidth per unit = 450 MiB/s ÷ 15 MiB/s = 30 units. > * Minimum disk size = 30 × 32 GiB = 960 GiB. > * Read IOPS: > * Maximum overall read IOPS is 20,000. > * Number of allocation units needed to achieve it = Maximum overall read IOPS ÷ Maximum overall read IOPS per unit = 20,000 ÷ 1,000 = 20 units. > * Minimum disk size = 20 × 32 GiB = 640 GiB. > * Write IOPS: > * Maximum overall write IOPS is 20,000. > * Number of allocation units needed to achieve it = Maximum overall write IOPS ÷ Maximum write IOPS per unit = 20,000 ÷ 1,000 = 20 units. > * Minimum disk size = 20 × 32 GiB = 640 GiB. > > To achieve the maximum disk performance for all metrics, you need a disk of 960 GiB or more. > [tab] SSD NRD or SSD IO M3 disk > > How to reach the maximum for each disk performance metric: > > * Read bandwidth: > * Maximum overall read bandwidth is 2 GiB/s. > * Number of allocation units needed to achieve it = Maximum overall read bandwidth ÷ Maximum read bandwidth per unit = 2048 MiB/s ÷ 110 MiB/s ≈ 18.62, rounding up to 19 units. > * Minimum disk size = 19 × 93 GiB = 1767 GiB. > * Write bandwidth: > * Maximum overall write bandwidth is 2 GiB/s. > * Number of allocation units needed to achieve it = Maximum overall write bandwidth ÷ Maximum write bandwidth per unit = 2048 MiB/s ÷ 82 MiB/s ≈ 24.98, rounding up to 25 units. > * Minimum disk size = 25 × 93 GiB = 2325 GiB. > * Read IOPS: > * Maximum overall read IOPS is 75,000. > * Number of allocation units needed to achieve it = Maximum overall read IOPS ÷ Maximum read IOPS per unit = 75,000 ÷ 28,000 ≈ 2.68, rounding up to 3 units. > * Minimum disk size = 3 × 93 GiB = 279 GiB. > * Write IOPS: > * Maximum overall write IOPS is 75,000. > * Number of allocation units needed to achieve it = Maximum overall write IOPS ÷ Maximum write IOPS per unit = 75,000 ÷ 5,600 ≈ 13.39, rounding up to 14 units. > * Minimum disk size = 14 × 93 GiB = 1302 GiB. > > To achieve the maximum disk performance for all metrics, you need a disk of 2325 GiB or more. ## Shared filesystems Shared filesystems provide file storage for Compute VMs. When VMs work with file storage, they work with a hierarchy of folders and files, as opposed to blocks when disks are involved. One shared filesystem can be attached to multiple VMs at once. All VMs that the filesystem is attached to must belong to the same [project](https://docs.nebius.com/iam/overview.md#projects). Sharing a filesystem across projects is not supported, even if the projects are in the same [region](https://docs.nebius.com/overview/regions.md). To use a shared filesystem on a VM that it is attached to, you must mount it as a virtiofs device. Filesystems support [data encryption](https://docs.nebius.com/security/encryption.md) by default; you cannot disable it. Encryption allows you to store personal and other sensitive data on filesystems securely, and reduce the risk of unauthorized access. You can attach buckets to a shared filesystem, which exposes the data in the filesystem through the Object Storage interface. This lets you read and write data to and from the filesystem by using the AWS CLI and other S3-compatible tools. To learn more, refer to [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). ### Filesystem specifications Nebius provides shared filesystems that are generally based on solid state drives (`network_ssd` in developer tools such as Nebius AI Cloud CLI or provider for Terraform) to back them up. Shared filesystems have the following specifications: * Capacity: 1–104,857,600 GiB (= 102,400 TiB = 100 PiB) * Tested read bandwidth per client: up to 15 GiB/s¹ * Tested write bandwidth per client: up to 10 GiB/s¹ * Tested aggregate read bandwidth: up to 1.9 TiB/s² * Tested aggregate write bandwidth: up to 1.5 TiB/s² * Maximum file size: 512 GiB × filesystem's [block size](https://docs.nebius.com/compute/storage/manage.md#type-encryption-and-size) in KiB (for example, for the default block size it will be 512 GiB × 4 = 2TiB) * Maximum number of [inodes](https://www.kernel.org/doc/html/v6.3/filesystems/vfs.html#the-inode-object): * For filesystems up to 256 GiB: 4,194,304 (4 × 220) * For filesystems larger than 256 GiB: filesystem's size ÷ 64 KiB For example, if the filesystem's size is 512 GiB, its maximum number of inodes is (512 × 230) ÷ (64 × 210) = 8 × 220 = 8,388,608. * Reliability features: Erasure coding – tolerates two concurrent hardware failures * [Price per 1 GiB per month](https://docs.nebius.com/compute/resources/pricing.md)³: \$0.08 ¹ Actual bandwidth depends on the GPU platform and the region. ² Measured on a filesystem with 20 PiB of usable capacity. Aggregate bandwidth grows with filesystem capacity, so larger filesystems can exceed these values. ³ The price is shown as of July 2, 2025. For up-to-date prices, see [Price per 1 GiB per month](https://docs.nebius.com/compute/resources/pricing.md). ### Filesystem performance Filesystem performance depends on its size — performance increases with each 4 TiB of the filesystem size. Every 4 TiB contributes equally to the [aggregate bandwidth](https://docs.nebius.com/compute/storage/types.md#filesystem-specifications) of the filesystem. Each 4 TiB of SSD filesystem improves the performance metrics by the following values: * Read bandwidth: by up to 3.70 GiB/s. * Write bandwidth: by up to 1.89 GiB/s. ### POSIX compliance and consistency guarantees for filesystems Shared filesystems provide POSIX-compliant filesystem semantics for workloads that don't involve conflicting access across multiple VMs. In particular, POSIX semantics are guaranteed when VMs operate on independent sets of files and directories, without modifying files or directories accessed by other VMs. When multiple VMs access the same files or directories, the following consistency guarantees apply: * File contents — close-to-open consistency with additional synchronization guarantees. Changes made to a file by one VM are guaranteed to become visible to another VM when the reading VM opens the file after any of the following events: * The writing VM closes the file. * The writing VM successfully calls `fsync()` on the file. * A write using `O_DIRECT` completes successfully on the writing VM. Concurrent access to an already-open file from multiple VMs doesn't provide full POSIX consistency guarantees. * Directory entries and inode metadata — eventual consistency. Directory entries and inode metadata are cached on each VM for up to 15 seconds. Consequently, changes made by one VM (such as creating, deleting, or renaming files, or modifying file attributes) may not be immediately visible to other VMs. For example, after one VM deletes a file, another VM may continue to see a stale directory entry for up to 15 seconds. These limitations apply to cross-VM access. Operations within a single VM retain POSIX semantics. ## Storage types comparison | Characteristic | [Local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) | [Network disks](https://docs.nebius.com/compute/storage/types.md#disks) | [Shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems) | | - | - | - | - | | Durability | Ephemeral | Durable | Durable | | Attachment model | Tied to the VM run and physical host | Independent volume attached to one running VM at a time | Independent volume that can be shared by multiple VMs | | Capacity model | Preconfigured, all or none | User-defined | User-defined | ## Use cases and suggestions Here is an overview of various stages of ML/AI workloads and storage options that Compute and other Nebius AI Cloud services provide for these stages, as well as general suggestions for using Compute storage. ### Infrastructure * **VM boot disks: Network SSD disks** For OS and system data on your VMs, the main storage requirement is reliability, so the suggested disk type is Network SSD. * **VM storage disks: Network SSD IO M3 disks** If you are building storage solutions on VMs, for example, GlusterFS clusters, use Network SSD IO M3 disks for speed and reliability. * **Managed Kubernetes node storage: Network SSD Non-replicated disks** For Kubernetes worker nodes where data reliability isn't a top priority (as the data is often transient), Network SSD Non-replicated disks provide high performance and low latency. * **Database hosts: Network SSD IO M3 disks** Database workloads often demand consistent and high input/output operations per second (IOPS), and Network SSD IO M3 disks offer the best combination of reliability and speed. ### Data preparation * **Storing and preprocessing datasets: Object Storage buckets** Object Storage is ideal for handling large, unstructured datasets and provides a scalable solution for preprocessing tasks like data normalization or augmentation. ### Training * **Streaming datasets to workers: SSD shared filesystems or Object Storage buckets** In most cases, SSD shared filesystems ensure fast access to datasets during training, without bottlenecks. For exceptionally large datasets (1 PiB+) or distributed training across external workers, Object Storage buckets provide a scalable solution. * **Sharing code between workers: SSD shared filesystems** By using SSD shared filesystems, multiple workers can efficiently access and synchronize code during distributed training, ensuring consistency and minimizing latency. * **Checkpoints: SSD shared filesystems, then Object Storage buckets** During training, SSD shared filesystems allow for quickly saving and loading checkpoints, thus ensuring minimal disruption. Once training is completed, asynchronous transfer to Object Storage reduces costs while maintaining accessibility for future use. * **Scratch space: local SSD disks** On [supported platforms, presets and regions](https://docs.nebius.com/compute/storage/local-disks.md#availability), [local SSD disks](https://docs.nebius.com/compute/storage/local-disks.md) provide host-local NVMe for data that can be recreated and benefits from high performance and low latency. Treat them as ephemeral and keep important data on durable storage. ### Inference * **Autoscaling, sharing weights between GPUs: SSD shared filesystems** When inference workloads require scaling across multiple VMs with GPUs, SSD shared filesystems allow for fast sharing of model weights, thus ensuring consistent performance across nodes during autoscaling. * **Sharing results: Object Storage buckets** Once inference tasks are completed, Object Storage is ideal for sharing outputs such as logs, predictions or reports with other users or systems, due to its scalable and cost-efficient nature. ### General suggestions * For maximum IOPS, reads and writes to a volume should be close to its [block size](https://docs.nebius.com/compute/storage/manage.md#type-encryption-and-size). * For maximum bandwidth, reads and writes to a volume should be in 4 MiB chunks. ## See also * [How to create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm) * [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md) * [Attaching and mounting Compute volumes to VMs](https://docs.nebius.com/compute/storage/use.md) * [How to detach additional volumes from virtual machines](https://docs.nebius.com/compute/storage/detach-volume.md) * [Local SSD disks for Compute virtual machines](https://docs.nebius.com/compute/storage/local-disks.md) # Managing Compute volumes Source: https://docs.nebius.com/compute/storage/manage.md In this article, you will learn how to manage [Compute volumes](https://docs.nebius.com/compute/storage/types.md): Network SSD disks and shared filesystems. Boot disks are added to virtual machines (VMs) immediately. To use secondary (additional) disks and shared filesystems on VMs after you create the volumes, you need to [attach and mount them to the VMs](https://docs.nebius.com/compute/storage/use.md). You can [detach these volumes](https://docs.nebius.com/compute/storage/detach-volume.md) later, if necessary. A VM and its volumes must be located in the same project. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to create a disk To create a disk: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Disks**. > > 2. Click **Create disk**. > > 3. On the creation page, specify a disk name. > > 4. In **Disk source type**, select one of the supported sources for the disk: > > * **Blank disk**: Create a regular, blank disk. Suitable for any boot or additional disk. > * **Public image**: Create a boot disk from one of [public images](https://docs.nebius.com/compute/storage/boot-disk-images.md) that Nebius AI Cloud provides. An image represents an operating system for the disk. > * **Custom image**: Create a boot disk based on your [custom image](https://docs.nebius.com/compute/storage/custom-disk-images.md) that includes custom software. > * **Custom image family**: Create a boot disk based on your custom image family. When you create custom images, you can add them to an arbitrary custom family. If an image family contains several images, the latest one is used. > * **Snapshot**: Create a boot or additional disk based on a [disk snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md). > > 5. In **Storage configuration**, select the disk type. > > 6. (Optional) Enable [data encryption](https://docs.nebius.com/security/encryption.md) if you're creating a Network SSD Non-replicated or Network SSD IO M3 disk. > > Encryption is enabled by default for Network SSD disks. > > 7. Set the disk size and block size. > > 8. (Optional) Enable **Deletion protection** to prevent this disk from being accidentally deleted. > > 9. Click **Create disk**. > [tab] CLI > > ```bash > nebius compute disk create \ > --name \ > --source-image-family-image-family \ > --source-image-family-parent-id \ > --source-image-id \ > --source-snapshot-id \ > --type network_ \ > --disk-encryption-type disk_encryption_managed \ > --size-gibibytes \ > --block-size-bytes \ > --forbid-deletion > ``` > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > [tab] Terraform > > 1. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "" > parent_id = "" > type = "NETWORK_" > size_gibibytes = > block_size_bytes = > > # Only for boot disks. Use one of the supported disk sources. > source_image_family = { > image_family = "" > parent_id = "" # Optional: for custom image families only > } > source_image_id = "" > > source_snapshot_id = "" > > # Optional: only for NETWORK_SSD_NON_REPLICATED and NETWORK_SSD_IO_M3 > disk_encryption = { > type = "DISK_ENCRYPTION_MANAGED" > } > > # Optional: protect disk from deletion > forbid_deletion = true > } > ``` > > For `parent_id`, use the [project ID](https://docs.nebius.com/iam/manage-projects.md#terraform-3). For more information about other parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For the full reference on the disk resource, see [nebius\_compute\_v1\_disk](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > // One of compute.DiskSpec_NETWORK_SSD, > // compute.DiskSpec_NETWORK_SSD_NON_REPLICATED, > // or compute.DiskSpec_NETWORK_SSD_IO_M3. > diskType := compute.DiskSpec_NETWORK_SSD_NON_REPLICATED > diskEncryptionType := compute.DiskEncryption_DISK_ENCRYPTION_MANAGED > > operation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: , > }, > BlockSizeBytes: , > Type: diskType, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "", > }, > }, > DiskEncryption: &compute.DiskEncryption{ > Type: diskEncryptionType, > }, > ForbidDeletion: true, > }, > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > [tab] Python SDK > > ```python > # One of DiskSpec.DiskType.NETWORK_SSD, > # DiskSpec.DiskType.NETWORK_SSD_NON_REPLICATED, > # or DiskSpec.DiskType.NETWORK_SSD_IO_M3. > disk_type = DiskSpec.DiskType.NETWORK_SSD_NON_REPLICATED > encryption_type = ( > DiskEncryption.DiskEncryptionType.DISK_ENCRYPTION_MANAGED > ) > > disk_service = DiskServiceClient(sdk) > create_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="", > ), > spec=DiskSpec( > block_size_bytes=, > type=disk_type, > source_image_family=SourceImageFamily( > image_family="", > ), > disk_encryption=DiskEncryption( > type=encryption_type, > ), > forbid_deletion=True, > size_gibibytes=, > ), > ), > ) > await create_disk_operation.wait() > ``` > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > [tab] JavaScript SDK > > ```ts > // One of DiskSpec_DiskType.NETWORK_SSD, > // DiskSpec_DiskType.NETWORK_SSD_NON_REPLICATED, > // or DiskSpec_DiskType.NETWORK_SSD_IO_M3. > const diskType = DiskSpec_DiskType.NETWORK_SSD_NON_REPLICATED; > > const createDiskService = new DiskService(sdk); > const createDiskOperation = await createDiskService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSpec.create({ > blockSizeBytes: , > type: diskType, > source: { > $case: "sourceImageFamily", > sourceImageFamily: SourceImageFamily.create({ > imageFamily: "", > }), > }, > diskEncryption: DiskEncryption.create({ > type: DiskEncryption_DiskEncryptionType.DISK_ENCRYPTION_MANAGED, > }), > forbidDeletion: true, > size: { > $case: "sizeGibibytes", > sizeGibibytes: , > }, > }), > }), > ).result; > await createDiskOperation.wait(); > ``` > > For more information, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For more information about how to start using secondary disks, see [Attaching and mounting Compute volumes to VMs](https://docs.nebius.com/compute/storage/use.md). ## How to create a shared filesystem To create a shared filesystem: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Shared filesystems**. > 2. Click **Create filesystem**. > 3. On the creation page, specify a filesystem name. > 4. Set the filesystem size and block size. > 5. (Optional) Enable **Deletion protection** to prevent this filesystem from being accidentally deleted. > 6. Click **Create filesystem**. > [tab] CLI > > ```bash > nebius compute filesystem create \ > --name \ > --type network_ssd \ > --size-gibibytes \ > --block-size-bytes \ > --forbid-deletion > ``` > > For more details about volume parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > [tab] Terraform > > 1. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_filesystem" "" { > name = "" > parent_id = "" > type = "NETWORK_SSD" > size_gibibytes = > block_size_bytes = > > # Optional: protect the filesystem from deletion > forbid_deletion = true > } > ``` > > For `parent_id`, use the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). For more information about other parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For the full reference on the filesystem resource, see [nebius\_compute\_v1\_filesystem](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_filesystem.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Check that the configuration is correct: > ```bash > terraform validate > ``` > 2. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > operation, err = sdk.Services().Compute().V1(). > Filesystem().Create( > ctx, > &compute.CreateFilesystemRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.FilesystemSpec{ > Size: &compute.FilesystemSpec_SizeGibibytes{ > SizeGibibytes: , > }, > BlockSizeBytes: , > Type: compute.FilesystemSpec_NETWORK_SSD, > ForbidDeletion: true, > }, > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > > For more details about volume parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > [tab] Python SDK > > ```python > filesystem_service = FilesystemServiceClient(sdk) > create_filesystem_operation = await filesystem_service.create( > CreateFilesystemRequest( > metadata=ResourceMetadata( > name="", > ), > spec=FilesystemSpec( > block_size_bytes=, > type=FilesystemSpec.FilesystemType.NETWORK_SSD, > forbid_deletion=True, > size_gibibytes=, > ), > ), > ) > await create_filesystem_operation.wait() > ``` > > For more details about volume parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > [tab] JavaScript SDK > > ```ts > const createFilesystemService = new FilesystemService(sdk); > const createFilesystemOperation = await createFilesystemService.create( > CreateFilesystemRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: FilesystemSpec.create({ > blockSizeBytes: , > type: FilesystemSpec_FilesystemType.NETWORK_SSD, > forbidDeletion: true, > size: { > $case: "sizeGibibytes", > sizeGibibytes: , > }, > }), > }), > ).result; > await createFilesystemOperation.wait(); > ``` > > For more details about volume parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For more information about how to start using the created shared filesystem, see [Attaching and mounting Compute volumes to VMs](https://docs.nebius.com/compute/storage/use.md). To access and transfer data in a shared filesystem through the Object Storage [S3-compatible API](https://docs.nebius.com/object-storage/interfaces/aws-cli.md), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). You can then use the AWS CLI and other S3-compatible tools to work with data in the filesystem. ## Volume parameters Disks and shared filesystems share almost all of their parameters, except for boot disk image which can only be set for disks. CLI parameter names are shown in parentheses. Terraform uses the corresponding snake\_case attributes, and SDKs use the corresponding parameter names for each language, such as camelCase in JavaScript, as shown in the examples. ### Metadata **Name** (`name`): A Nebius AI Cloud resource name. It must be unique inside your tenant. Required at creation, cannot be changed after it. ### Type, encryption, and size * **Type** (`type`): Volume type. See available types of [disks](https://docs.nebius.com/compute/storage/types.md#network-and-local-ssd-disks) and [shared filesystems](https://docs.nebius.com/compute/storage/types.md#filesystem-specifications). Required at creation, and cannot be changed later. * **Enable data encryption** (`disk-encryption-type`): Whether a volume should support [data encryption](https://docs.nebius.com/security/encryption.md). Encryption allows you to store personal and other sensitive data securely on volumes, and reduce the risk of unauthorized access. Use this parameter only for disks of the Network SSD Non-replicated and Network SSD IO M3 types. Filesystems and Network SSD disks support encryption by default, and you cannot disable it. For more information, see [Encryption of disks](https://docs.nebius.com/compute/storage/types.md#encryption-of-disks). In the CLI, use `--disk-encryption-type disk_encryption_managed` to enable encryption. * **Block size** (`block-size-bytes`): Data block size for the volume. The data stored on the volume is divided into blocks of this size on the underlying physical drives. The block size cannot be changed after the volume is created. The block size must be a power of two between 4096 bytes (4 KiB) and 131,072 bytes (128 KiB). The default value is 4096 bytes (4 KiB). For maximum IOPS, reads and writes to a volume should be close to its block size. * **Size** (`size-gibibytes`, `size-mebibytes`, `size-kibibytes`, or `size-bytes`): The volume size. See requirements for sizes of [disks](https://docs.nebius.com/compute/storage/types.md#disk-types-comparison) and [shared filesystems](https://docs.nebius.com/compute/storage/types.md#filesystem-specifications) in their comparison tables. Required at creation. After creation, size can only be increased for a [disk](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-disk) or a [shared filesystem](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-shared-filesystem). When using the CLI, you can set the volume size in GiB, MiB, KiB, or B by using the respective parameter. For disks, the size must be a multiple of both 4 MiB and the block size. A disk can contain up to 4,294,967,296 blocks, so the selected block size can further restrict the capacity listed for the disk type. With the default block size of 4 KiB, a disk cannot exceed 16 TiB. Select a larger block size for disks above 16 TiB. Boot disks cannot exceed 30,720 GiB (30 TiB). ### Disk sources Use one of the supported disk sources: * **Public image** (`source-image-family-image-family`): Create a boot disk from one of the [public images](https://docs.nebius.com/compute/storage/boot-disk-images.md) that Nebius AI Cloud provides. An image represents an operating system for the disk. * **Custom image** (`source-image-id`): Create a boot disk based on your [custom image](https://docs.nebius.com/compute/storage/custom-disk-images.md) that includes custom software. * **Custom image family** (both `source-image-family-image-family` and `source-image-family-parent-id`): Create a boot disk based on your custom image family. When you create custom images, you can add them to an arbitrary custom family. If an image family contains several images, the latest one is used. * **Snapshot** (`source-snapshot-id`): Create a boot or additional disk based on a [disk snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md). To create a blank additional disk, don't specify any disk source. ### Deletion protection * **Deletion protection** (`forbid-deletion`): Prevents the volume from being deleted. Use this parameter to protect disks and shared filesystems from accidental deletion, especially in automated environments such as CI/CD pipelines or Terraform configurations. Deletion protection can be enabled at creation time or changed at any time after creation. When enabled, any attempt to delete the volume fails with an error. To delete a protected volume, disable deletion protection first. ## How to resize a disk You can increase the size of an existing disk. Reducing the disk size is not possible. > [!NOTE] > > Compute supports *hot resize*: the resize operation itself does not require stopping the VM. However, you need to restart the VM afterward for the operating system to recognize the new disk size. To resize a disk: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Disks**. > > Alternatively, go to the VM where the disk is attached and find it in the **Disks** tab. > > 2. Click the disk you want to resize and go to the **Settings** tab. > > 3. In the **Parameters** section, enter the new **Size** value or use the slider to set the new size. > > 4. Click **Save changes**. > [tab] CLI > > 1. If you haven't saved the disk's ID when creating it, get its ID: > > ```bash > export DISK_ID=$(nebius compute disk get-by-name \ > --parent-id \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 2. Run [nebius compute disk update](https://docs.nebius.com/cli/reference/compute/disk/update.md) and set the new size by using one of the `--size-gibibytes`, `--size-mebibytes`, `--size-kibibytes`, or `--size-bytes` parameters: > > ```bash > nebius compute disk update \ > --id $DISK_ID \ > --size-gibibytes > ``` > [tab] Terraform > > 1. In your Terraform configuration, update the `size_gibibytes` value (or `size_mebibytes`, `size_kibibytes`, `size_bytes`) in the disk resource. For example: > > ```hcl > resource "nebius_compute_v1_disk" "" { > # ... > size_gibibytes = > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. If you haven't saved the disk's ID when creating it, get its ID: > > ```go > disk, err := sdk.Services().Compute().V1(). > Disk().GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > diskID := disk.GetMetadata().GetId() > ``` > > 2. Update the disk size: > > ```go > disk, err = sdk.Services().Compute().V1(). > Disk().Get( > ctx, > &compute.GetDiskRequest{ > Id: diskID, > }, > ) > if err != nil { > return err > } > if disk.GetSpec() == nil { > return errors.New("disk spec is missing") > } > disk.Spec.Size = &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: , > } > operation, err = sdk.Services().Compute().V1(). > Disk().Update( > ctx, > &compute.UpdateDiskRequest{ > Metadata: disk.Metadata, > Spec: disk.Spec, > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. If you haven't saved the disk's ID when creating it, get its ID: > > ```python > disk_service = DiskServiceClient(sdk) > disk = await disk_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > disk_id = disk.metadata.id > ``` > > 2. Update the disk size: > > ```python > disk_service = DiskServiceClient(sdk) > disk = await disk_service.get( > GetDiskRequest(id=disk_id), > ) > if disk.spec is None: > raise ValueError("disk spec is missing") > disk.spec.size_gibibytes = > update_disk_operation = await disk_service.update( > UpdateDiskRequest( > metadata=disk.metadata, > spec=disk.spec, > ), > ) > await update_disk_operation.wait() > ``` > [tab] JavaScript SDK > > 1. If you haven't saved the disk's ID when creating it, get its ID: > > ```ts > const getDiskByNameService = new DiskService(sdk); > const diskByName = await getDiskByNameService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ); > const diskId = diskByName.metadata?.id; > if (!diskId) { > throw new Error("disk ID is missing"); > } > ``` > > 2. Update the disk size: > > ```ts > const updateDiskService = new DiskService(sdk); > const diskForResize = await updateDiskService.get( > GetDiskRequest.create({ > id: diskId, > }), > ); > if (!diskForResize.spec) { > throw new Error("disk spec is missing"); > } > diskForResize.spec.size = { > $case: "sizeGibibytes", > sizeGibibytes: , > }; > const updateDiskResizeOperation = await updateDiskService.update( > UpdateDiskRequest.create({ > metadata: diskForResize.metadata, > spec: diskForResize.spec, > }), > ).result; > await updateDiskResizeOperation.wait(); > ``` If you resized a secondary disk that is attached to a running VM, also [grow its partition](https://docs.nebius.com/compute/storage/manage.md#how-to-grow-a-partition-on-a-secondary-disk). ### How to grow a partition on a secondary disk To make the added space on a secondary disk available to the operating system, grow the disk's partition and filesystem: 1. [Restart](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually) the VM that the disk is attached to. 2. [Connect](https://docs.nebius.com/compute/virtual-machines/connect.md) to the VM. 3. Install the `cloud-guest-utils` package that manages the disk partitions: ```bash sudo apt-get update && sudo apt-get install -y cloud-guest-utils ``` 4. List disks and partitions: ```bash lsblk --paths ``` Output example: ```bash NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS /dev/vda 253:0 0 10G 0 disk ├─/dev/vda1 253:1 0 9G 0 part / ├─/dev/vda14 253:14 0 4M 0 part ├─/dev/vda15 253:15 0 106M 0 part /boot/efi └─/dev/vda16 259:0 0 913M 0 part /boot /dev/vdb 253:16 0 1M 0 disk /dev/vdc 253:32 0 20G 0 disk └─/dev/vdc1 253:33 0 10G 0 part /mnt/disk-0 ``` Find the device name of the resized disk and get the name of its last partition. The secondary disk is most likely the last one in the list. Also, check the `SIZE` column: it shows that the disk size is increased, but the partition size stays the same. In this example, the required device name is `/dev/vdc`, and the partition is `/dev/vdc1`. 5. Grow the partition to fill the disk: ```bash sudo growpart /dev/vdc 1 ``` If you work with a disk that has a device name other than `/dev/vdc`, change the device name and the partition index `1` in the current command and commands below. You can get the index of the partition from its name. Only the last partition may be grown. > [!NOTE] > > In the commands, you can use the device ID of the disk (`/dev/disk/by-id/virtio-disk-0`) instead of the device name (`/dev/vdc`). Run the `ls /dev/disk/by-id` command to get device IDs for all disks. 6. Refresh the kernel partition table for the disk and wait for the device information to be updated: ```bash sudo partprobe /dev/vdc && sudo udevadm settle ``` 7. Show information about partitions and check that the size of the partition has increased: ```bash lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT /dev/vdc ``` Output example: ```bash NAME SIZE TYPE FSTYPE MOUNTPOINT vdc 25G disk └─vdc1 25G part ext4 /mnt/disk-0 ``` 8. Grow the `ext4` filesystem on the increased partition: ```bash sudo resize2fs /dev/vdc1 ``` 9. Check that the filesystem size has increased: ```bash df -hT ``` Output example: ```bash Filesystem Type Size Used Avail Use% Mounted on tmpfs tmpfs 795M 1.1M 794M 1% /run /dev/vda1 ext4 38G 3.3G 35G 9% / tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock cloud-metadata virtiofs 252G 16K 252G 1% /mnt/cloud-metadata /dev/vdc1 ext4 25G 24K 24G 1% /mnt/disk-0 /dev/vda16 ext4 881M 174M 645M 22% /boot /dev/vda15 vfat 105M 6.2M 99M 6% /boot/efi tmpfs tmpfs 795M 12K 795M 1% /run/user/1001 ``` ## How to resize a shared filesystem You can increase the size of a shared filesystem. Reducing the filesystem size is not possible. To resize a shared filesystem: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Shared filesystems**. > > Alternatively, go to the VM where the filesystem is attached and find it in the **Shared filesystems** tab. > > 2. Click the filesystem you want to resize and go to the **Settings** tab. > > 3. In the **Parameters** section, enter the new **Size** value or use the slider to set the new size. > > 4. Click **Save changes**. > [tab] CLI > > 1. If you haven't saved the filesystem's ID when creating it, get its ID by using [nebius compute filesystem get-by-name](https://docs.nebius.com/cli/reference/compute/filesystem/get-by-name.md). > > 2. Run [nebius compute filesystem update](https://docs.nebius.com/cli/reference/compute/filesystem/update.md) and set the new size by using one of the `--size-gibibytes`, `--size-mebibytes`, `--size-kibibytes`, or `--size-bytes` parameters. > [tab] Terraform > > 1. In your Terraform configuration, update the `size_gibibytes` value (or `size_mebibytes`, `size_kibibytes`, `size_bytes`) in the filesystem resource. For example: > > ```hcl > resource "nebius_compute_v1_filesystem" "" { > # ... > size_gibibytes = > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` ## How to enable or disable deletion protection You can only change deletion protection of a [standalone disk](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). If you need to update a VM-managed disk, [convert it first to standalone](https://docs.nebius.com/compute/storage/manage.md#how-to-make-a-disk-vm-managed-or-standalone). To enable or disable deletion protection: > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Disks** or **Storage** → **Shared filesystems**. > 2. Click the volume you want to update and go to the **Settings** tab. > 3. In the **Parameters** section, enable or disable **Deletion protection**. > 4. Click **Save changes**. > [tab] CLI > > 1. If you haven't saved the disk or filesystem's ID when creating it, get its ID: > > ```bash > export DISK_ID=$(nebius compute disk get-by-name \ > --parent-id \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > For a filesystem, use [nebius compute filesystem get-by-name](https://docs.nebius.com/cli/reference/compute/filesystem/get-by-name.md) with the same parameters. > > 2. Run [nebius compute disk update](https://docs.nebius.com/cli/reference/compute/disk/update.md) for a disk, or [nebius compute filesystem update](https://docs.nebius.com/cli/reference/compute/filesystem/update.md) for a filesystem: > > ```bash > nebius compute disk update \ > --id $DISK_ID \ > --forbid-deletion= > ``` > [tab] Terraform > > 1. In your Terraform configuration, set `forbid_deletion` to `true` or `false` in the disk or filesystem resource. For example, for a disk: > > ```hcl > resource "nebius_compute_v1_disk" "" { > # ... > forbid_deletion = > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. If you haven't saved the disk or filesystem's ID when creating it, get its ID: > > ```go > disk, err := sdk.Services().Compute().V1(). > Disk().GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > diskID := disk.GetMetadata().GetId() > ``` > > For a filesystem, get its ID by name with the same parameters. > > 2. Update the disk or filesystem deletion protection. Here is an example for a disk: > > ```go > disk, err = sdk.Services().Compute().V1(). > Disk().Get( > ctx, > &compute.GetDiskRequest{ > Id: diskID, > }, > ) > if err != nil { > return err > } > if disk.GetSpec() == nil { > return errors.New("disk spec is missing") > } > disk.Spec.ForbidDeletion = > operation, err = sdk.Services().Compute().V1(). > Disk().Update( > ctx, > &compute.UpdateDiskRequest{ > Metadata: disk.Metadata, > Spec: disk.Spec, > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. If you haven't saved the disk or filesystem's ID when creating it, get its ID: > > ```python > disk_service = DiskServiceClient(sdk) > disk = await disk_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > disk_id = disk.metadata.id > ``` > > For a filesystem, get its ID by name with the same parameters. > > 2. Update the disk or filesystem deletion protection. Here is an example for a disk: > > ```python > disk_service = DiskServiceClient(sdk) > disk = await disk_service.get( > GetDiskRequest(id=disk_id), > ) > if disk.spec is None: > raise ValueError("disk spec is missing") > disk.spec.forbid_deletion = > update_disk_operation = await disk_service.update( > UpdateDiskRequest( > metadata=disk.metadata, > spec=disk.spec, > ), > ) > await update_disk_operation.wait() > ``` > [tab] JavaScript SDK > > 1. If you haven't saved the disk or filesystem's ID when creating it, get its ID: > > ```ts > const getDiskByNameService = new DiskService(sdk); > const diskByName = await getDiskByNameService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ); > const diskId = diskByName.metadata?.id; > if (!diskId) { > throw new Error("disk ID is missing"); > } > ``` > > For a filesystem, get its ID by name with the same parameters. > > 2. Update the disk or filesystem deletion protection. Here is an example for a disk: > > ```ts > const updateDiskDeletionService = new DiskService(sdk); > const diskForDeletion = await updateDiskDeletionService.get( > GetDiskRequest.create({ > id: diskId, > }), > ); > if (!diskForDeletion.spec) { > throw new Error("disk spec is missing"); > } > diskForDeletion.spec.forbidDeletion = ; > const updateDiskDeletionOperation = > await updateDiskDeletionService.update( > UpdateDiskRequest.create({ > metadata: diskForDeletion.metadata, > spec: diskForDeletion.spec, > }), > ).result; > await updateDiskDeletionOperation.wait(); > ``` > [!NOTE] > > If you try to delete a volume with deletion protection enabled, the operation will fail, and you'll see the following message: `Error: rpc error: code = FailedPrecondition desc = disk cannot be deleted because forbid_deletion is set`. Disable deletion protection first, then delete the volume. ## How to make a disk VM-managed or standalone Each disk is either [VM-managed or standalone](https://docs.nebius.com/compute/storage/types.md#vm-managed-and-standalone-disks). You can convert a disk from one state to another. To do so: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > 2. Open the page of the required VM and then go to the **Disks** tab. > 3. Next to the required disk, click  → **Convert to VM-managed** or  → **Convert to standalone**. ## How to delete a volume > [!WARNING] > > Deleting a volume permanently removes all data stored on it. Before deleting, make sure the volume is [detached](https://docs.nebius.com/compute/storage/detach-volume.md) from any VM. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Disks** or **Storage** → **Shared filesystems**. > 2. Open the page of the volume that you want to delete. > 3. Go to the **Settings** tab. > 4. Click **Delete disk** or **Delete filesystem**. > 5. In the window that opens, confirm the deletion. > [tab] CLI > > 1. Get the ID of the volume you want to delete: > > ```bash > nebius compute list > ``` > > 2. Delete the disk: > > ```bash > nebius compute disk delete > ``` > > 3. Delete the filesystem: > > ```bash > nebius compute filesystem delete > ``` > [tab] Terraform > > 1. In your Terraform configuration, remove the `nebius_compute_v1_disk` or `nebius_compute_v1_filesystem` resource block. > > If the resource has `forbid_deletion = true`, set it to `false` before removing the resource, then apply the configuration. Once done, remove the resource. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. If you haven't saved the volume ID, get it as described in [How to resize a disk](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-disk) or [How to resize a shared filesystem](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-shared-filesystem). > > 2. Delete the disk: > > ```go > operation, err = sdk.Services().Compute().V1(). > Disk().Delete( > ctx, > &compute.DeleteDiskRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > > 3. Delete the filesystem: > > ```go > operation, err = sdk.Services().Compute().V1(). > Filesystem().Delete( > ctx, > &compute.DeleteFilesystemRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. If you haven't saved the volume ID, get it as described in [How to resize a disk](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-disk) or [How to resize a shared filesystem](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-shared-filesystem). > > 2. Delete the disk: > > ```python > disk_service = DiskServiceClient(sdk) > delete_disk_operation = await disk_service.delete( > DeleteDiskRequest( > id="", > ), > ) > await delete_disk_operation.wait() > ``` > > 3. Delete the filesystem: > > ```python > filesystem_service = FilesystemServiceClient(sdk) > delete_filesystem_operation = await filesystem_service.delete( > DeleteFilesystemRequest( > id="", > ), > ) > await delete_filesystem_operation.wait() > ``` > [tab] JavaScript SDK > > 1. If you haven't saved the volume ID, get it as described in [How to resize a disk](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-disk) or [How to resize a shared filesystem](https://docs.nebius.com/compute/storage/manage.md#how-to-resize-a-shared-filesystem). > > 2. Delete the disk: > > ```ts > const deleteDiskService = new DiskService(sdk); > const deleteDiskOperation = await deleteDiskService.delete( > DeleteDiskRequest.create({ > id: "", > }), > ).result; > await deleteDiskOperation.wait(); > ``` > > 3. Delete the filesystem: > > ```ts > const deleteFilesystemService = new FilesystemService(sdk); > const deleteFilesystemOperation = await deleteFilesystemService.delete( > DeleteFilesystemRequest.create({ > id: "", > }), > ).result; > await deleteFilesystemOperation.wait(); > ``` ## See also * [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md) * [Attaching and mounting Compute volumes to VMs](https://docs.nebius.com/compute/storage/use.md) # Boot disk images for Compute virtual machines Source: https://docs.nebius.com/compute/storage/boot-disk-images.md When you [create a boot disk](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-disk) for a virtual machine, you need to choose an image for the disk. Compute supports two types of boot disk images: * *Public images* are provided and supported by the platform by default. * *Custom images* are images that you [create](https://docs.nebius.com/compute/storage/custom-disk-images.md) yourself with customized software and architecture. Nebius AI Cloud provides public boot disk images for GPU and non-GPU VMs. ## Compatibility types The image that you choose for a VM must be compatible with the VM's [platform](https://docs.nebius.com/compute/virtual-machines/types.md). There are different types of compatibility: * *Recommended images* ensure stable VM performance. * *Alternative images* are compatible with the platform but do not guarantee stable performance. ## Image family Each image has a family. When you use the [Nebius AI Cloud CLI](https://docs.nebius.com/cli/reference/compute/disk/create.md) or the [provider for Terraform](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md) to create a boot disk, you need to specify its family. For example, the image Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) has the family `ubuntu24.04-cuda13.0`. Image families for GPU VMs are either stable or latest: * *Stable families*, such as `ubuntu24.04-cuda13.0`, keep fixed versions of the GPU driver and CUDA Toolkit. Boot disks that you create from a stable family at different times get the same GPU driver and CUDA Toolkit versions. Use them for most workloads. * *Latest families*, such as `ubuntu24.04-cuda13-latest`, are regularly updated to the newest GPU driver and CUDA versions. Each new image in the family is tested only when it's released and boot disks you create at different times can get different GPU driver and CUDA Toolkit versions. Use them if you need the latest features, performance improvements or security patches from NVIDIA, for example, on new platforms. ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to get a list of available public images To get a list of public boot disk images available in a [region](https://docs.nebius.com/overview/regions.md): > [tab] CLI > > Run the following command: > > ```bash > nebius compute image list-public --region > ``` > [tab] Go SDK > > ```go > images, err := sdk.Services().Compute().V1(). > Image().ListPublic( > ctx, > &compute.ListPublicRequest{ > Region: "", > }, > ) > if err != nil { > return err > } > fmt.Println(images) > ``` > [tab] Python SDK > > ```python > image_service = ImageServiceClient(sdk) > images = await image_service.list_public( > ListPublicRequest( > region="", > ), > ) > print(images) > ``` > [tab] JavaScript SDK > > ```ts > const imageService = new ImageService(sdk); > const images = await imageService.listPublic( > ListPublicRequest.create({ > region: "", > }), > ); > console.log(images); > ``` In the output, you'll see public images available in the specified region, including image families and other metadata. To determine which VM platforms are compatible with a public image, check the following parameters in the output: * `recommended_platforms`: Platforms for which the image is recommended. * `unsupported_platforms`: Platforms for which the image is not supported (with reasons, if available). Availability of images and their compatibility with platforms differ by region. ## Images for GPU VMs For VMs with GPUs, create boot disks from the following images: * Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 12), `ubuntu24.04-cuda12` > [!WARNING] > > The `ubuntu22.04-cuda12` image family is deprecated. Existing disks created from images in this family remain available, but creating new disks from this image family isn't supported. Migrate to newer images. * Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13), `ubuntu24.04-cuda13.0` * Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest), `ubuntu24.04-cuda13-latest` > If a VM doesn't work as expected on an image from this family, create its boot disk from the stable `ubuntu24.04-cuda13.0` family instead. The following boot disk images are compatible with GPU VMs: | VM platform | [Recommended images](https://docs.nebius.com/compute/storage/boot-disk-images.md#compatibility-types) | [Alternative images](https://docs.nebius.com/compute/storage/boot-disk-images.md#compatibility-types) | | - | - | - | | NVIDIA® B300 NVLink `gpu-b300-sxm` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® B200 NVLink `gpu-b200-sxm` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® B200 NVLink `gpu-b200-sxm-a` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® H200 NVLink `gpu-h200-sxm` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 12) `ubuntu24.04-cuda12` Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® H100 NVLink `gpu-h100-sxm` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 12) `ubuntu24.04-cuda12` Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® RTX PRO™ 6000 `gpu-rtx6000` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® RTX PRO™ 6000 `gpu-rtx6000-a` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13, latest) `ubuntu24.04-cuda13-latest` | | NVIDIA® L40S Intel `gpu-l40s-a` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 12) `ubuntu24.04-cuda12` | | NVIDIA® L40S AMD `gpu-l40s-d` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13) `ubuntu24.04-cuda13.0` | Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 12) `ubuntu24.04-cuda12` | > [!WARNING] > > The `1gpu-20vcpu-224gb` preset for NVIDIA® B200 platforms (`gpu-b200-sxm` and `gpu-b200-sxm-a`) requires [driver](https://docs.nebius.com/compute/storage/boot-disk-images.md#gpu-drivers-and-other-components) version 580.x or newer. Earlier driver versions are not supported. ### GPU drivers and other components The boot disk images for VMs with GPUs include the following components:
Component `ubuntu24.04-cuda12` `ubuntu24.04-cuda13.0` `ubuntu24.04-cuda13-latest`
Drivers preset `cuda12.8` `cuda13.0` Latest available
CUDA Toolkit 12.8 ([release notes](https://docs.nvidia.com/cuda/archive/12.8.0/)) 13.0 ([release notes](https://docs.nvidia.com/cuda/archive/13.0.0/)) Latest 13.x
NVIDIA® Data Center GPU Driver 570.x 580.x Latest available
Linux kernel 6.11, NVIDIA® HWE 6.11, NVIDIA® HWE 6.11, NVIDIA® HWE
Networking package [NVIDIA® DOCA](https://developer.nvidia.com/networking/doca) 2.9.2 ([release notes](https://docs.nvidia.com/doca/archive/2-9-2-lts-ovs-update/doca+release+notes/index.html)) NVIDIA® DOCA 3.1.0 ([release notes](https://docs.nvidia.com/doca/archive/3-1-0/doca+release+notes/index.html)) NVIDIA® DOCA, latest available
Other components
  • [NVIDIA® Collective Communications Library](https://developer.nvidia.com/nccl) (NCCL)
  • [NVIDIA® Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html)
  • [NVIDIA® Data Center GPU Manager](https://developer.nvidia.com/dcgm) (DCGM)
  • [Nebius AI Cloud monitoring agent](https://docs.nebius.com/observability/agents/monitoring-agent.md)
To check the current versions of components in `ubuntu24.04-cuda13-latest` images, [get a list of available public images](https://docs.nebius.com/compute/storage/boot-disk-images.md#how-to-get-a-list-of-available-public-images). ## Images for non-GPU VMs For VMs without GPUs, create boot disks from the Ubuntu 24.04 LTS, `ubuntu24.04-driverless` image without GPU drivers and components. The images without drivers are also compatible with GPU VMs, but you need to install the drivers and components manually. We recommend using the [dedicated images for GPU VMs](https://docs.nebius.com/compute/storage/boot-disk-images.md#images-for-gpu-vms). The following boot disk images are compatible with non-GPU VMs: | VM platform | [Recommended images](https://docs.nebius.com/compute/storage/boot-disk-images.md#compatibility-types) | [Alternative images](https://docs.nebius.com/compute/storage/boot-disk-images.md#compatibility-types) | | - | - | - | | Non-GPU AMD Epyc Genoa `cpu-d3` | Ubuntu 24.04 LTS `ubuntu24.04-driverless` | None | | Non-GPU Intel Ice Lake `cpu-e2` | Ubuntu 24.04 LTS `ubuntu24.04-driverless` | None | > [!WARNING] > > The `ubuntu22.04-driverless` image family is deprecated. Existing disks created from images in this family remain available, but creating new disks from this image family isn't supported. Migrate to newer images. ## Security updates Automatic security updates are disabled by default. We recommend that you check the compatibility of new library versions on a test VM, and then apply the updates manually to all running GPU nodes. If you do need automatic updates, you can [enable](https://docs.nebius.com/compute/storage/automatic-updates.md) them. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Creating custom boot disk images Source: https://docs.nebius.com/compute/storage/custom-disk-images.md *Custom images* allow you to quickly [create virtual machines (VMs)](https://docs.nebius.com/compute/storage/custom-disk-images.md#how-to-create-a-vm-from-a-custom-image) or boot disks with all the necessary software, OS, and configuration, which can greatly reduce infrastructure deployment time and ensure consistency across environments. You can [create](https://docs.nebius.com/compute/storage/custom-disk-images.md#how-to-create-a-custom-boot-disk-image), [edit or delete](https://docs.nebius.com/compute/storage/custom-disk-images.md#how-to-edit-or-delete-a-custom-boot-disk-image) custom [boot disk images](https://docs.nebius.com/compute/storage/boot-disk-images.md) in the web console, by using the CLI, or by using a Nebius SDK. Alternatively, you can create custom boot disk images by using [Packer with the Nebius plug-in](https://docs.nebius.com/compute/storage/packer.md). ## Prerequisites > [tab] Web console > > 1. Make sure that you have enough quotas for images (**Number of images** and **Total storage capacity of all images**). You can view quotas and request changes on the [Administration → Limits → Quotas](https://console.nebius.com/limits/quotas) page of the web console. > 2. Prepare the source from which the image inherits configuration and architecture. Choose one of the following types of sources: > > * Boot disk. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console), [connect to it](https://docs.nebius.com/compute/virtual-machines/connect.md), and install the software that the image should inherit. The image will be based on the boot disk of this VM and will include the installed software. > * Disk snapshot. [Create a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot-web-console) from a boot disk and reuse this snapshot for the image. > * File with the ready image. [Upload an image file to a bucket](https://docs.nebius.com/object-storage/objects/upload-download.md#upload-a-single-file) in Object Storage and use this file to create the image. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you have enough quotas for images (**Number of images** and **Total storage capacity of all images**). You can view quotas and request changes on the [Administration → Limits → Quotas](https://console.nebius.com/limits/quotas) page of the web console. > 3. Prepare the source from which the image inherits configuration and architecture. Choose one of the following types of sources: > > * Boot disk. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli), [connect to it](https://docs.nebius.com/compute/virtual-machines/connect.md), and install the software that the image should inherit. The image will be based on the boot disk of this VM and will include the installed software. > * Disk snapshot. [Create a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot-cli) from a boot disk and reuse this snapshot for the image. > * File with the ready image. [Upload an image file to a bucket](https://docs.nebius.com/object-storage/objects/upload-download.md#upload-a-single-file) in Object Storage and use this file to create the image. > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > 2. [Create a custom boot disk image](https://docs.nebius.com/compute/storage/custom-disk-images.md#how-to-create-a-custom-boot-disk-image) in the web console, by using the CLI, or by using a Nebius SDK. The Terraform provider has no resource for images, so you use Terraform to create a boot disk from an existing image. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you have enough quotas for images (**Number of images** and **Total storage capacity of all images**). You can view quotas and request changes on the [Administration → Limits → Quotas](https://console.nebius.com/limits/quotas) page of the web console. > 3. Prepare the source from which the image inherits configuration and architecture. Choose one of the following types of sources: > > * Boot disk. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk), [connect to it](https://docs.nebius.com/compute/virtual-machines/connect.md), and install the software that the image should inherit. The image will be based on the boot disk of this VM and will include the installed software. > * Disk snapshot. [Create a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot-go-sdk) from a boot disk and reuse this snapshot for the image. > * File with the ready image. [Upload an image file to a bucket](https://docs.nebius.com/object-storage/objects/upload-download.md#upload-a-single-file) in Object Storage and use this file to create the image. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you have enough quotas for images (**Number of images** and **Total storage capacity of all images**). You can view quotas and request changes on the [Administration → Limits → Quotas](https://console.nebius.com/limits/quotas) page of the web console. > 3. Prepare the source from which the image inherits configuration and architecture. Choose one of the following types of sources: > > * Boot disk. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk), [connect to it](https://docs.nebius.com/compute/virtual-machines/connect.md), and install the software that the image should inherit. The image will be based on the boot disk of this VM and will include the installed software. > * Disk snapshot. [Create a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot-python-sdk) from a boot disk and reuse this snapshot for the image. > * File with the ready image. [Upload an image file to a bucket](https://docs.nebius.com/object-storage/objects/upload-download.md#upload-a-single-file) in Object Storage and use this file to create the image. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you have enough quotas for images (**Number of images** and **Total storage capacity of all images**). You can view quotas and request changes on the [Administration → Limits → Quotas](https://console.nebius.com/limits/quotas) page of the web console. > 3. Prepare the source from which the image inherits configuration and architecture. Choose one of the following types of sources: > > * Boot disk. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk), [connect to it](https://docs.nebius.com/compute/virtual-machines/connect.md), and install the software that the image should inherit. The image will be based on the boot disk of this VM and will include the installed software. > * Disk snapshot. [Create a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot-javascript-sdk) from a boot disk and reuse this snapshot for the image. > * File with the ready image. [Upload an image file to a bucket](https://docs.nebius.com/object-storage/objects/upload-download.md#upload-a-single-file) in Object Storage and use this file to create the image. ## How to create a custom boot disk image > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Storage** → **Disks**. > > 2. Click **Create resource** and then select **Image**. > > 3. In the window that opens, specify the name of your image. > > 4. Select the image source: > > * **Disk**: Create an image from a disk. Specify the following parameters: > > * **Project of source disk**: Project that the source disk of your image belongs to. > * **Source disk**: Disk used as the source for your image. The image will retain the basic architecture, size, and installed software of the source disk. > > > [!NOTE] > > > > You cannot create images from disks that are attached to a VM that is currently running. Stop the VM before attempting to create an image. > > * **Snapshot**: Create an image from a disk snapshot. Select the snapshot in the **Source snapshot** field. > > * **Object Storage file**: Import an image from a bucket. Specify the path to the file that you uploaded to the bucket. For example, `s3://nebius-bucket-test/my-image-file.qcow2`. > > You can copy and paste this value. To copy it, go to the bucket page. In the line of the uploaded image file, click  → **Copy key**. > > For information about requirements for the image file, see [Importing your own image into Compute](https://docs.nebius.com/compute/storage/import-image.md#prerequisites-web-console). > > 5. (Optional) Specify the image family. It represents a new or existing label used to group your custom images into a family. If you create a VM or a boot disk from this image family, you will use the latest image in the family. > > 6. (Optional) Specify the image description. > > 7. (Optional) Under **Advanced settings**, specify: > > * **Image family description**: Description of the family that your new image belongs to (if you specified one). > * **Recommended platforms**: Comma-separated list of compatible [platforms](https://docs.nebius.com/compute/virtual-machines/types.md) that your image will use by default. > * **Unsupported platforms**: Comma-separated list of platforms that your image architecture is *not* compatible with. Must be in the `=` format. For example, `gpu-l40s-d=not supported`. > > 8. Click **Create image**. > > The new image will appear on the **Images** tab in **Storage** → **Disks**. > [tab] CLI > > 1. If the source disk for your image is attached to a VM that is currently running, stop it: > > ```bash > nebius compute instance stop --id > ``` > > To get the VM ID, run `nebius compute instance list`. > > 2. Create an image: > > ```bash > nebius compute image create \ > --name \ > --source-disk-id \ > --parent-id \ > --source-disk-snapshot-id \ > --source-storage-bucket-name \ > --source-storage-object-name \ > --image-family \ > --description \ > --image-family-human-readable \ > --recommended-platforms ",,..." \ > --unsupported-platforms "=" > ``` > > The CLI command includes the following parameters: > > * `--name`: Name of your image. > > * Image sources. Use one of the following: > > * `--source-disk-id`: ID of the source disk that you want to create an image from. Use together with `--parent-id`: ID of the project that the source disk belongs to. > > To get both `--parent-id` and `--source-disk-id`, run `nebius compute disk list`. > > * `--source-disk-snapshot-id`: ID of the [disk snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md) that you want to create an image from. > > To get the snapshot ID, run `nebius compute disk-snapshot list`. > > * `--source-storage-bucket-name` and `--source-storage-object-name`: Bucket and object that contain the source image. > > You can import an image from a file that meets certain [requirements](https://docs.nebius.com/compute/storage/import-image.md#prerequisites-cli). To do so, upload this file to a bucket. Then, specify the name of this bucket in the `--source-storage-bucket-name` parameter and the name of the file in the `--source-storage-object-name` parameter. > > > [accordion] Creating an image from a bucket > > > > ```bash > > nebius compute image create \ > > --name \ > > --source-storage-bucket-name \ > > --source-storage-object-name > > ``` > > * `--image-family` (optional): New or existing label used to group your custom images into a family. If you create a VM or a boot disk from this image family, you will use the latest image in the family. > > * `--description` (optional): Description of your image. > > * `--image-family-human-readable` (optional): Description of the family that your new image belongs to (if you specified one). > > * `--recommended-platforms` (optional): Comma-separated list of compatible [platforms](https://docs.nebius.com/compute/virtual-machines/types.md) that your image will use by default. > > * `--unsupported-platforms` (optional): Comma-separated list of platforms that your image architecture is *not* compatible with. Must be in the `=` format. For example, `gpu-l40s-d=not supported`. > [tab] Go SDK > > 1. If the source disk for your image is attached to a VM that is currently running, stop it: > > ```go > operation, err := sdk.Services().Compute().V1(). > Instance().Stop( > ctx, > &compute.StopInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > > 2. Create an image: > > ```go > familyDescription := "" > recommendedPlatforms := []string{} > for _, platform := range strings.Split( > ",,...", > ",", > ) { > platform = strings.TrimSpace(platform) > if platform != "" { > recommendedPlatforms = append(recommendedPlatforms, platform) > } > } > unsupportedPlatforms := map[string]string{} > for _, platform := range strings.Split( > "=", > ",", > ) { > parts := strings.SplitN(platform, "=", 2) > if len(parts) == 2 && parts[0] != "" { > unsupportedPlatforms[parts[0]] = parts[1] > } > } > > imageOperation, err := sdk.Services().Compute().V1(). > Image().Create( > ctx, > &compute.CreateImageRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &compute.ImageSpec{ > Description: "", > ImageFamily: "", > Source: &compute.ImageSpec_SourceDiskId{ > SourceDiskId: "", > }, > ImageFamilyHumanReadable: familyDescription, > RecommendedPlatforms: recommendedPlatforms, > UnsupportedPlatforms: unsupportedPlatforms, > }, > }, > ) > if err != nil { > return err > } > if _, err = imageOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code includes the following parameters: > > * `Metadata.ParentId`: ID of the project that the source disk belongs to. > * `Metadata.Name`: Name of your image. > * `Spec.Description` (optional): Description of your image. > * `Spec.ImageFamily` (optional): New or existing label used to group your custom images into a family. > * `Spec.Source.SourceDiskId`: ID of the source disk that you want to create an image from. > * `Spec.ImageFamilyHumanReadable` (optional): Description of the family that your new image belongs to. > * `Spec.RecommendedPlatforms` (optional): Compatible platforms that your image will use by default. > * `Spec.UnsupportedPlatforms` (optional): Platforms that your image architecture is not compatible with. > > The Object Storage example uses `Metadata.Name`, `Spec.Source.SourceStorage.BucketName`, and `Spec.Source.SourceStorage.ObjectName`. > > > [accordion] Creating an image from a bucket > > > > ```go > > imageOperation, err = sdk.Services().Compute().V1(). > > Image().Create( > > ctx, > > &compute.CreateImageRequest{ > > Metadata: &common.ResourceMetadata{ > > Name: "", > > }, > > Spec: &compute.ImageSpec{ > > Source: &compute.ImageSpec_SourceStorage_{ > > SourceStorage: &compute.ImageSpec_SourceStorage{ > > BucketName: "", > > ObjectName: "", > > }, > > }, > > }, > > }, > > ) > > if err != nil { > > return err > > } > > if _, err = imageOperation.Wait(ctx); err != nil { > > return err > > } > > ``` > [tab] Python SDK > > 1. If the source disk for your image is attached to a VM that is currently running, stop it: > > ```python > instance_service = InstanceServiceClient(sdk) > stop_instance_operation = await instance_service.stop( > StopInstanceRequest(id=""), > ) > await stop_instance_operation.wait() > ``` > > 2. Create an image: > > ```python > recommended_platforms = [ > platform.strip() > for platform in ",,...".split(",") > if platform.strip() > ] > unsupported_platforms = dict( > platform.split("=", 1) > for platform in "=".split(",") > if platform > ) > > image_service = ImageServiceClient(sdk) > create_image_operation = await image_service.create( > CreateImageRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=ImageSpec( > source_disk_id="", > image_family="", > description="", > image_family_human_readable="", > recommended_platforms=recommended_platforms, > unsupported_platforms=unsupported_platforms, > ), > ), > ) > await create_image_operation.wait() > ``` > > The code includes the following parameters: > > * `metadata.parent_id`: ID of the project that the source disk belongs to. > * `metadata.name`: Name of your image. > * `spec.source_disk_id`: ID of the source disk that you want to create an image from. > * `spec.image_family` (optional): New or existing label used to group your custom images into a family. > * `spec.description` (optional): Description of your image. > * `spec.image_family_human_readable` (optional): Description of the family that your new image belongs to. > * `spec.recommended_platforms` (optional): Compatible platforms that your image will use by default. > * `spec.unsupported_platforms` (optional): Platforms that your image architecture is not compatible with. > > The Object Storage example uses `metadata.name`, `spec.source_storage.bucket_name`, and `spec.source_storage.object_name`. > > > [accordion] Creating an image from a bucket > > > > ```python > > image_service = ImageServiceClient(sdk) > > create_image_operation = await image_service.create( > > CreateImageRequest( > > metadata=ResourceMetadata( > > name="", > > ), > > spec=ImageSpec( > > source_storage=ImageSpec.SourceStorage( > > bucket_name="", > > object_name="", > > ), > > ), > > ), > > ) > > await create_image_operation.wait() > > ``` > [tab] JavaScript SDK > > 1. If the source disk for your image is attached to a VM that is currently running, stop it: > > ```ts > const stopInstanceService = new InstanceService(sdk); > const stopInstanceOperation = await stopInstanceService.stop( > StopInstanceRequest.create({ > id: "", > }), > ).result; > await stopInstanceOperation.wait(); > ``` > > 2. Create an image: > > ```ts > const recommendedPlatforms = ",,..." > .split(",") > .map((platform) => platform.trim()) > .filter(Boolean); > const unsupportedPlatforms = Object.fromEntries( > "=" > .split(",") > .filter(Boolean) > .map((platform) => platform.split("=", 2)), > ); > > const createImageService = new ImageService(sdk); > const createImageOperation = await createImageService.create( > CreateImageRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "", > }), > spec: ImageSpec.create({ > source: { > $case: "sourceDiskId", > sourceDiskId: "", > }, > imageFamily: "", > description: "", > imageFamilyHumanReadable: "", > recommendedPlatforms, > unsupportedPlatforms, > }), > }), > ).result; > await createImageOperation.wait(); > ``` > > The code includes the following parameters: > > * `metadata.parentId`: ID of the project that the source disk belongs to. > * `metadata.name`: Name of your image. > * `spec.source.sourceDiskId`: ID of the source disk that you want to create an image from. > * `spec.imageFamily` (optional): New or existing label used to group your custom images into a family. > * `spec.description` (optional): Description of your image. > * `spec.imageFamilyHumanReadable` (optional): Description of the family that your new image belongs to. > * `spec.recommendedPlatforms` (optional): Compatible platforms that your image will use by default. > * `spec.unsupportedPlatforms` (optional): Platforms that your image architecture is not compatible with. > > The Object Storage example uses `metadata.name`, `spec.source.sourceStorage.bucketName`, and `spec.source.sourceStorage.objectName`. > > > [accordion] Creating an image from a bucket > > > > ```ts > > const createBucketImageService = new ImageService(sdk); > > const createBucketImageOperation = > > await createBucketImageService.create( > > CreateImageRequest.create({ > > metadata: ResourceMetadata.create({ > > name: "", > > }), > > spec: ImageSpec.create({ > > source: { > > $case: "sourceStorage", > > sourceStorage: ImageSpec_SourceStorage.create({ > > bucketName: "", > > objectName: "", > > }), > > }, > > }), > > }), > > ).result; > > await createBucketImageOperation.wait(); > > ``` ## How to edit or delete a custom boot disk image > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Storage** → **Disks**. > > 2. Switch to the **Images** tab and open the image you want to access. > > The **Image overview** tab shows detailed information about the image and the source disk that it's based on. > > 3. On the image page, switch to the **Settings** tab. > > 4. Update the image name or click **Delete image** to delete it. > [tab] CLI > > * To check the status of your image, run: > > ```bash > nebius compute image get computeimage-e*** > ``` > > To get the image ID, run `nebius compute image list`. > > * To edit your image (for example, rename it), run: > > ```bash > nebius compute image update computeimage-e*** > ``` > > For more information about the command parameters, see the [command reference](https://docs.nebius.com/cli/reference/compute/image/update.md). > > * To delete your image, run: > > ```bash > nebius compute image delete computeimage-e*** > ``` > [tab] Go SDK > > * Check the status of your image: > > ```go > imageDetails, err := sdk.Services().Compute().V1(). > Image().Get( > ctx, > &compute.GetImageRequest{ > Id: "computeimage-e***", > }, > ) > if err != nil { > return err > } > fmt.Println(imageDetails) > ``` > > * Edit your image, for example, rename it: > > ```go > imageForUpdate, err := sdk.Services().Compute().V1(). > Image().Get( > ctx, > &compute.GetImageRequest{ > Id: "computeimage-e***", > }, > ) > if err != nil { > return err > } > if imageForUpdate.GetSpec() == nil { > return errors.New("image spec is missing") > } > imageOperation, err = sdk.Services().Compute().V1(). > Image().Update( > ctx, > &compute.UpdateImageRequest{ > Metadata: imageForUpdate.Metadata, > Spec: imageForUpdate.Spec, > }, > ) > if err != nil { > return err > } > if _, err = imageOperation.Wait(ctx); err != nil { > return err > } > ``` > > * Delete your image: > > ```go > deleteImageOperation, err := sdk.Services().Compute().V1(). > Image().Delete( > ctx, > &compute.DeleteImageRequest{ > Id: "computeimage-e***", > }, > ) > if err != nil { > return err > } > if _, err = deleteImageOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > * Check the status of your image: > > ```python > image_service = ImageServiceClient(sdk) > image = await image_service.get( > GetImageRequest(id="computeimage-e***"), > ) > print(image) > ``` > > * Edit your image, for example, rename it: > > ```python > image_service = ImageServiceClient(sdk) > image = await image_service.get( > GetImageRequest(id="computeimage-e***"), > ) > if image.spec is None: > raise ValueError("image spec is missing") > update_image_operation = await image_service.update( > UpdateImageRequest( > metadata=image.metadata, > spec=image.spec, > ), > ) > await update_image_operation.wait() > ``` > > * Delete your image: > > ```python > image_service = ImageServiceClient(sdk) > delete_image_operation = await image_service.delete( > DeleteImageRequest(id="computeimage-e***"), > ) > await delete_image_operation.wait() > ``` > [tab] JavaScript SDK > > * Check the status of your image: > > ```ts > const getImageService = new ImageService(sdk); > const imageDetails = await getImageService.get( > GetImageRequest.create({ > id: "computeimage-e***", > }), > ); > console.log(imageDetails); > ``` > > * Edit your image, for example, rename it: > > ```ts > const updateImageService = new ImageService(sdk); > const imageForUpdate = await updateImageService.get( > GetImageRequest.create({ > id: "computeimage-e***", > }), > ); > if (!imageForUpdate.spec) { > throw new Error("image spec is missing"); > } > const updateImageOperation = await updateImageService.update( > UpdateImageRequest.create({ > metadata: imageForUpdate.metadata, > spec: imageForUpdate.spec, > }), > ).result; > await updateImageOperation.wait(); > ``` > > * Delete your image: > > ```ts > const deleteImageService = new ImageService(sdk); > const deleteImageOperation = await deleteImageService.delete( > DeleteImageRequest.create({ > id: "computeimage-e***", > }), > ).result; > await deleteImageOperation.wait(); > ``` ## How to create a VM from a custom image After your custom boot disk image is ready, you can deploy a VM from it or create a boot disk based on this image. > [tab] Web console > > To create a VM from a custom image: > > 1. In the [web console](https://console.nebius.com), go to **Storage** → **Disks** → **Images**. > > 2. Next to the image, click  → **Create virtual machine**. > > 3. [Configure and create the VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-web-console). > > > [!NOTE] > > > > You can also select a custom image on the VM creation page. To do that, click in the **Boot disk** section and select your custom image or image family in **Image configuration**. > [tab] CLI > > 1. Create a boot disk based on a custom image: > > ```bash > nebius compute disk create \ > --name \ > --type network_ \ > --size-gibibytes \ > --block-size-bytes \ > --source-image-id computeimage-*** > ``` > > To get the image ID, run `nebius compute image list`. > > 2. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli) with the new disk. > > Use the ID of the boot disk created earlier with the `--boot-disk-existing-disk-id` parameter. > [tab] Terraform > > 1. Create the following configuration for a boot disk based on a custom image: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "" > parent_id = "" > type = "NETWORK_" > size_gibibytes = > block_size_bytes = > source_image_id = "" > } > ``` > > The file contains the following parameters: > > * `name`: Disk name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the disk is created. > * `type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `size_gibibytes`: Disk size in gibibytes. > * `block_size_bytes`: Block size in bytes. > * `source_image_id`: ID of the custom image that you [created](https://docs.nebius.com/compute/storage/custom-disk-images.md#how-to-create-a-custom-boot-disk-image). > > For more information about disk parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For the full resource reference, see [nebius\_compute\_v1\_disk](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > 4. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-terraform) with the new disk. > > In the `boot_disk.existing_disk.id` attribute of the `nebius_compute_v1_instance` resource, reference the new disk, for example, `nebius_compute_v1_disk..id`. > [tab] Go SDK > > 1. Create a boot disk based on a custom image: > > ```go > // One of compute.DiskSpec_NETWORK_SSD, > // compute.DiskSpec_NETWORK_SSD_NON_REPLICATED, > // or compute.DiskSpec_NETWORK_SSD_IO_M3. > diskType := compute.DiskSpec_NETWORK_SSD > > diskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: , > }, > BlockSizeBytes: , > Type: diskType, > Source: &compute.DiskSpec_SourceImageId{ > SourceImageId: "computeimage-***", > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = diskOperation.Wait(ctx); err != nil { > return err > } > ``` > > 2. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk) with the new disk. > > Use the ID of the boot disk created earlier. > [tab] Python SDK > > 1. Create a boot disk based on a custom image: > > ```python > # One of DiskSpec.DiskType.NETWORK_SSD, > # DiskSpec.DiskType.NETWORK_SSD_NON_REPLICATED, > # or DiskSpec.DiskType.NETWORK_SSD_IO_M3. > disk_type = DiskSpec.DiskType.NETWORK_SSD > > disk_service = DiskServiceClient(sdk) > create_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="", > ), > spec=DiskSpec( > block_size_bytes=, > type=disk_type, > source_image_id="computeimage-***", > size_gibibytes=, > ), > ), > ) > await create_disk_operation.wait() > ``` > > 2. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk) with the new disk. > > Use the ID of the boot disk created earlier. > [tab] JavaScript SDK > > 1. Create a boot disk based on a custom image: > > ```ts > // One of DiskSpec_DiskType.NETWORK_SSD, > // DiskSpec_DiskType.NETWORK_SSD_NON_REPLICATED, > // or DiskSpec_DiskType.NETWORK_SSD_IO_M3. > const imageDiskType = DiskSpec_DiskType.NETWORK_SSD; > > const createDiskFromImageService = new DiskService(sdk); > const createDiskFromImageOperation = > await createDiskFromImageService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSpec.create({ > blockSizeBytes: , > type: imageDiskType, > source: { > $case: "sourceImageId", > sourceImageId: "computeimage-***", > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: , > }, > }), > }), > ).result; > await createDiskFromImageOperation.wait(); > ``` > > 2. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk) with the new disk. > > Use the ID of the boot disk created earlier. # Creating boot disk images with Packer Source: https://docs.nebius.com/compute/storage/packer.md You can create custom boot disk images based on existing images by using [Packer](https://developer.hashicorp.com/packer) and the [Nebius Packer plug-in](https://github.com/nebius/packer-plugin-nebius/blob/main/README.md). The Nebius Packer plug-in creates a temporary virtual machine (VM) from a base image, connects to it over SSH, runs provisioners and then creates a new boot disk image. Use this workflow to: * Pre-install packages and system dependencies * Prepare versioned images for repeated VM creation * Standardize environments across teams or workloads ## Before you start 1. Install [Packer](https://developer.hashicorp.com/packer/downloads). 2. Make sure your project has sufficient [quotas](https://docs.nebius.com/overview/quotas.md) for image creation: * Number of images * Total storage capacity of all images 3. Set up authentication by using one of the following methods. * **Service account** 1. [Create a service account](https://docs.nebius.com/iam/service-accounts/manage.md) and [generate a key pair](https://docs.nebius.com/iam/service-accounts/authorized-keys.md#create-a-key-pair). The key pair is saved to a JSON file, for example, `~/.nebius/_credentials.json`. 2. Open the file and copy the value of the `private_key` field. 3. Save the key to the `private.pem` file. 4. Use the values from the JSON file in your Packer configuration. * **Access token** Generate an access token: ```bash nebius iam get-access-token ``` An access token is valid for 12 hours. After it expires, create a new one. ## Steps ### Install the Nebius Packer plug-in 1. Create the `config.pkr.hcl` file and add the Nebius plug-in configuration: ```hcl packer { required_plugins { nebius = { source = "github.com/nebius/nebius" version = ">= 0.0.4" } } } ``` 2. Initialize the plug-in in the directory that contains your Packer configuration files: ```bash packer init . ``` ### Build the disk image The Nebius image builder creates a VM from a base image, provisions it over SSH, and publishes a new image. 1. Create the `build.pkr.hcl` file and add the `nebius-image` source to it: ```hcl source "nebius-image" "ubuntu2404" { communicator = "ssh" ssh_username = "ubuntu" # Service account credentials used for image creation service_account { private_key_file = "./private.pem" public_key_id = "" account_id = "" } # Alternatively, use an access token # token = # Boot disk configuration for the temporary VM disk { size_gibibytes = 60 } # Source image used to create the temporary VM base_image { family = "ubuntu24.04-driverless" } # Network configuration for the temporary VM network { subnet_id = "" associate_public_ip_address = true } # Compute resources for the temporary VM instance { platform = "cpu-d3" preset = "16vcpu-64gb" } # Parameters of the resulting image image { name = "ubuntu24.04-131-0.0.1" version = "0.0.1" image_family = "ubuntu24.04-131" cpu_architecture = "amd64" image_family_human_readable = "Ubuntu 24.04 CUDA 13.1 Hackathon" } # Project where the image will be created parent_id = "" } ``` The `nebius-image` source has the following parameters: **General parameters** * `communicator` (optional): Specifies how Packer connects to the VM. Supported value: `ssh` (default). * `parent_id`: ID of the project where the resulting image will be created. * `ssh_username`: Username used to connect to the VM. **Authentication** * `service_account.private_key_file`: Path to the private key file. * `service_account.public_key_id`: ID of the public key. * `service_account.account_id`: Service account ID. * `token`: Access token used for authentication. Use this as an alternative to `service_account`. **Disk configuration** * `disk.size_gibibytes`: Size of the disk in GiB. **Base image** * `base_image.family`: Image family name. * `base_image.id`: Specific image ID. **Network** * `network.subnet_id` (optional): ID of an existing subnet that will be used to create a VM. If not provided, the plug-in attempts to find the project's default network. * `network.associate_public_ip_address` (optional): Assigns a public IP address. Use a public IP if your build environment connects directly via SSH. **VM configuration** * `instance.platform`: VM [platform](https://docs.nebius.com/compute/virtual-machines/types.md). * `instance.preset`: VM platform preset (number of GPUs and vCPUs, RAM size). **Output image configuration** * `image.name`: Image name. * `image.version` (optional): Image version. * `image.image_family` (optional): Image family identifier. * `image.image_family_human_readable` (optional): Display name for the image family. * `image.cpu_architecture` (optional): CPU architecture. 2. Add the build block to the `build.pkr.hcl` file: ```hcl build { sources = ["source.nebius-image.ubuntu2404"] provisioner "file" { # Path to a local script in your project source = "some-local-file.txt" destination = "/tmp/helloworld.txt" } provisioner "shell" { inline = [ "cd /tmp", "echo Installing hello world text", "sudo mv /tmp/helloworld.txt /root", "echo Resetting cloud-init and caches", "sudo apt clean", "sudo uv cache clean", "sudo cloud-init clean --logs", "sudo sync", ] } } ``` 3. From the directory with the configuration files, run: ```bash packer init . packer build build.pkr.hcl ``` ### Check the image 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Disks**. 2. Go to the **Images** tab and locate your image. # Importing your own image into Compute Source: https://docs.nebius.com/compute/storage/import-image.md You can import an image file into Nebius AI Cloud, and create boot disks and virtual machines (VMs) based on your custom image. To make an import, upload an image file to a bucket in Object Storage and create an image in Compute. ## Prerequisites > [tab] Web console > > 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 2. Prepare an image that meets the following requirements: > > * BIOS mode > * AMD64 or ARM64 architecture > * `.vmdk`, `.vhd`, `.raw` or `.qcow2` format for the image file > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. Prepare an image that meets the following requirements: > > * BIOS mode > * AMD64 or ARM64 architecture > * `.vmdk`, `.vhd`, `.raw` or `.qcow2` format for the image file > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. Prepare an image that meets the following requirements: > > * BIOS mode > * AMD64 or ARM64 architecture > * `.vmdk`, `.vhd`, `.raw` or `.qcow2` format for the image file > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. Prepare an image that meets the following requirements: > > * BIOS mode > * AMD64 or ARM64 architecture > * `.vmdk`, `.vhd`, `.raw` or `.qcow2` format for the image file > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. Prepare an image that meets the following requirements: > > * BIOS mode > * AMD64 or ARM64 architecture > * `.vmdk`, `.vhd`, `.raw` or `.qcow2` format for the image file ## Steps The bucket, image, and VM should be in the same region. ### Upload the image file 1. [Create an Object Storage bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets). 2. [Upload](https://docs.nebius.com/object-storage/objects/upload-download.md#upload-a-single-file) your image file to this bucket. ### Create an image Create an image from the uploaded file: > [tab] Web console > > 1. Copy the key of the file object: > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Object Storage**. > 2. Open the bucket page. > 3. In the line of the uploaded object, click  → **Copy key**. > 2. Create the image in Nebius AI Cloud: > > 1. In the web console, go to  **Storage** → **Disks**. > > 2. Click **Create resource** → **Image**. > > 3. In the window that opens, specify the name of your image. > > 4. In the **Source** field, select **Object Storage file**. > > 5. In the **Object Storage file** field, specify the copied object key. > > The value must meet the `s3:///` format. For example, `s3://nebius-bucket-test/my-image-file.qcow2`. > > 6. Click **Create image**. > > The new image appears on the **Images** tab in  **Storage** → **Disks**. > [tab] CLI > > ```bash > nebius compute image create \ > --name \ > --source-storage-bucket-name \ > --source-storage-object-name > ``` > > For example, if the object of the image file has the `s3://nebius-bucket-test/my-image-file.qcow2` key: > > * `--source-storage-bucket-name` should be `nebius-bucket-test` > > * `--source-storage-object-name` should be `my-image-file.qcow2` > > > [!NOTE] > > > > By default, the AMD64 architecture is used for the image. If you want to use ARM64, add the `--cpu-architecture arm64` parameter to the command above. > [tab] Go SDK > > ```go > imageOperation, err = sdk.Services().Compute().V1(). > Image().Create( > ctx, > &compute.CreateImageRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.ImageSpec{ > Source: &compute.ImageSpec_SourceStorage_{ > SourceStorage: &compute.ImageSpec_SourceStorage{ > BucketName: "", > ObjectName: "", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = imageOperation.Wait(ctx); err != nil { > return err > } > ``` > > For example, if the object of the image file has the `s3://nebius-bucket-test/my-image-file.qcow2` key: > > * `BucketName` should be `nebius-bucket-test` > * `ObjectName` should be `my-image-file.qcow2` > [tab] Python SDK > > ```python > image_service = ImageServiceClient(sdk) > create_image_operation = await image_service.create( > CreateImageRequest( > metadata=ResourceMetadata( > name="", > ), > spec=ImageSpec( > source_storage=ImageSpec.SourceStorage( > bucket_name="", > object_name="", > ), > ), > ), > ) > await create_image_operation.wait() > ``` > > For example, if the object of the image file has the `s3://nebius-bucket-test/my-image-file.qcow2` key: > > * `bucket_name` should be `nebius-bucket-test` > * `object_name` should be `my-image-file.qcow2` > [tab] JavaScript SDK > > ```ts > const createBucketImageService = new ImageService(sdk); > const createBucketImageOperation = > await createBucketImageService.create( > CreateImageRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: ImageSpec.create({ > source: { > $case: "sourceStorage", > sourceStorage: ImageSpec_SourceStorage.create({ > bucketName: "", > objectName: "", > }), > }, > }), > }), > ).result; > await createBucketImageOperation.wait(); > ``` > > For example, if the object of the image file has the `s3://nebius-bucket-test/my-image-file.qcow2` key: > > * `bucketName` should be `nebius-bucket-test` > * `objectName` should be `my-image-file.qcow2` ### Create a boot disk and a VM 1. When the image is ready, [create a boot disk](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-disk) with it. 2. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm) with the new boot disk. 3. (Optional) If you don't need the image file in the bucket, delete it. The image in Compute won't use it anymore. # Recommendations for configuring custom images in Compute Source: https://docs.nebius.com/compute/storage/image-recommendations.md If you work with [custom images](https://docs.nebius.com/compute/storage/custom-disk-images.md), we recommend optimizing them so your boot disks and virtual machines (VMs) work with higher productivity and speed. When you create a VM based on a custom image, this VM doesn't include some of the settings that a VM based on a public image includes. You can add these settings to your custom-image VM and optimize it. The additional settings aren't required for every custom image, but we recommend them for at least production-oriented images unless you have workload-specific reasons for not using these settings. ## Install the monitoring agent by Nebius AI Cloud The [monitoring agent](https://docs.nebius.com/observability/agents/monitoring-agent.md) is installed by default on VMs with public images. If you use a custom image, install the agent to collect and view [metrics for the VM](https://docs.nebius.com/compute/monitoring/virtual-machines.md). To install the monitoring agent, [connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh) and then run the following commands: ```bash sudo curl https://dr.nebius.cloud/public.gpg -o /etc/apt/keyrings/nebius-public.gpg.pub echo deb [signed-by=/etc/apt/keyrings/nebius-public.gpg.pub] https://dr.nebius.cloud/ stable main | sudo tee /etc/apt/sources.list.d/nebius-public.list sudo apt-get update sudo apt-get install -y nebius-observability-agent nebius-observability-agent-updater ``` ## Collect serial logs To collect and view [serial logs](https://docs.nebius.com/compute/monitoring/serial-logs.md) of a VM on a custom image, configure the VM's [GRUB](https://en.wikipedia.org/wiki/GNU_GRUB) to initialize and use a serial port. GRUB is a boot loader package that boots an operating system and kernel configuration. To configure GRUB for Ubuntu-based disk images: 1. [Connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 2. In the `/etc/default/grub` file, add the following line: ```text GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0" ``` 3. Update GRUB: ```bash update-grub ``` 4. Reboot the VM: disconnect from it, and [stop and start it](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually). ## Change sysctl settings Apply the recommended `sysctl` settings to improve the networking and kernel characteristics of the VM. To do so, connect to the VM and update the following settings in two files: * File `/etc/sysctl.d/30-network.conf` ```text # Decrease default tcp keepalive time net.ipv4.tcp_keepalive_time = 120 net.ipv4.tcp_keepalive_intvl = 60 net.ipv4.tcp_keepalive_probes = 4 # Make conntrack more liberal to tcp out of window packets to prevent # spurious connection resets when masquerading is in use net.netfilter.nf_conntrack_tcp_be_liberal = 1 ``` * File `/etc/sysctl.d/90-kernel.conf` ```text kernel.panic = 10 kernel.printk = 7 4 1 7 ``` ## Adjust the virtiofs settings To speed up reading from volumes and writing to them, adjust the `virtiofs` settings. Connect to the VM and run the Bash script below. The script increases the `read_ahead_kb` value to improve the performance of the VM volumes. ```bash #!/usr/bin/env bash set -euo pipefail install -d /usr/local/bin install -d /etc/udev/rules.d cat > /usr/local/bin/tune_virtiofs_bdi.sh <<'EOF' #!/usr/bin/env bash kernel="${1:-}" while read -r dev on mp type fs opts; do dev=$(/bin/mountpoint -d "$mp") if [[ "$fs" == "virtiofs" ]]; then if [[ "$kernel" == "$dev" ]]; then exit 0 fi fi done < <(mount | grep virtiofs) exit 1 EOF chmod +x /usr/local/bin/tune_virtiofs_bdi.sh cat > /etc/udev/rules.d/99-virtiofs.rules <<'EOF' SUBSYSTEM=="bdi", ACTION=="add", PROGRAM="/usr/local/bin/tune_virtiofs_bdi.sh $kernel", ATTR{read_ahead_kb}="8192" EOF ``` ## Enable failure reporting by using pvpanic The `pvpanic` tool allows the guest OS kernel to report panic and crash events to the hypervisor. This helps with failure detection and troubleshooting. To start using `pvpanic` on Ubuntu, connect to the VM and install the package: ```bash sudo apt-get install -y linux-image-generic ``` # Managing disk snapshots in Compute Source: https://docs.nebius.com/compute/storage/disk-snapshots.md A *disk snapshot* captures a point-in-time copy of a disk. Snapshots are used for backup purposes and allow you to: * Clone and recover a certain state of the disk. * Recover from accidental deletion, corruption, and security incidents. * Make a copy of a disk before risky operations, such as software upgrades, patches, or configuration changes, so you can roll back in case of issues. * Fulfill compliance requirements for immutable system versions, if applicable. To clone a disk state, [create a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot). To restore a disk state, [create a new disk from a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-disk-from-a-snapshot). Snapshots support both boot and additional disks. They also support all [disk types](https://docs.nebius.com/compute/storage/types.md#disk-types): SSD, SSD Non-replicated and SSD IO M3. Every snapshot is only available in the project where it was created. Therefore, you can only work with snapshots and disks within the project. Nebius AI Cloud charges for a complete copy of a disk and applies separate pricing for snapshots. For more information, see [Compute pricing](https://docs.nebius.com/compute/resources/pricing.md#disk-snapshots). ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Terraform > > * [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## How to create a snapshot To create a snapshot, you don't need to stop a virtual machine. > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Disks**. > > 2. In the list of disks, find the disk that you want to create a snapshot for. > > 3. In the line of the required disk, click  → **Create snapshot**. > > 4. In the window that opens, specify the name and optionally the description of the snapshot. > > The ID of the selected disk is prefilled in the **Source disk** field. > > 5. Click **Create snapshot**. > > Once you create a snapshot, it appears on the disk page. There, you can find all snapshots created for a given disk. > [tab] CLI > > Run the following command: > > ```bash > nebius compute disk-snapshot create \ > --name \ > --description "" \ > --source-disk-id > ``` > > The command contains the following parameters: > > * `--name`: Snapshot name. > * `--description` (optional): Snapshot description. > * `--source-disk-id`: ID of the disk that you want to create a snapshot for. To get the disk ID, run `nebius compute disk list`. > [tab] Terraform > > 1. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_disk_snapshot" "" { > name = "" > parent_id = "" > description = "" > source_disk_id = "" > } > ``` > > The file contains the following parameters: > > * `name`: Snapshot name. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the snapshot is created. Use the project that contains the source disk. > * `description` (optional): Snapshot description. > * `source_disk_id`: ID of the disk that you want to create a snapshot for. > > For the full resource reference, see [nebius\_compute\_v1\_disk\_snapshot](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk_snapshot.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > snapshotOperation, err := sdk.Services().Compute().V1(). > DiskSnapshot().Create( > ctx, > &compute.CreateDiskSnapshotRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSnapshotSpec{ > SourceDiskId: "", > Description: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = snapshotOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * `Metadata.Name`: Snapshot name. > * `Spec.SourceDiskId`: ID of the disk that you want to create a snapshot for. > * `Spec.Description` (optional): Snapshot description. > [tab] Python SDK > > ```python > snapshot_service = DiskSnapshotServiceClient(sdk) > create_snapshot_operation = await snapshot_service.create( > CreateDiskSnapshotRequest( > metadata=ResourceMetadata( > name="", > ), > spec=DiskSnapshotSpec( > source_disk_id="", > description="", > ), > ), > ) > await create_snapshot_operation.wait() > ``` > > The code contains the following parameters: > > * `metadata.name`: Snapshot name. > * `spec.source_disk_id`: ID of the disk that you want to create a snapshot for. > * `spec.description` (optional): Snapshot description. > [tab] JavaScript SDK > > ```ts > const snapshotService = new DiskSnapshotService(sdk); > const createSnapshotOperation = await snapshotService.create( > CreateDiskSnapshotRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSnapshotSpec.create({ > sourceDiskId: "", > description: "", > }), > }), > ).result; > await createSnapshotOperation.wait(); > ``` > > The code contains the following parameters: > > * `metadata.name`: Snapshot name. > * `spec.sourceDiskId`: ID of the disk that you want to create a snapshot for. > * `spec.description` (optional): Snapshot description. ## How to create a disk from a snapshot After you [prepare a snapshot](https://docs.nebius.com/compute/storage/disk-snapshots.md#how-to-create-a-snapshot), you can create a disk based on this snapshot. Thus, you restore the needed disk state with data integrity verified. To create a disk from a snapshot: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Disks** → **Snapshots**. > > 2. In the line of the required snapshot, click  → **Create disk**. > > 3. On the disk creation page that opens, check the **Disk source type** and **Snapshot** fields. They are prefilled: > > * **Disk source type**: Snapshot. > * **Snapshot**: ID of the selected snapshot. > > 4. Set other needed [fields for the disk](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-disk-web-console) and click **Create disk**. > [tab] CLI > > Run the following command: > > ```bash > nebius compute disk create \ > --name \ > --type network_ \ > --size-gibibytes \ > --block-size-bytes \ > --source-snapshot-id > ``` > > To get the snapshot ID, run `nebius compute disk-snapshot list`. > [tab] Terraform > > 1. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_disk" "" { > name = "" > parent_id = "" > type = "NETWORK_" > size_gibibytes = > block_size_bytes = > source_snapshot_id = "" > } > ``` > > For `parent_id`, use the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). For more information about other parameters, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). For the full reference on the disk resource, see [nebius\_compute\_v1\_disk](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_disk.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > // One of compute.DiskSpec_NETWORK_SSD, > // compute.DiskSpec_NETWORK_SSD_NON_REPLICATED, > // or compute.DiskSpec_NETWORK_SSD_IO_M3. > diskType := compute.DiskSpec_NETWORK_SSD > diskOperation, err := sdk.Services().Compute().V1(). > Disk().Create( > ctx, > &compute.CreateDiskRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &compute.DiskSpec{ > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: , > }, > BlockSizeBytes: , > Type: diskType, > Source: &compute.DiskSpec_SourceSnapshotId{ > SourceSnapshotId: "", > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = diskOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * `diskType`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `Metadata.Name`: Disk name. > * `Spec.Size.SizeGibibytes`: Disk size in gibibytes. > * `Spec.BlockSizeBytes`: Block size in bytes. > * `Spec.Type`: Disk type set by `diskType`. > * `Spec.Source.SourceSnapshotId`: ID of the snapshot to create the disk from. > [tab] Python SDK > > ```python > # One of DiskSpec.DiskType.NETWORK_SSD, > # DiskSpec.DiskType.NETWORK_SSD_NON_REPLICATED, > # or DiskSpec.DiskType.NETWORK_SSD_IO_M3. > disk_type = DiskSpec.DiskType.NETWORK_SSD > > disk_service = DiskServiceClient(sdk) > create_disk_operation = await disk_service.create( > CreateDiskRequest( > metadata=ResourceMetadata( > name="", > ), > spec=DiskSpec( > block_size_bytes=, > type=disk_type, > source_snapshot_id="", > size_gibibytes=, > ), > ), > ) > await create_disk_operation.wait() > ``` > > The code contains the following parameters: > > * `disk_type`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `metadata.name`: Disk name. > * `spec.block_size_bytes`: Block size in bytes. > * `spec.type`: Disk type set by `disk_type`. > * `spec.source_snapshot_id`: ID of the snapshot to create the disk from. > * `spec.size_gibibytes`: Disk size in gibibytes. > [tab] JavaScript SDK > > ```ts > // One of DiskSpec_DiskType.NETWORK_SSD, > // DiskSpec_DiskType.NETWORK_SSD_NON_REPLICATED, > // or DiskSpec_DiskType.NETWORK_SSD_IO_M3. > const diskType = DiskSpec_DiskType.NETWORK_SSD; > > const diskService = new DiskService(sdk); > const createDiskOperation = await diskService.create( > CreateDiskRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: DiskSpec.create({ > blockSizeBytes: , > type: diskType, > source: { > $case: "sourceSnapshotId", > sourceSnapshotId: "", > }, > size: { > $case: "sizeGibibytes", > sizeGibibytes: , > }, > }), > }), > ).result; > await createDiskOperation.wait(); > ``` > > The code contains the following parameters: > > * `diskType`: [Disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * `metadata.name`: Disk name. > * `spec.blockSizeBytes`: Block size in bytes. > * `spec.type`: Disk type set by `diskType`. > * `spec.source.sourceSnapshotId`: ID of the snapshot to create the disk from. > * `spec.size.sizeGibibytes`: Disk size in gibibytes. After you create the disk, you can [create a virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm) with it. ## How to update a snapshot > [tab] Web console > > In the web console, you can only change the snapshot name. > > 1. In the sidebar, go to  **Storage** → **Disks** → **Snapshots**. > 2. In the line of the required snapshot, click  → **Settings**. > 3. On the page of the snapshot settings that opens, update the snapshot name and click **Save changes**. > [tab] CLI > > In the CLI, you can change the snapshot name and description. > > Run the following command: > > ```bash > nebius compute disk-snapshot update \ > --id \ > --name \ > --description "" > ``` > > In the command, specify the ID of the snapshot that you want to update. To get the snapshot ID, run `nebius compute disk-snapshot list`. > [tab] Terraform > > 1. In the configuration file, update the `nebius_compute_v1_disk_snapshot` resource: > > ```hcl > resource "nebius_compute_v1_disk_snapshot" "" { > name = "" > description = "" > > # ... > } > ``` > > You can update the following parameters: > > * `name`: Snapshot name. > * `description`: Snapshot description. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > snapshotForUpdate, err := sdk.Services().Compute().V1(). > DiskSnapshot().Get( > ctx, > &compute.GetDiskSnapshotRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if snapshotForUpdate.GetMetadata() == nil || > snapshotForUpdate.GetSpec() == nil { > return errors.New("snapshot metadata or spec is missing") > } > snapshotForUpdate.Metadata.Name = "" > snapshotForUpdate.Spec.Description = "" > snapshotOperation, err = sdk.Services().Compute().V1(). > DiskSnapshot().Update( > ctx, > &compute.UpdateDiskSnapshotRequest{ > Metadata: snapshotForUpdate.Metadata, > Spec: snapshotForUpdate.Spec, > }, > ) > if err != nil { > return err > } > if _, err = snapshotOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * `GetDiskSnapshotRequest.Id`: ID of the snapshot that you want to update. > * `Metadata.Name`: New snapshot name. > * `Spec.Description`: New snapshot description. > [tab] Python SDK > > ```python > snapshot_service = DiskSnapshotServiceClient(sdk) > snapshot = await snapshot_service.get( > GetDiskSnapshotRequest(id=""), > ) > if snapshot.metadata is None or snapshot.spec is None: > raise ValueError("snapshot metadata or spec is missing") > snapshot.metadata.name = "" > snapshot.spec.description = "" > update_snapshot_operation = await snapshot_service.update( > UpdateDiskSnapshotRequest( > metadata=snapshot.metadata, > spec=snapshot.spec, > ), > ) > await update_snapshot_operation.wait() > ``` > > The code contains the following parameters: > > * `GetDiskSnapshotRequest.id`: ID of the snapshot that you want to update. > * `metadata.name`: New snapshot name. > * `spec.description`: New snapshot description. > [tab] JavaScript SDK > > ```ts > const updateSnapshotService = new DiskSnapshotService(sdk); > const snapshotForUpdate = await updateSnapshotService.get( > GetDiskSnapshotRequest.create({ > id: "", > }), > ); > if (!snapshotForUpdate.metadata || !snapshotForUpdate.spec) { > throw new Error("snapshot metadata or spec is missing"); > } > snapshotForUpdate.metadata.name = ""; > snapshotForUpdate.spec.description = ""; > const updateSnapshotOperation = await updateSnapshotService.update( > UpdateDiskSnapshotRequest.create({ > metadata: snapshotForUpdate.metadata, > spec: snapshotForUpdate.spec, > }), > ).result; > await updateSnapshotOperation.wait(); > ``` > > The code contains the following parameters: > > * `GetDiskSnapshotRequest.id`: ID of the snapshot that you want to update. > * `metadata.name`: New snapshot name. > * `spec.description`: New snapshot description. ## How to delete a snapshot > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Disks** → **Snapshots**. > 2. In the line of the required snapshot, click  → **Delete**. > 3. In the window that opens, confirm the deletion. > [tab] CLI > > Run the following command: > > ```bash > nebius compute disk-snapshot delete > ``` > > To get the snapshot ID, run `nebius compute disk-snapshot list`. > [tab] Terraform > > 1. In your Terraform configuration, remove the `nebius_compute_v1_disk_snapshot` resource for the snapshot that you want to delete. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > snapshotOperation, err = sdk.Services().Compute().V1(). > DiskSnapshot().Delete( > ctx, > &compute.DeleteDiskSnapshotRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = snapshotOperation.Wait(ctx); err != nil { > return err > } > ``` > > In `DeleteDiskSnapshotRequest.Id`, specify the ID of the snapshot that you want to delete. > [tab] Python SDK > > ```python > snapshot_service = DiskSnapshotServiceClient(sdk) > delete_snapshot_operation = await snapshot_service.delete( > DeleteDiskSnapshotRequest(id=""), > ) > await delete_snapshot_operation.wait() > ``` > > In `DeleteDiskSnapshotRequest.id`, specify the ID of the snapshot that you want to delete. > [tab] JavaScript SDK > > ```ts > const deleteSnapshotService = new DiskSnapshotService(sdk); > const deleteSnapshotOperation = await deleteSnapshotService.delete( > DeleteDiskSnapshotRequest.create({ > id: "", > }), > ).result; > await deleteSnapshotOperation.wait(); > ``` > > In `DeleteDiskSnapshotRequest.id`, specify the ID of the snapshot that you want to delete. # Attaching and mounting Compute volumes to VMs Source: https://docs.nebius.com/compute/storage/use.md In this article, you will learn how to use [Compute disks and shared filesystems](https://docs.nebius.com/compute/storage/types.md) on virtual machines (VMs). > [!NOTE] > > This article only covers additional volumes: non-boot disks and shared filesystems. You add a boot disk when you create a VM. After [creating a disk](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-disk) or a [shared filesystem](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-shared-filesystem), you need to do the following to use it on a VM: 1. [Attach it to the VM](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms) by using Nebius AI Cloud interfaces. 2. [Mount it to the VM](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms) inside the VM's operating system. A VM and its volumes must be located in the same project. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to attach volumes to VMs To attach disks or shared filesystems to a VM: > [tab] Web console > > * **New VM** > > In the VM creation wizard ( **Compute** → **Virtual machines** → **Create resource** → **Virtual machine**), on the **Storage** step, do the following: > > 1. Click **Attach disk** or **Attach shared filesystem**. > > 2. Set up the volume: > > 1. Select whether you want to add a new or existing volume. > > If an existing disk is already added to another VM, you cannot add it to the new VM. A filesystem can be shared by multiple VMs. > > 2. For a new volume, set its [parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > 3. Set a device ID if you are adding a disk, or a mount tag if you are attaching a filesystem. Device IDs and mount tags are used to [mount volumes to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms). > > 3. Click the attach-volume button at the end of the window. > > > [!WARNING] > > > > When you click **Create and add disk** or **Create and attach filesystem**, the disk or filesystem is created immediately and [charged](https://docs.nebius.com/compute/resources/pricing.md#volumes) separately even if you remove it from the VM later or do not proceed with creating the VM. > > 4. If you want to [manually mount the filesystem](https://docs.nebius.com/compute/storage/use.md#shared-filesystems) that you added to the VM, turn off the **Auto mount** option for the filesystem. > > By default, Compute automatically mounts filesystems that you add to VMs via the web console. > > If you add a disk, you always need to [mount it manually](https://docs.nebius.com/compute/storage/use.md#disks). > * **Existing VM** > > **Disks** > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > > 2. On the **Standalone VMs** tab, open the page of the required VM. > > 3. Switch to the **Disks** tab. > > 4. Click **Attach resource** → **Disk**. > > 5. Select whether you want to attach a new or existing disk. > > If an existing disk is already attached to another VM, you cannot attach it to a new VM until you [detach](https://docs.nebius.com/compute/storage/detach-volume.md) it from the current VM. > > 6. For a new disk, set its [parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > 7. Set a device ID for the disk. Device IDs are used to [mount disks to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms). > > 8. Click the attach-volume button at the end of the window. > > **Shared filesystems** > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > > 2. On the **Standalone VMs** tab, open the page of the required VM. > > 3. If the VM is not in the `Stopped` status, click **Stop VM** and then confirm the action. > > 4. After the VM has the `Stopped` status, switch to the **Filesystems** tab. > > 5. Click **Attach resource** → **Filesystem**. > > 6. Select whether you want to attach a new or existing filesystem. > > A filesystem can be shared by multiple VMs. > > 7. For a new filesystem, set its [parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > 8. Set a mount tag for the filesystem. Mount tags are used to [mount filesystems to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-mount-volumes-to-vms). > > 9. Click the attach-volume button at the end of the window. > [tab] CLI > > 1. [Create the volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Create the following files locally: > > * `secondary_disk.json` to attach disks: > > ```json > [ > { > "attach_mode": "READ_WRITE", > "existing_disk": { > "id": "" > }, > "device_id": "" > } > ] > ``` > > Where: > > * Write permission. The only supported value is `READ_WRITE`. > * `existing_disk.id`: Disk ID to be added. To get the ID, run `nebius compute disk list`. > * `device_id`: Disk device ID. This parameter is different from `existing_disk.id`, as `device_id` is used for [mounting a disk to a VM](https://docs.nebius.com/compute/storage/use.md#disks). > > Create your own device ID, such as `my-disk`. Make sure that it is unique within a VM. > > If you do not specify the device ID, it takes the `disk-N` default value where `N` is an integer. For example, `disk-0`. > * `filesystem.json` to attach shared filesystems: > > ```json > [ > { > "attach_mode": "READ_WRITE", > "existing_filesystem": { > "id": "" > }, > "mount_tag": "" > } > ] > ``` > > Where: > > * Write permission. The only supported value is `READ_WRITE`. > * `existing_filesystem.id`: Filesystem ID to be attached. To get the ID, run `nebius compute filesystem list`. > * `mount_tag`: Tag for [mounting a filesystem to a VM](https://docs.nebius.com/compute/storage/use.md#shared-filesystems-cli). > > Create your own tag, such as `my-filesystem`. Make sure that it's unique within a VM. > > If you do not specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`. > > 3. Create or update a VM with the volumes configured: > > * To **create a VM**, run the following command: > > ```bash > nebius compute instance create \ > --secondary-disks "$(cat secondary_disk.json)" \ > --filesystems "$(cat filesystem.json)" \ > > ``` > > * To **attach disks to an existing VM**, run the following command: > > ```bash > nebius compute instance update \ > --patch \ > --secondary-disks "$(cat secondary_disk.json)" > ``` > > To get the ID of an existing VM, run `nebius compute instance list`. > > The `--patch` parameter allows you to only update the specified parameters. Without it, the command resets the VM settings to their default values. > > * To **attach shared filesystems to an existing VM**, stop the VM first: > > ```bash > nebius compute instance stop --id > ``` > > Then update the VM: > > ```bash > nebius compute instance update \ > --patch \ > --filesystems "$(cat filesystem.json)" > ``` > > After the update, start the VM: > > ```bash > nebius compute instance start --id > ``` > [tab] Terraform > > 1. [Create the volumes](https://docs.nebius.com/compute/storage/manage.md). > 2. Create or update a VM with the volumes configured: > > * To **create a VM**: > > 1. Create the following configuration: > > ```hcl > resource "nebius_compute_v1_instance" "" { > name = "" > parent_id = "" > resources = { > platform = "" > preset = "" > } > boot_disk = { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > } > secondary_disks = [ > { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > device_id = "" > } > ] > filesystems = [ > { > attach_mode = "READ_WRITE" > existing_filesystem = { > id = "" > } > mount_tag = "" > } > ] > network_interfaces = [ > { > name = "ni" > subnet_id = "" > ip_address = {} > public_ip_address = {} > } > ] > } > ``` > > The file contains the following parameters: > > * `name`: VM name. > > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform) where the VM is created. Use the project that contains the volumes. > > * `resources.platform` and `resources.preset`: [Platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md) of the VM. > > * `boot_disk.existing_disk.id`: ID of the boot disk. > > * `secondary_disks`: Disks to attach. Each entry contains the following parameters: > > * `attach_mode`: Attach mode. The only supported value is `READ_WRITE`. > * `existing_disk.id`: ID of the disk to be attached. > * `device_id`: Disk device ID. This parameter is different from `existing_disk.id`, as `device_id` is used for [mounting a disk to a VM](https://docs.nebius.com/compute/storage/use.md#disks). > > Create your own device ID, such as `my-disk`. Make sure that it is unique within a VM. > > If you do not specify the device ID, it takes the `disk-N` default value where `N` is an integer. For example, `disk-0`. > > * `filesystems`: Shared filesystems to attach. Each entry contains the following parameters: > > * `attach_mode`: Attach mode. The only supported value is `READ_WRITE`. > * `existing_filesystem.id`: ID of the filesystem to be attached. > * `mount_tag`: Tag for [mounting a filesystem to a VM](https://docs.nebius.com/compute/storage/use.md#shared-filesystems). > > Create your own tag, such as `my-filesystem`. Make sure that it's unique within a VM. > > If you don't specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`. > > * `network_interfaces`: Network interfaces of the VM. In `subnet_id`, specify the ID of the subnet that the VM connects to. > > For the full resource reference, see [nebius\_compute\_v1\_instance](https://docs.nebius.com/terraform-provider/reference/resources/compute_v1_instance.md). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > * To **attach disks to an existing VM**: > > 1. In the configuration file, update the `nebius_compute_v1_instance` resource: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > secondary_disks = [ > { > attach_mode = "READ_WRITE" > existing_disk = { > id = "" > } > device_id = "" > } > ] > } > ``` > > Add the disk to the `secondary_disks` list and keep the other attributes unchanged. The entry contains the same parameters as when you create a VM: `attach_mode`, `existing_disk.id`, and `device_id`. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > * To **attach shared filesystems to an existing VM**, stop the VM first: > > 1. Stop the VM: > > 1. In the configuration file, add `stopped = true` to the `nebius_compute_v1_instance` resource and keep the other attributes unchanged: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > stopped = true > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > 2. With the VM stopped, attach the filesystem: > > 1. Add the filesystem to the `filesystems` list: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > filesystems = [ > { > attach_mode = "READ_WRITE" > existing_filesystem = { > id = "" > } > mount_tag = "" > } > ] > } > ``` > > The entry contains the same parameters as when you create a VM: `attach_mode`, `existing_filesystem.id`, and `mount_tag`. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > 3. Start the VM: > > 1. Change `stopped` to `false`: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > stopped = false > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. [Create the volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Set the attachment parameters in the code examples: > > In the code examples, set the attachment parameters: > > * For disks, set the attach mode, existing disk ID, and device ID. > * For shared filesystems, set the attach mode, existing filesystem ID, and mount tag. > > Create your own mount tag, such as `my-filesystem`. Make sure that it is unique within a VM. If you do not specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`. > > 3. Create or update a VM with the volumes configured: > > * **Create a VM**: > > ```go > diskAttachMode := compute.AttachedDiskSpec_READ_WRITE > filesystemAttachMode := compute.AttachedFilesystemSpec_READ_WRITE > existingFS := &compute.ExistingFilesystem{ > Id: filesystemID, > } > fsType := &compute.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: existingFS, > } > instanceOperation, err := sdk.Services().Compute().V1(). > Instance().Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "vm-name", > }, > Spec: &compute.InstanceSpec{ > Stopped: false, > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: diskAttachMode, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: bootDiskID1, > }, > }, > }, > SecondaryDisks: []*compute.AttachedDiskSpec{ > { > AttachMode: diskAttachMode, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: additionalDiskID, > }, > }, > DeviceId: "device-0", > }, > }, > Filesystems: []*compute.AttachedFilesystemSpec{ > { > AttachMode: filesystemAttachMode, > MountTag: "mount-tag-1", > Type: fsType, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > { > Name: "ni", > SubnetId: subnetID, > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > vmID := instanceOperation.ResourceID() > ``` > > * **Attach disks to an existing VM**: > > ```go > instance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > instance.Spec.SecondaryDisks = []*compute.AttachedDiskSpec{ > { > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: additionalDiskID, > }, > }, > DeviceId: "device-0", > }, > } > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instance.Metadata, > Spec: instance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > > To get the ID of an existing VM: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List(ctx, &compute.ListInstancesRequest{}) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > When updating an existing VM, preserve the disks or shared filesystems that must stay attached. The examples replace the corresponding attachment list in the VM specification. > > * To **attach shared filesystems to an existing VM**, stop the VM first: > > ```go > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Stop( > ctx, > &compute.StopInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > > Then update the VM: > > ```go > instance, err = sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > instance.Spec.Filesystems = []*compute.AttachedFilesystemSpec{ > { > AttachMode: compute.AttachedFilesystemSpec_READ_WRITE, > MountTag: "mount-tag-1", > Type: &compute.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: &compute.ExistingFilesystem{ > Id: filesystemID, > }, > }, > }, > } > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instance.Metadata, > Spec: instance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > > When updating an existing VM, preserve the disks or shared filesystems that must stay attached. The examples replace the corresponding attachment list in the VM specification. > > After the update, start the VM: > > ```go > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Start( > ctx, > &compute.StartInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. [Create the volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Set the attachment parameters in the code examples: > > In the code examples, set the attachment parameters: > > * For disks, set the attach mode, existing disk ID, and device ID. > * For shared filesystems, set the attach mode, existing filesystem ID, and mount tag. > > Create your own mount tag, such as `my-filesystem`. Make sure that it is unique within a VM. If you do not specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`. > > 3. Create or update a VM with the volumes configured: > > * **Create a VM**: > > ```python > instance_service = InstanceServiceClient(sdk) > create_instance_operation = await instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="vm-name", > ), > spec=InstanceSpec( > stopped=False, > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=boot_disk_id_1), > ), > secondary_disks=[ > AttachedDiskSpec( > attach_mode=( > AttachedDiskSpec.AttachMode.READ_WRITE > ), > existing_disk=ExistingDisk(id=additional_disk_id), > device_id="device-0", > ), > ], > filesystems=[ > AttachedFilesystemSpec( > attach_mode=( > AttachedFilesystemSpec.AttachMode.READ_WRITE > ), > existing_filesystem=ExistingFilesystem( > id=filesystem_id, > ), > mount_tag="mount-tag-1", > ), > ], > network_interfaces=[ > NetworkInterfaceSpec( > name="ni", > subnet_id=subnet_id, > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await create_instance_operation.wait() > vm_id = create_instance_operation.resource_id > ``` > > * **Attach disks to an existing VM**: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > instance.spec.secondary_disks = [ > AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=additional_disk_id), > device_id="device-0", > ), > ] > attach_disk_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance.metadata, > spec=instance.spec, > ), > ) > await attach_disk_operation.wait() > ``` > > To get the ID of an existing VM: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list( > ListInstancesRequest(), > ) > print(instances) > ``` > > When updating an existing VM, preserve the disks or shared filesystems that must stay attached. The examples replace the corresponding attachment list in the VM specification. > > * To **attach shared filesystems to an existing VM**, stop the VM first: > > ```python > instance_service = InstanceServiceClient(sdk) > stop_instance_operation = await instance_service.stop( > StopInstanceRequest(id=""), > ) > await stop_instance_operation.wait() > ``` > > Then update the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > instance.spec.filesystems = [ > AttachedFilesystemSpec( > attach_mode=AttachedFilesystemSpec.AttachMode.READ_WRITE, > existing_filesystem=ExistingFilesystem(id=filesystem_id), > mount_tag="mount-tag-1", > ), > ] > attach_filesystem_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance.metadata, > spec=instance.spec, > ), > ) > await attach_filesystem_operation.wait() > ``` > > When updating an existing VM, preserve the disks or shared filesystems that must stay attached. The examples replace the corresponding attachment list in the VM specification. > > After the update, start the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > start_instance_operation = await instance_service.start( > StartInstanceRequest(id=""), > ) > await start_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. [Create the volumes](https://docs.nebius.com/compute/storage/manage.md). > > 2. Set the attachment parameters in the code examples: > > In the code examples, set the attachment parameters: > > * For disks, set the attach mode, existing disk ID, and device ID. > * For shared filesystems, set the attach mode, existing filesystem ID, and mount tag. > > Create your own mount tag, such as `my-filesystem`. Make sure that it is unique within a VM. If you do not specify the tag, it takes the `filesystem-N` default value where `N` is an integer. For example, `filesystem-0`. > > 3. Create or update a VM with the volumes configured: > > * **Create a VM**: > > ```ts > const createInstanceService = new InstanceService(sdk); > const createInstanceOperation = await createInstanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "vm-name", > }), > spec: InstanceSpec.create({ > stopped: false, > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: bootDiskId1, > }), > }, > }), > secondaryDisks: [ > AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "device-0", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: additionalDiskId, > }), > }, > }), > ], > filesystems: [ > AttachedFilesystemSpec.create({ > attachMode: AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "mount-tag-1", > type: { > $case: "existingFilesystem", > existingFilesystem: ExistingFilesystem.create({ > id: filesystemId, > }), > }, > }), > ], > networkInterfaces: [ > NetworkInterfaceSpec.create({ > name: "ni", > subnetId: subnetId, > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }), > ], > }), > }), > ).result; > await createInstanceOperation.wait(); > const vmId = createInstanceOperation.resourceId(); > ``` > > * **Attach disks to an existing VM**: > > ```ts > const attachDiskService = new InstanceService(sdk); > const instanceForDiskAttach = await attachDiskService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceForDiskAttach.spec) { > throw new Error("instance spec is missing"); > } > instanceForDiskAttach.spec.secondaryDisks = [ > AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "device-0", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: additionalDiskId, > }), > }, > }), > ]; > const attachDiskOperation = await attachDiskService.update( > UpdateInstanceRequest.create({ > metadata: instanceForDiskAttach.metadata, > spec: instanceForDiskAttach.spec, > }), > ).result; > await attachDiskOperation.wait(); > ``` > > To get the ID of an existing VM: > > ```ts > const listInstanceService = new InstanceService(sdk); > const instanceList = await listInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(instanceList); > ``` > > When updating an existing VM, preserve the disks or shared filesystems that must stay attached. The examples replace the corresponding attachment list in the VM specification. > > * To **attach shared filesystems to an existing VM**, stop the VM first: > > ```ts > const stopInstanceService = new InstanceService(sdk); > const stopInstanceOperation = await stopInstanceService.stop( > StopInstanceRequest.create({ > id: "", > }), > ).result; > await stopInstanceOperation.wait(); > ``` > > Then update the VM: > > ```ts > const attachFilesystemService = new InstanceService(sdk); > const instanceForFilesystemAttach = await attachFilesystemService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceForFilesystemAttach.spec) { > throw new Error("instance spec is missing"); > } > instanceForFilesystemAttach.spec.filesystems = [ > AttachedFilesystemSpec.create({ > attachMode: AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "mount-tag-1", > type: { > $case: "existingFilesystem", > existingFilesystem: ExistingFilesystem.create({ > id: filesystemId, > }), > }, > }), > ]; > const attachFilesystemOperation = await attachFilesystemService.update( > UpdateInstanceRequest.create({ > metadata: instanceForFilesystemAttach.metadata, > spec: instanceForFilesystemAttach.spec, > }), > ).result; > await attachFilesystemOperation.wait(); > ``` > > When updating an existing VM, preserve the disks or shared filesystems that must stay attached. The examples replace the corresponding attachment list in the VM specification. > > After the update, start the VM: > > ```ts > const startInstanceService = new InstanceService(sdk); > const startInstanceOperation = await startInstanceService.start( > StartInstanceRequest.create({ > id: "", > }), > ).result; > await startInstanceOperation.wait(); > ``` You can also attach a VM-managed boot disk to another VM, so you can investigate and troubleshoot this boot disk. For more information, see [How to inspect a VM and attach its boot disk to another VM](https://docs.nebius.com/compute/virtual-machines/inspect-boot-disk.md). ## How to mount volumes to VMs ### Disks 1. [Attach the disk to a VM](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms). 2. If you have not saved the disk's device ID, for example, when adding it to the VM, get it from the information about the VM: > [tab] CLI > > ```bash > nebius compute instance get --id --format json \ > | jq -r --arg disk_id \ > '.spec.secondary_disks[] > | select(.existing_disk.id == $disk_id) > | .device_id' > ``` > > To get the VM ID, run `nebius compute instance list`. To get the disk ID, run `nebius compute disk list`. > [tab] Go SDK > > ```go > instance, err = sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > deviceID := "" > for _, secondaryDisk := range instance.GetSpec().GetSecondaryDisks() { > existingDisk := secondaryDisk.GetExistingDisk() > if existingDisk != nil && existingDisk.GetId() == "" { > deviceID = secondaryDisk.GetDeviceId() > break > } > } > if deviceID == "" { > return errors.New("device ID is missing") > } > fmt.Println(deviceID) > ``` > > To get the VM ID, run: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List(ctx, &compute.ListInstancesRequest{}) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > For the disk ID, use the ID of the disk that you attached. > [tab] Python SDK > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > device_id = next( > secondary_disk.device_id > for secondary_disk in instance.spec.secondary_disks > if secondary_disk.existing_disk is not None > and secondary_disk.existing_disk.id == "" > ) > print(device_id) > ``` > > To get the VM ID, run: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list( > ListInstancesRequest(), > ) > print(instances) > ``` > > For the disk ID, use the ID of the disk that you attached. > [tab] JavaScript SDK > > ```ts > const getDeviceIdService = new InstanceService(sdk); > const instanceForDeviceLookup = await getDeviceIdService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > const deviceId = instanceForDeviceLookup.spec?.secondaryDisks.find( > (secondaryDisk) => > secondaryDisk.type?.$case === "existingDisk" && > secondaryDisk.type.existingDisk.id === "", > )?.deviceId; > if (!deviceId) { > throw new Error("device ID is missing"); > } > console.log(deviceId); > ``` > > To get the VM ID, run: > > ```ts > const listInstanceService = new InstanceService(sdk); > const instanceList = await listInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(instanceList); > ``` > > For the disk ID, use the ID of the disk that you attached. 3. [Connect to the VM over SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 4. Switch to the `root` user: ```bash sudo su - ``` 5. Partition the device. For example, you can use `cfdisk`. In the example below, we assume that you have named the device `disk-0`; for disks, all device IDs are prefixed with `virtio-`: 1. Run `cfdisk`: ```bash cfdisk /dev/disk/by-id/virtio-disk-0 ``` > [!NOTE] > > Referring to a device by its name, e.g., `/dev/vdb`, does not guarantee it will function properly. Use the device ID instead, e.g., `/dev/disk/by-id/virtio-disk-0`. 2. Under **Select label type**, select **gpt** and press **Enter**. 3. Select **New** (partition) and press **Enter**. 4. Enter the partition size and press **Enter**. This will create a `/dev/disk/by-id/virtio-disk-0-part1` partition. 5. Select **Write** (the partition table to the device) and press **Enter**, then type `yes` and press **Enter**. 6. Select **Quit** and press **Enter**. 6. Format the partition: ```bash mkfs.ext4 /dev/disk/by-id/virtio-disk-0-part1 ``` 7. Mount the partition and configure permissions for it by using `chmod`. In the example below, the partition is mounted at `/mnt/disk-0`, and all VM users are granted write access to it: ```bash mkdir /mnt/disk-0 mount /dev/disk/by-id/virtio-disk-0-part1 /mnt/disk-0 chmod a+w /mnt/disk-0 ``` 8. If you want the partition to be mounted automatically after every VM restart, add it to `/etc/fstab` by its UUID: ```bash echo "UUID=$(blkid -s UUID -o value /dev/disk/by-id/virtio-disk-0-part1) /mnt/disk-0 ext4 defaults,nofail 0 2" >> /etc/fstab ``` > [!WARNING] > > Do not omit `nofail`. If it is not specified and the VM cannot find the partition on restart (for example, the disk has been repartitioned), the VM will not boot. 9. Exit the `root` user shell: ```bash exit ``` ### Shared filesystems If you create a VM in the web console, you can automatically attach and mount a shared filesystem to the VM by using the **Auto mount** option. If you do not use it, mount the filesystem manually. To do this: 1. [Attach the shared filesystem to a VM](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms). 2. If you have not saved the filesystem's mount tag, for example, when adding it to the VM, get the mount tag from the information about the VM: > [tab] CLI > > ```bash > nebius compute instance get --id --format json \ > | jq -r --arg fs_id \ > '.spec.filesystems[] > | select(.existing_filesystem.id == $fs_id) > | .mount_tag' > ``` > > To get the VM ID, run `nebius compute instance list`. To get the filesystem ID, run `nebius compute filesystem list`. > [tab] Go SDK > > ```go > instance, err = sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > mountTag := "" > for _, filesystem := range instance.GetSpec().GetFilesystems() { > existingFilesystem := filesystem.GetExistingFilesystem() > if existingFilesystem != nil && > existingFilesystem.GetId() == "" { > mountTag = filesystem.GetMountTag() > break > } > } > if mountTag == "" { > return errors.New("mount tag is missing") > } > fmt.Println(mountTag) > ``` > > To get the VM ID, run: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List(ctx, &compute.ListInstancesRequest{}) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > For the filesystem ID, use the ID of the filesystem that you attached. > [tab] Python SDK > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > mount_tag = next( > filesystem.mount_tag > for filesystem in instance.spec.filesystems > if filesystem.existing_filesystem is not None > and filesystem.existing_filesystem.id == "" > ) > print(mount_tag) > ``` > > To get the VM ID, run: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list( > ListInstancesRequest(), > ) > print(instances) > ``` > > For the filesystem ID, use the ID of the filesystem that you attached. > [tab] JavaScript SDK > > ```ts > const getMountTagService = new InstanceService(sdk); > const instanceForMountLookup = await getMountTagService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > const mountTag = instanceForMountLookup.spec?.filesystems.find( > (filesystem) => > filesystem.type?.$case === "existingFilesystem" && > filesystem.type.existingFilesystem.id === "", > )?.mountTag; > if (!mountTag) { > throw new Error("mount tag is missing"); > } > console.log(mountTag); > ``` > > To get the VM ID, run: > > ```ts > const listInstanceService = new InstanceService(sdk); > const instanceList = await listInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(instanceList); > ``` > > For the filesystem ID, use the ID of the filesystem that you attached. 3. [Connect to the VM over SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 4. Switch to the `root` user: ```bash sudo su - ``` 5. Mount the filesystem as a `virtiofs` device and configure permissions for it by using `chmod`. In the example below, a filesystem has the mount tag `filesystem-0` and is mounted at `/mnt/fs`. All VM users are granted write access to it: ```bash mkdir /mnt/fs mount -t virtiofs filesystem-0 /mnt/fs chmod a+w /mnt/fs ``` 6. If you want the filesystem to be mounted automatically after every VM restart, add it to `/etc/fstab`: ```bash echo "filesystem-0 /mnt/fs virtiofs rw,nofail 0 0" >> /etc/fstab ``` > [!WARNING] > > Do not omit `nofail`. If it is not specified and the VM cannot find the filesystem on restart (for example, it has been deleted), the VM will not boot. 7. Exit the `root` user shell: ```bash exit ``` ## See also * [How to detach additional volumes from virtual machines](https://docs.nebius.com/compute/storage/detach-volume.md) * [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md) * [Managing Compute volumes](https://docs.nebius.com/compute/storage/manage.md) * [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md) # How to detach additional volumes from virtual machines Source: https://docs.nebius.com/compute/storage/detach-volume.md You can detach a [secondary disk](https://docs.nebius.com/compute/storage/types.md#disks) or a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems) from a VM. You cannot detach a boot disk. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## Steps ### Get the disk device ID or the filesystem mount tag > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Disks** or  **Storage** → **Shared filesystems**. > 2. Copy the device ID from the list of disks or the mount tag from the list of filesystems. > [tab] CLI > > Get the VM's specification: > > ```bash > nebius compute instance get > ``` > > Alternatively, list all VMs: > > ```bash > nebius compute instance list > ``` > > In the output, you can find device IDs of disks and mount tags of filesystems in `.spec.secondary_disks[].device_id` and `.spec.filesystems[].mount_tag`, respectively: > > ```yaml > spec: > secondary_disks: > - attach_mode: READ_WRITE > existing_disk: > id: computedisk-*** > device_id: newdisk > filesystems: > - attach_mode: READ_WRITE > existing_filesystem: > id: computefilesystem-*** > mount_tag: shared-fs > ``` > [tab] Go SDK > > Get the VM's specification: > > ```go > instance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(instance) > ``` > > Alternatively, list all VMs: > > ```go > instances, err := sdk.Services().Compute().V1(). > Instance().List(ctx, &compute.ListInstancesRequest{}) > if err != nil { > return err > } > fmt.Println(instances) > ``` > > In the output, you can find device IDs of disks and mount tags of filesystems in `.spec.secondary_disks[].device_id` and `.spec.filesystems[].mount_tag`, respectively: > > ```yaml > spec: > secondary_disks: > - attach_mode: READ_WRITE > existing_disk: > id: computedisk-*** > device_id: newdisk > filesystems: > - attach_mode: READ_WRITE > existing_filesystem: > id: computefilesystem-*** > mount_tag: shared-fs > ``` > [tab] Python SDK > > Get the VM's specification: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > print(instance) > ``` > > Alternatively, list all VMs: > > ```python > instance_service = InstanceServiceClient(sdk) > instances = await instance_service.list( > ListInstancesRequest(), > ) > print(instances) > ``` > > In the output, you can find device IDs of disks and mount tags of filesystems in `.spec.secondary_disks[].device_id` and `.spec.filesystems[].mount_tag`, respectively: > > ```yaml > spec: > secondary_disks: > - attach_mode: READ_WRITE > existing_disk: > id: computedisk-*** > device_id: newdisk > filesystems: > - attach_mode: READ_WRITE > existing_filesystem: > id: computefilesystem-*** > mount_tag: shared-fs > ``` > [tab] JavaScript SDK > > Get the VM's specification: > > ```ts > const getInstanceService = new InstanceService(sdk); > const instanceDetails = await getInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > console.log(instanceDetails); > ``` > > Alternatively, list all VMs: > > ```ts > const listInstanceService = new InstanceService(sdk); > const instanceList = await listInstanceService.list( > ListInstancesRequest.create({}), > ); > console.log(instanceList); > ``` > > In the output, you can find device IDs of disks and mount tags of filesystems in `.spec.secondary_disks[].device_id` and `.spec.filesystems[].mount_tag`, respectively: > > ```yaml > spec: > secondary_disks: > - attach_mode: READ_WRITE > existing_disk: > id: computedisk-*** > device_id: newdisk > filesystems: > - attach_mode: READ_WRITE > existing_filesystem: > id: computefilesystem-*** > mount_tag: shared-fs > ``` ### Make sure that the VM does not mount the volume when the VM restarts 1. [Connect to the VM over SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 2. Switch to the `root` user: ```bash sudo su - ``` 3. If you want to detach a secondary disk, get its UUID: ```bash blkid /dev/disk/by-id/virtio-disk-0-part1 -o export | grep "^UUID" ``` In this example, we assume that you have named the device `disk-0`; for disks, all device IDs are prefixed with `virtio-`. 4. Open `/etc/fstab` with your preferred text editor, for example, `nano /etc/fstab`, and delete the lines that refer to the volumes: * The line for a disk should start with its UUID: ```text UUID= /mnt/disk-0 ext4 defaults,nofail 0 2 ``` * The line for a filesystem should start with the filesystem's mount tag from the VM specification: ```text filesystem-0 /mnt/fs virtiofs rw,nofail 0 0 ``` In this example, the filesystem has the mount tag `filesystem-0` and is mounted at `/mnt/fs`. 5. Disconnect from the VM. ### Remove the volume from the VM specification > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > > 2. On the **Standalone VMs** tab, open the page of the required VM. > > 3. Click  **Stop VM** and then confirm it. > > > [!NOTE] > > > > You can detach a disk from a running VM, but this can cause data loss or corruption. > > 4. After the VM's status becomes `Stopped`, switch to the **Disks** or **Filesystems** tab. > > 5. Next to the disk or filesystem, click  → **Detach**. > > 6. After the volume is detached, click  **Start VM** and then confirm it. > [tab] CLI > > 1. Stop the VM: > > ```bash > nebius compute instance stop --id > ``` > > > [!NOTE] > > > > You can detach a disk from a running VM, but this can cause data loss or corruption. > > 2. Start editing the VM specification: > > ```bash > nebius compute instance edit > ``` > > 3. In the text editor that opens, remove the disk or filesystem from the `.spec.secondary_disks` or `.spec.filesystems` list, respectively. If, after that, a list becomes empty, remove it entirely. For example: > > ```diff > spec: > boot_disk: > attach_mode: READ_WRITE > device_id: "" > existing_disk: > id: computedisk-*** > - secondary_disks: > - - attach_mode: READ_WRITE > - existing_disk: > - id: computedisk-*** > - device_id: newdisk > gpu_cluster: > ... > ``` > > 4. After making the changes, save the file. The CLI updates the VM automatically. > > 5. Start the VM: > > ```bash > nebius compute instance start --id > ``` > [tab] Terraform > > 1. Stop the VM: > > 1. In the configuration file, add `stopped = true` to the `nebius_compute_v1_instance` resource and keep the other attributes unchanged: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > stopped = true > } > ``` > > > [!NOTE] > > > > You can detach a disk from a running VM, but this can cause data loss or corruption. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > 2. With the VM stopped, remove the volume from the VM specification: > > 1. Remove the disk entry from the `secondary_disks` list or the filesystem entry from the `filesystems` list. If a list becomes empty, set it to `[]`: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > # Remove the disk entry from secondary_disks > # or the filesystem entry from filesystems. > secondary_disks = [] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > 3. Start the VM: > > 1. Change `stopped` to `false`: > > ```hcl > resource "nebius_compute_v1_instance" "" { > # ... > stopped = false > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Stop the VM: > > ```go > operation, err := sdk.Services().Compute().V1(). > Instance().Stop( > ctx, > &compute.StopInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > > > [!NOTE] > > > > You can detach a disk from a running VM, but this can cause data loss or corruption. > > 2. Remove the volume from the VM's specification: > > ```go > detachInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if detachInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > secondaryDisks := detachInstance.Spec.SecondaryDisks[:0] > for _, disk := range detachInstance.Spec.SecondaryDisks { > if disk.GetDeviceId() != "" { > secondaryDisks = append(secondaryDisks, disk) > } > } > detachInstance.Spec.SecondaryDisks = secondaryDisks > filesystems := detachInstance.Spec.Filesystems[:0] > for _, filesystem := range detachInstance.Spec.Filesystems { > if filesystem.GetMountTag() != "" { > filesystems = append(filesystems, filesystem) > } > } > detachInstance.Spec.Filesystems = filesystems > detachOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: detachInstance.Metadata, > Spec: detachInstance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = detachOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, specify the VM ID, the disk's `deviceId`, or the filesystem's `mountTag`. > > 3. Start the VM: > > ```go > operation, err = sdk.Services().Compute().V1(). > Instance().Start( > ctx, > &compute.StartInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = operation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Stop the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > stop_instance_operation = await instance_service.stop( > StopInstanceRequest(id=""), > ) > await stop_instance_operation.wait() > ``` > > > [!NOTE] > > > > You can detach a disk from a running VM, but this can cause data loss or corruption. > > 2. Remove the volume from the VM's specification: > > ```python > instance_service = InstanceServiceClient(sdk) > detach_instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if detach_instance.spec is None: > raise ValueError("instance spec is missing") > detach_instance.spec.secondary_disks = [ > disk > for disk in detach_instance.spec.secondary_disks > if disk.device_id != "" > ] > detach_instance.spec.filesystems = [ > filesystem > for filesystem in detach_instance.spec.filesystems > if filesystem.mount_tag != "" > ] > detach_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=detach_instance.metadata, > spec=detach_instance.spec, > ), > ) > await detach_operation.wait() > ``` > > In the code, specify the VM ID, the disk's `device_id`, or the filesystem's `mount_tag`. > > 3. Start the VM: > > ```python > instance_service = InstanceServiceClient(sdk) > start_instance_operation = await instance_service.start( > StartInstanceRequest(id=""), > ) > await start_instance_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Stop the VM: > > ```ts > const stopInstanceService = new InstanceService(sdk); > const stopInstanceOperation = await stopInstanceService.stop( > StopInstanceRequest.create({ > id: "", > }), > ).result; > await stopInstanceOperation.wait(); > ``` > > > [!NOTE] > > > > You can detach a disk from a running VM, but this can cause data loss or corruption. > > 2. Remove the volume from the VM's specification: > > ```ts > const detachInstanceService = new InstanceService(sdk); > const detachInstance = await detachInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!detachInstance.spec) { > throw new Error("instance spec is missing"); > } > detachInstance.spec.secondaryDisks = ( > detachInstance.spec.secondaryDisks ?? [] > ).filter((disk) => disk.deviceId !== ""); > detachInstance.spec.filesystems = ( > detachInstance.spec.filesystems ?? [] > ).filter((filesystem) => filesystem.mountTag !== ""); > const detachOperation = await detachInstanceService.update( > UpdateInstanceRequest.create({ > metadata: detachInstance.metadata, > spec: detachInstance.spec, > }), > ).result; > await detachOperation.wait(); > ``` > > In the code, specify the VM ID, the disk's `deviceId`, or the filesystem's `mountTag`. > > 3. Start the VM: > > ```ts > const startInstanceService = new InstanceService(sdk); > const startInstanceOperation = await startInstanceService.start( > StartInstanceRequest.create({ > id: "", > }), > ).result; > await startInstanceOperation.wait(); > ``` You can [attach and mount](https://docs.nebius.com/compute/storage/use.md) different additional volumes to the VM later. # Exporting data from Compute disks and shared filesystems Source: https://docs.nebius.com/compute/storage/export.md You can export data from [Compute volumes](https://docs.nebius.com/compute/storage/types.md) (boot disks, additional disks, and shared filesystems) to local or virtual machines. To export the data, make sure the volume is attached to a VM, connect to the VM over SSH, and then copy the data to your machine. ## Checking whether the volume is attached to a VM Check which VMs the volume is attached to. If it isn't attached to any VM, [attach and mount it to a VM](https://docs.nebius.com/compute/storage/use.md). > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Storage** → **Disks** or **Storage** → **Shared filesystems**. > 2. Click the volume. > 3. Under **General**, check the **Virtual machine** value. It lists the VM that the volume is attached to. > [tab] CLI > > * For a disk, run `nebius compute disk list` or `nebius compute disk get `. If the disk is attached to a VM, the output contains the VM's ID in the `.status.read_write_attachment` field: > > ```yaml > status: > read_write_attachment: computeinstance-e00*** > ``` > > For more details about the commands, see the references for [nebius compute disk list](https://docs.nebius.com/cli/reference/compute/disk/list.md) and [nebius compute disk get](https://docs.nebius.com/cli/reference/compute/disk/get.md). > > * For a filesystem, run `nebius compute filesystem list` or `nebius compute filesystem get `. If the filesystem is attached to any VMs, the output lists their IDs in the `.status.read_write_attachments` field: > > ```yaml > status: > read_write_attachments: > - computeinstance-e00*** > - computeinstance-e00*** > ``` > > For more details about the commands, see the references for [nebius compute filesystem list](https://docs.nebius.com/cli/reference/compute/filesystem/list.md) and [nebius compute filesystem get](https://docs.nebius.com/cli/reference/compute/filesystem/get.md). > [tab] Go SDK > > * For a disk, get or list disks and check `disk.GetStatus().GetReadWriteAttachment()`. If the disk is attached to a VM, the response contains this VM's ID. > * For a filesystem, get or list filesystems and check `filesystem.GetStatus().GetReadWriteAttachments()`. If the filesystem is attached to any VMs, the response contains a list of their IDs. > [tab] Python SDK > > * For a disk, get or list disks and check `disk.status.read_write_attachment`. If the disk is attached to a VM, the response contains this VM's ID. > * For a filesystem, get or list filesystems and check `filesystem.status.read_write_attachments`. If the filesystem is attached to any VMs, the response contains a list of their IDs. > [tab] JavaScript SDK > > * For a disk, get or list disks and check `disk.status?.readWriteAttachment`. If the disk is attached to a VM, the response contains this VM's ID. > * For a filesystem, get or list filesystems and check `filesystem.status?.readWriteAttachments`. If the filesystem is attached to any VMs, the response contains a list of their IDs. ## Connecting to the VM Check that you can [connect over SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh) to the VM that the volume is attached to. If you can't connect to the VM, you can't copy data from the volume. Depending on the cause, try one of the following: * If the VM doesn't have a public IP address, you have the following options: * Connect to the VM's private address from another VM in the same [network](https://docs.nebius.com/vpc/overview.md#network). * Run `nebius compute instance update` with the `--network-interfaces` parameter to add a public address to the VM. For the command reference, see [nebius compute instance update](https://docs.nebius.com/cli/reference/compute/instance/update.md). * Create another VM with a public address and add the volume to it. For details and examples, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [!WARNING] > > A disk can be attached to only one running VM at a time; shared filesystems can be used by several VMs at once. To add a disk to a new VM, [detach the disk](https://docs.nebius.com/compute/storage/detach-volume.md) from the original VM if it's a secondary disk, or [attach it to another VM for troubleshooting](https://docs.nebius.com/compute/virtual-machines/inspect-boot-disk.md) if it's the boot disk. * If you haven't created this VM, ask its owner to export the data or [add you to the VM as a user](https://docs.nebius.com/compute/virtual-machines/connect.md#shared-access-to-the-vm). * For other connection issues, [contact support](https://console.nebius.com/support/create-ticket). ## Copying the data On your local machine, run a tool for copying files, for example, `rsync` or `scp`: ```bash rsync rsync @: ``` ```bash scp scp @: ``` For example, if a VM has the public IP address `195.242.11.11` and you work with it as `alice`, run the following command to recursively copy the contents of your home directory: ```bash rsync rsync -r alice@195.242.11.11:/home/alice ~/vm-home ``` ```bash scp scp -r alice@195.242.11.11:/home/alice ~/vm-home ``` For more `rsync` details and parameters, run `man rsync`. For more `scp` details and parameters, see its [manpage](https://man.openbsd.org/scp.1) or run `man scp`. # Using local SSD disks on Compute virtual machines Source: https://docs.nebius.com/compute/storage/local-disks.md Local SSD disks are Non-Volatile Memory Express (NVMe) drives physically attached to the compute host that runs a virtual machine (VM). Local SSD disks offer low-latency storage, but they are *ephemeral*. When the VM is stopped or deleted, the data is lost. ## Availability Local SSD disks are available: * Only in the `uk-south1`, `eu-west2` and `us-north1` [regions](https://docs.nebius.com/overview/regions.md). * Only on the NVIDIA® B300 NVLink platform (`gpu-b300-sxm`) with the eight-GPU preset `8gpu-192vcpu-2768gb`. The capacity of local SSD disks is fixed by the platform and preset. This configuration adds `6 × 3.84 TB` of local storage. ## How to add local SSD disks Local SSD disks can be enabled when [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). They are not created as a separate storage resource, and you cannot add them to an existing VM or change this setting later. You can create [RAID](https://en.wikipedia.org/wiki/RAID) on top of your local SSD disks, for example, to combine multiple disks into a single logical storage for higher performance or easier management. ## Lifecycle and data persistence Local SSD data persistence depends on whether the event affects the Compute VM or only the VM operating system: * If you reboot the VM operating system from inside the VM, for example by using `sudo reboot`, data is expected to persist because the Compute VM is not stopped or deleted. * If you stop or delete the VM in Compute, data on local SSD disks is lost. * If the host or a local disk fails, the Compute VM enters maintenance mode and data is lost. When a Compute VM is stopped or deleted, the local SSD disks are released and sanitized with additional cleanup checks to clear the disks of all data before reuse. ## When to use durable storage instead Use durable storage instead of local SSD disks if you need any of the following: * Data that must survive VM stop, deletion, or rescheduling events. Use [Network disks](https://docs.nebius.com/compute/storage/types.md#disks), [shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), or [Object Storage](https://docs.nebius.com/object-storage.md). * Data sharing across several VMs. Use [shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems) or [Object Storage](https://docs.nebius.com/object-storage.md). * Snapshots, backup workflows, or long-term retention. Use [Network disks](https://docs.nebius.com/compute/storage/types.md#disks), [shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), or [Object Storage](https://docs.nebius.com/object-storage.md). * User-defined capacity that is independent of the selected VM preset. Use [Network disks](https://docs.nebius.com/compute/storage/types.md#disks) or [shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems). ## See also * [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md) * [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm) * [Compute pricing](https://docs.nebius.com/compute/resources/pricing.md#local-ssd-disks) # Monitoring virtual machines in Nebius AI Cloud Source: https://docs.nebius.com/compute/monitoring/virtual-machines.md You can monitor GPUs, vCPUs and network statuses on the dashboards in the Nebius AI Cloud [web console](https://console.nebius.com). There are two ways to find the required dashboard: * Go to **Observability** → [Metrics](https://console.nebius.com/observability/metrics) and select the resource you would like to review. * Go to the page of the VM you would like to review and switch to the **Metrics** tab. Use the dashboard to monitor current resource utilization, get information to schedule [quota](https://docs.nebius.com/compute/resources/quotas-limits.md) increases and quickly identify anomalies. In case of VM issues, dashboards help the Nebius support team investigate the issue. Data for the dashboard is collected automatically. For more information about metrics collection, see [Monitoring agent on Compute virtual machines](https://docs.nebius.com/observability/agents/monitoring-agent.md). ## Explore the dashboard The VM usage data becomes available 5–10 minutes after the VM is created. Use time filters to view a specific period of usage. By default, the data is refreshed every 15 seconds. You can configure this interval next to the time filters. ## GPU monitoring metrics The corresponding [NVIDIA metrics](https://docs.nvidia.com/datacenter/dcgm/latest/dcgm-api/dcgm-api-field-ids.html) are shown next to the Nebius AI Cloud metric. * **GPU utilization** (`DCGM_FI_DEV_GPU_UTIL`) Percentage of time a GPU spends executing tasks. * **Memory utilization** (`DCGM_FI_DEV_MEM_COPY_UTIL`) Percentage of time GPU memory was in use (performing read or write tasks) in a dedicated period. * **Free frame buffer in MB** (`DCGM_FI_DEV_FB_FREE`) Amount of free frame buffer memory. * **Used frame buffer in MB** (`DCGM_FI_DEV_FB_USED`) Amount of used frame buffer memory. * **Total frame buffer of the GPU in MB** (`DCGM_FI_DEV_FB_TOTAL`) Total amount of frame buffer memory. The value doesn't change over time. * **Reserved frame buffer in MB** (`DCGM_FI_DEV_FB_RESERVED`) Amount of frame buffer memory reserved for the internal use of the hardware: drivers, firmware, etc. The value doesn't change over time. * **The number of bytes of active PCIe rx/tx** (`DCGM_FI_PROF_PCIE_RX_BYTES`, `DCGM_FI_PROF_PCIE_TX_BYTES`) Number of bytes a GPU received from (rx) or transmitted to (tx) its host VM and other devices over PCIe. Both header and payload of each PCIe packet are included. * **SM clock for the device** (`DCGM_FI_DEV_SM_CLOCK`) Frequency of the main GPU clock. * **Memory clock for the device** (`DCGM_FI_DEV_MEM_CLOCK`) Frequency and total amount of operations in time spans. * **Current clock throttle reasons** (`DCGM_FI_DEV_CLOCK_THROTTLE_REASONS`) Bitmask of [possible reasons for GPU throttling](https://docs.nvidia.com/datacenter/dcgm/2.2/dcgm-api/group__dcgmFieldConstants.html). For example, if the GPU is throttling because it has overheated and slowed down, the chart will show 72: code 0x40 for overheating (`DCGM_CLOCKS_THROTTLE_REASON_HW_THERMAL`) + code 0x8 for slowdown (`DCGM_CLOCKS_THROTTLE_REASON_HW_SLOWDOWN`) = 72 in decimal. * **Power usage for the device** (`DCGM_FI_DEV_POWER_USAGE`) Current energy consumption by a GPU in watts. * **Total energy consumption for the GPU since the driver was last reloaded** (`DCGM_FI_DEV_TOTAL_ENERGY_CONSUMPTION`) Cumulative energy consumption by a GPU since the recent driver reload in millijoules. * **Memory temperature for the device** (`DCGM_FI_DEV_MEMORY_TEMP`) Memory temperature in degrees Celsius. * **Current temperature readings for the device** (`DCGM_FI_DEV_GPU_TEMP`) GPU core temperature in degrees Celsius. * **Current power limit for the device** (`DCGM_FI_DEV_POWER_MGMT_LIMIT`) Power consumption limit after which the GPU will be throttled. The value doesn't change over time. * **Slowdown temperature for the device** (`DCGM_FI_DEV_SLOWDOWN_TEMP`) Temperature threshold after which the GPU will be throttled until it cools down. The value doesn't change over time. * **The number of bytes of active NVLink (RX/TX)**(`PROF_NVLINK_TX_BYTES`, `PROF_NVLINK_RX_BYTES`) Number of bytes a GPU received from (rx) or transmitted to (tx) its host VM and other devices over NVLink, not including protocol headers, in bytes per second. If you have a [GPU cluster](https://docs.nebius.com/compute/clusters/gpu/index.md), the following metrics become available and help monitor InfiniBand™ connection: * **Link Downed Total** Number of times the port failed to recover the link and downed it. * **Link Error Recovery Total** Number of times the port recovered the link after error. * **Port Data Total (RX/TX)** Number of bytes all GPUs received (rx) or transmitted (tx) via the port, including packets with errors. * **Port Discards TX Total** Number of transmitted packets discarded by the port when the port was down or not responding. * **Port Errors RX Total** Number of received packets with errors, including physical, mailformed data and link packet errors and overrun buffer. * **Port Packets Total (RX/TX)** Speed of receiving (rx) or transmitting (tx) packets on all GPUs, including packets with errors and excluding link packets. Calculated in packets per second. * **Transfer Rate** Data transferring speed, calculated in bytes per second. ## vCPU monitoring metrics * **CPU utilization** Percentage of time vCPUs spend executing tasks. * **RAM** Amount of total and used memory. * **Disk bytes** Average data transfer throughput of the VM's disks. Measured in bytes per second. * **Disk operations** Average IOPS of the VM's disks. Measured in operations per second. * **Network bytes** Average data transfer speed of the VM's network. Measured in bytes per second. * **Network packets** Average packets transfer speed of the VM's network. Measured in packets per second. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Viewing serial logs of virtual machines Source: https://docs.nebius.com/compute/monitoring/serial-logs.md Compute virtual machines write logs from a serial console. Serial logs may help you with troubleshooting VM startup and shutdown failures, operating system incidents, or other similar issues. Serial logs are kept for 14 days. The logs for deleted instances are also kept for 14 days, but you cannot see them in the [web console](https://docs.nebius.com/compute/monitoring/serial-logs.md#view-serial-logs-in-web-console). Use [Grafana®](https://docs.nebius.com/compute/monitoring/serial-logs.md#view-serial-logs-in-grafana) or [LogCLI](https://docs.nebius.com/compute/monitoring/serial-logs.md#query-serial-logs-with-logcli) to view logs of deleted instances. Serial logs for Compute are free of charge. ## View serial logs in web console > [tab] Web console > > To view the serial logs of a given virtual machine: > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > 2. On the **Standalone VMs** tab, select the virtual machine you need and switch to the **Serial logs** tab. > > To view all serial logs in one place: > > 1. In the sidebar, go to **Observability** → [Logs](https://console.nebius.com/observability/logs). > 2. Select the serial logs bucket. > 3. Optionally, filter the logs by virtual machine ID. ## View serial logs in Grafana® You can visualize the serial logs of services in Grafana. After you [connect Grafana](https://docs.nebius.com/observability/logs/grafana.md#how-to-connect-grafana), set the `__bucket__` label value to `sp_serial`. ## Query serial logs with LogCLI After you [set up LogCLI](https://docs.nebius.com/observability/logs/logcli.md), set the `__bucket__` label value to `sp_serial` in your queries, for example: ```bash logcli query '{__bucket__="sp_serial"}' --since 15m ``` *** *The Grafana Labs Marks are trademarks of Grafana Labs, and are used with Grafana Labs’ permission. We are not affiliated with, endorsed or sponsored by Grafana Labs or its affiliates.* # Monitoring volumes in Nebius AI Cloud Source: https://docs.nebius.com/compute/monitoring/volumes.md You can monitor disk and filesystem statuses on the dashboards in the Nebius AI Cloud [web console](https://console.nebius.com). There are two ways to find the required dashboard: * Go to **Observability** → [Metrics](https://console.nebius.com/observability/metrics) and select the resource you would like to review. * Go to the page of the resource you would like to review and switch to the **Metrics** tab. Use the dashboard to monitor current resource utilization, get information to schedule [quota](https://docs.nebius.com/compute/resources/quotas-limits.md) increases and quickly identify anomalies. In case of volume issues, dashboards help the Nebius support team investigate the issue. Data for the dashboard is collected automatically. ## Explore the dashboard The volume usage data becomes available 5–10 minutes after the volume is mounted. Use time filters to view a specific period of usage. By default, the data is refreshed every 15 seconds. You can configure this interval next to the time filters. ## Disk monitoring metrics * **Disk read latency by quantiles** Percentiles of the disk read requests latency. Measured in milliseconds. * **Disk write latency by quantiles** Percentiles of the disk write requests latency. Measured in milliseconds. * **Disk read throttler latency by quantiles** Percentiles of the disk write operations latency due to disk quota excess. Measured in milliseconds. * **Disk write throttler latency by quantiles** Percentiles of the disk write operations latency due to disk quota excess. Measured in milliseconds. * **Disk read operations** Average read IOPS. Measured in operations per second. * **Disk write operations** Average write IOPS. Measured in operations per second. * **Disk read bytes** Average read throughput. Measured in bytes per second. * **Disk write bytes** Average write throughput. Measured in bytes per second. * **Disk used quota** Percentage of disk quota on read and write operations per second utilization. ## Filesystem monitoring metrics * **Read latency by quantiles** Percentiles of the filesystem write requests latency. Measured in milliseconds. * **Write latency by quantiles** Percentiles of the filesystem read requests latency. Measured in milliseconds. * **Read operations** Average read IOPS. Measured in operations per second. * **Write operations** Average write IOPS. Measured in operations per second. * **Read bytes** Average read throughput. Measured in bytes per second. * **Write bytes** Average write throughput. Measured in bytes per second. * **Read errors** Number of times a filesystem fails to read data. * **Write errors** Number of times a filesystem fails to write data. * **Index operations** Number of indexing actions (reads, writes, updates and deletions) performed in a time period. * **Index errors** Number of failed indexing operations in a time period. # Using the serial console for virtual machines in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/serial-console.md The *serial console* is a browser-based, text-only session to your virtual machine’s serial port that you can use to connect to and troubleshoot a VM when normal network access is unavailable. You can also use it for the first-boot setup on custom or third-party images when SSH is not yet configured. > [!NOTE] > > Serial console for Compute VMs is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages). ## Prerequisites * [Add a user for connections to the VM](https://docs.nebius.com/compute/virtual-machines/create.md#optional-create-a-user-data-configuration) the serial console of which you want to access. * Make sure you are in a [default group](https://docs.nebius.com/iam/authorization/groups/index.md#default-groups) that has the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md#compute) or in a [custom group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `compute.serial-console-user` role within your tenant or project. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Using the serial console To open the serial console: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > 2. Select the virtual machine. > 3. Click **Open serial console**. > > The console opens in the browser as a dedicated terminal view. > > > [!NOTE] > > > > The serial console session is **text-only** and doesn't support a graphical interface. ## Limits and concurrent sessions Only one serial console session can be active for a given VM at a time. If someone else already has a session open, a new connection will fail until the other session ends. Be sure to close any unused console windows in your browser if you no longer need the session. ## Troubleshooting ### Resource not found In this case, the VM might be stopped. [Start the VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually) and then open the serial console again. ### Connection failed Another serial console session is already open for this VM. Coordinate with other users, or wait and try again. ### Access denied If you can't access the serial console and you don't have permission to use it, contact the administrator of your tenant. Ask them to add you to the group with at least the `compute.serial-console-user` role. ### Checking Audit Logs for serial console events [Audit Logs](https://docs.nebius.com/audit-logs/index.md) records all serial console connection attempts, including failed ones. To find these events, [filter](https://docs.nebius.com/audit-logs/events/filter.md) them by the service: `"service.name='COMPUTE_CONSOLE'"`. For failed attempts, check the event's `response.error_message` field. For example, the `Permission denied` message in the field indicates access denied. ## See also * [Connecting to virtual machines](https://docs.nebius.com/compute/virtual-machines/connect.md) * [Viewing serial logs of virtual machines](https://docs.nebius.com/compute/monitoring/serial-logs.md) # "Not enough resources" error for virtual machines in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/not-enough-resources.md Sometimes, demand for virtual machines and GPUs in certain [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md) 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. ## Error creating a VM If you receive a "Not enough resources" error when [creating a VM](https://docs.nebius.com/compute/virtual-machines/create.md) in an affected region, consider creating the VM with similar resources or in a different region. > For example, instead of creating the VM on the NVIDIA® H200 NVLink platform in the `eu-west1` region, you can try NVIDIA® H100 NVLink in `eu-north1`. For VMs with GPUs, you can use the [capacity advisor](https://docs.nebius.com/compute/virtual-machines/capacity-advisor.md) to get information about the availability of computing resources based on your quotas, the current physical capacity and, for preemptible VMs, the current [spot price](https://docs.nebius.com/signup-billing/pricing-policy.md). > [!WARNING] > > Availability of platforms and presets differs by region and project. To change the platform or preset of a VM, you might need to change its project as well. For more information about availability, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md) and [How to find out platforms and presets available in a project](https://docs.nebius.com/compute/virtual-machines/list-platforms.md). If your workload does not work with another VM platform or preset, you can request to reserve the required capacity. For more details, [contact the Nebius sales team](https://nebius.com/#ai-contact-form). ## Error restarting a stopped VM If you get a "Not enough resources" error when restarting a stopped VM in an affected region, check the [capacity advisor](https://docs.nebius.com/compute/virtual-machines/capacity-advisor.md) for detailed information on available computing resources. # CUDA initialization error on virtual machines in Nebius AI Cloud Source: https://docs.nebius.com/compute/virtual-machines/cuda-init-error.md On Compute virtual machines with GPUs, CUDA may fail to initialize in rare cases, which may lead to problems when running GPU workloads. This can happen due to various reasons, including issues with NVIDIA Fabric Manager initialization. You can resolve this issue by restarting the NVIDIA Fabric Manager service, the GPUs on the VM, or the entire VM. ## Issue On virtual machines with GPUs, CUDA may fail to initialize in rare cases, leading to errors when you run your workloads and tests. This can occur on any VM with GPUs, regardless of the specific platform, number of GPUs, or boot disk image. > For example, executing PyTorch code may result in the following error: > > ```text > ERROR: The NVIDIA Driver is present, but CUDA failed to initialize. > GPU functionality will not be available. > [[ System not yet initialized (error 802) ]] > > /usr/local/lib/python3.12/dist-packages/torch/cuda/__init__.py:129: UserWarning: > CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions > before calling NumCudaDevices() that might have already set an error? > Error 802: system not yet initialized (Triggered internally at > /opt/pytorch/pytorch/c10/cuda/CUDAFunctions.cpp:109.) > return torch._C._cuda_getDeviceCount() > 0 > ``` ## Possible cause One possible cause of CUDA initialization failures is an issue with the [NVIDIA Fabric Manager](https://docs.nvidia.com/datacenter/tesla/fabric-manager-user-guide/index.html), a component that provides NVLink and NVSwitch support for multi-GPU VMs. In rare cases, its service, `nvidia-fabricmanager`, does not initialize on VM startup because of a race condition or other timing issues. This can cause initialization issues for CUDA and GPUs on the VM. However, CUDA initialization failures can also occur due to other reasons. > [accordion] How to check nvidia-fabricmanager > > 1. [Connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md). > 2. Run the following command: > > ```bash > sudo systemctl status nvidia-fabricmanager > ``` > > If the service is not running, the `Active` line in the output indicates that: > > ```text > ○ nvidia-fabricmanager.service - NVIDIA fabric manager service > Loaded: loaded (/lib/systemd/system/nvidia-fabricmanager.service; enabled; ven> > Active: inactive (dead) since Fri 2025-05-23 07:37:49 UTC; 27s ago > Main PID: 3240 (code=exited, status=0/SUCCESS) > CPU: 787ms > ``` ## Solutions You can solve the issue on your existing VM without having to create a new VM. Try the following steps in order: 1. Start the NVIDIA Fabric Manager service: 1. [Connect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md). 2. Run the following command: ```bash sudo systemctl start nvidia-fabricmanager ``` 3. Check whether starting the service worked. To do this, you can try running your workload or get diagnostic information about the GPUs on the VM. For example, use the [NVIDIA System Management Interface](https://docs.nvidia.com/deploy/nvidia-smi/index.html) (`nvidia-smi`) to get the fabric states and statuses of the GPUs: ```bash nvidia-smi -q | grep -A 2 'Fabric' ``` In the output, all the GPUs should be in the `Completed` fabric state and the `Success` status: ```bash Fabric State : Completed Status : Success -- Fabric State : Completed Status : Success ... ``` If this step has not worked, stay connected to the VM and proceed to the next step. 2. Restart the GPUs on the VM: > [!WARNING] > > If your VM is a [Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/index.md) node (that is, its name starts with `mk8snodegroup`), skip this step and proceed to the next step. 1. Stop the services and workloads that use the GPUs. For example, if you are not running any workloads on the VM, you only need to stop the monitoring services: ```bash sudo systemctl stop nebius_observability_agent sudo systemctl stop nvidia-dcgm.service ``` 2. Run the `nvidia-smi` command that restarts GPUs: ```bash sudo nvidia-smi -r ``` This may take several minutes. You should see the following output: ```text GPU 00000000:8D:00.0 was successfully reset. GPU 00000000:91:00.0 was successfully reset. GPU 00000000:95:00.0 was successfully reset. GPU 00000000:99:00.0 was successfully reset. GPU 00000000:AB:00.0 was successfully reset. GPU 00000000:AF:00.0 was successfully reset. GPU 00000000:B3:00.0 was successfully reset. GPU 00000000:B7:00.0 was successfully reset. Note: The operation has successfully reset all GPUs and NVSwitches. If the services, such as nvidia-fabricmanager, which manage or monitor NVSwitches are running, they might have been affected by this operation. Please refer respective service status or logs for details. All done. ``` 3. Start the stopped workloads and services again. For example, to start the monitoring services, run the following command: ```bash sudo systemctl start nvidia-dcgm.service sudo systemctl start nebius_observability_agent ``` 4. Check whether restarting the GPUs worked. For example, you can run your workload or use `nvidia-smi`: ```bash nvidia-smi -q | grep -A 2 'Fabric' ``` If the step has not worked, e.g. there are GPUs that are not in the `Completed` fabric state and the `Success` status, proceed to the next step. 3. [Restart the VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md). After that, [connect to it](https://docs.nebius.com/compute/virtual-machines/connect.md) and then check whether restarting the VM worked. For example, you can run your workload or use `nvidia-smi`: ```bash nvidia-smi -q | grep -A 2 'Fabric' ``` If the step has not worked, e.g. there are GPUs that are not in the `Completed` fabric state and the `Success` status, [contact support](https://console.nebius.com/support/create-ticket). # Charging for a virtual machine that was stopped by using Linux commands Source: https://docs.nebius.com/compute/virtual-machines/stopped-with-linux-commands.md If you connect to your virtual machine (VM) and shut it down by using Linux commands (for example, `shutdown` or `halt`), the VM is not stopped properly. Compute automatically reboots the VM and continues charging you for it. The service considers such a shutdown as a failure and therefore runs the recovery policy. To stop a VM properly, use Nebius AI Cloud interfaces, for instance, the web console or a CLI command. Then, the VM is stopped reliably, and you are not charged for it. For more information, see [How to stop and start Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/stop-start.md). # How to collect diagnostic logs from Compute virtual machines Source: https://docs.nebius.com/compute/virtual-machines/logs.md *Diagnostic logs* from Compute virtual machines (VMs) help you troubleshoot issues with VM operations, networking, and workloads. We strongly recommend collecting logs while the issue is still occurring, because they capture more information about the broken state than logs collected after the issue has been resolved. ## Types of logs This guide describes how to collect the following types of logs for troubleshooting: * GPU logs: `nvidia-bug-report.sh`. * General system logs, including more context about system services and package versions: `sos report`. * [NVIDIA® Mellanox®](https://www.nvidia.com/en-us/networking/management-software/) adapter (InfiniBand™/NVSwitch/Ethernet) logs: `sysinfo-snapshot`. ## Prerequisites Make sure that you have configured [SSH access to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md). ## How to collect logs 1. [Connect to the VM by using SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 2. Generate GPU logs: ```bash sudo nvidia-bug-report.sh ``` This command usually runs for about five minutes and generates `nvidia-bug-report.log.gz` in the current working directory. If the command stops responding, run it in safe mode: ```bash sudo nvidia-bug-report.sh --safe-mode ``` 3. If you need more system information, generate general system logs: ```bash sudo sos report --batch ``` This command generates an archive in the following format: `/tmp/sosreport---.tar.gz`. 4. If you are troubleshooting Mellanox adapter issues, generate Mellanox adapter logs: ```bash sudo /opt/nebius/sysinfo-snapshot ``` This command generates an archive in the following format: `/tmp/sysinfo-snapshot---.tgz`. ## How to get generated log files 1. Check that the files were generated on your VM by running the following commands: * To check for GPU logs: ```bash ls nvidia-bug-report.log.gz ``` * To check for general system logs or Mellanox adapter logs: ```bash ls /tmp ``` 2. From your local shell, run the following command to copy the files from the VM to the current directory: ```bash scp -i ~/.ssh/id_ed25519 @: . ``` In the command, specify the path to the generated file on the VM, for example: `nvidia-bug-report.log.gz`, `/tmp/sosreport-*.tar.gz` or `/tmp/sysinfo-snapshot-*.tgz`. If copying files from the `/tmp` directory fails due to a permission error, this usually means the generated file is owned by root. To fix this issue, proceed to the next step. 3. [Reconnect to the VM](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh) and set permissions to grant read access to non-root users. After that, you can rerun the `scp` command. > [!NOTE] > > If you successfully copied the generated log file, skip this step. ```bash sudo chmod 644 ``` In the command, set the `remote_file_path` to `/tmp/sosreport-*.tar.gz` or `/tmp/sysinfo-snapshot-*.tgz`. 4. Find the copied log files in your local directory. ## See also * [How to inspect a VM and attach its boot disk to another VM](https://docs.nebius.com/compute/virtual-machines/inspect-boot-disk.md) * [Support tickets: sending questions, bug reports and feature requests](https://docs.nebius.com/overview/support.md) *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Virtual machine is unreachable due to a Docker subnet conflict Source: https://docs.nebius.com/compute/virtual-machines/docker-subnet-conflict.md Virtual machines (VMs) running Docker cannot reach remote private IPv4 addresses in the `172.17.0.0/16` CIDR block. If you assign an address from this range to a VM, other VMs that run Docker cannot reach this address. Since the default boot disk images come with Docker preinstalled, this affects most VMs in the [network](https://docs.nebius.com/vpc/overview.md#network). This happens because Docker uses `172.17.0.0/16` for its default bridge network and adds a kernel route for that range on every host where it runs. When a VM running Docker sends traffic to an address in this range, the route directs the packets to the local Docker bridge instead of the network interface, so they never leave the VM or reach the network. To resolve the conflict, do one of the following: * [Assign the VM a subnet](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md) outside `172.17.0.0/16`. * Reconfigure the default Docker bridge to use a non-overlapping range. To do this, on every VM that runs Docker and needs to reach an address in `172.17.0.0/16`, add the following parameters to the [cloud-init configuration](https://docs.nebius.com/compute/virtual-machines/create.md#optional-create-a-user-data-configuration): ```yaml write_files: - path: /etc/docker/daemon.json content: | { "bip": "192.168.200.1/24" } owner: root:root permissions: '0644' runcmd: - systemctl restart docker ``` The `bip` value sets the subnet of the default Docker bridge. Replace `192.168.200.1/24` with any range that does not overlap with the private IP addresses used in your network. For more information about configuring the default Docker bridge, see the [Docker bridge network driver](https://docs.docker.com/engine/network/drivers/bridge/) documentation. #### See also * [Private and public IP addresses of Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/network.md) * [Ranges of private IP addresses per region for a default private pool](https://docs.nebius.com/vpc/addressing/available-addresses.md) # How to inspect a VM and attach its boot disk to another VM Source: https://docs.nebius.com/compute/virtual-machines/inspect-boot-disk.md If a virtual machine (VM) does not start or you cannot connect to it, you can attach its boot disk to another VM as a secondary disk and inspect the boot disk from there. To do this: 1. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md) for debugging in the same project as the boot disk you want to inspect. [Set up the SSH connection](https://docs.nebius.com/compute/virtual-machines/connect.md#set-up-the-vm) to your new VM. 2. [Stop the original VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually) that you want to inspect. Otherwise, you can't attach its boot disk to another VM. 3. Get the ID of the original VM's boot disk: > [tab] CLI > > ```bash > nebius compute instance get --id \ > --format jsonpath='.spec.boot_disk.existing_disk.id' > ``` > [tab] Go SDK > > ```go > originalInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if originalInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > bootDisk := originalInstance.GetSpec().GetBootDisk() > if bootDisk == nil || bootDisk.GetExistingDisk() == nil { > return errors.New("boot disk is missing") > } > fmt.Println(bootDisk.GetExistingDisk().GetId()) > ``` > > Save the boot disk ID from the output as `originalBootDiskID`. > [tab] Python SDK > > ```python > instance_service = InstanceServiceClient(sdk) > original_instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if original_instance.spec is None: > raise ValueError("instance spec is missing") > boot_disk = original_instance.spec.boot_disk > if boot_disk is None or boot_disk.existing_disk is None: > raise ValueError("boot disk is missing") > print(boot_disk.existing_disk.id) > ``` > > Save the boot disk ID from the output as `original_boot_disk_id`. > [tab] JavaScript SDK > > ```ts > const getOriginalInstanceService = new InstanceService(sdk); > const originalInstance = await getOriginalInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > const originalBootDisk = originalInstance.spec?.bootDisk; > const bootDiskId = originalBootDisk?.type?.$case === "existingDisk" > ? originalBootDisk.type.existingDisk.id > : undefined; > if (!bootDiskId) { > throw new Error("boot disk is missing"); > } > console.log(bootDiskId); > ``` > > Save the boot disk ID from the output as `originalBootDiskId`. 4. Attach the boot disk to the debug VM as a secondary disk: > [tab] CLI > > ```bash > nebius compute instance update \ > --patch \ > --secondary-disks '[{"existing_disk": {"id": ""}, "attach_mode": "READ_WRITE", "device_id": "original-boot-disk"}]' > ``` > [tab] Go SDK > > In the code, specify the debug VM ID and use the `originalBootDiskID` value from the previous step: > > ```go > instance, err = sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if instance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > instance.Spec.SecondaryDisks = []*compute.AttachedDiskSpec{ > { > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: originalBootDiskID, > }, > }, > DeviceId: "original-boot-disk", > }, > } > instanceOperation, err = sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: instance.Metadata, > Spec: instance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = instanceOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > In the code, specify the debug VM ID and use the `original_boot_disk_id` value from the previous step: > > ```python > instance_service = InstanceServiceClient(sdk) > instance = await instance_service.get( > GetInstanceRequest(id=""), > ) > if instance.spec is None: > raise ValueError("instance spec is missing") > instance.spec.secondary_disks = [ > AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk(id=original_boot_disk_id), > device_id="original-boot-disk", > ), > ] > attach_boot_disk_operation = await instance_service.update( > UpdateInstanceRequest( > metadata=instance.metadata, > spec=instance.spec, > ), > ) > await attach_boot_disk_operation.wait() > ``` > [tab] JavaScript SDK > > In the code, specify the debug VM ID and use the `originalBootDiskId` value from the previous step: > > ```ts > const attachBootDiskService = new InstanceService(sdk); > const instanceForBootDiskAttach = > await attachBootDiskService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!instanceForBootDiskAttach.spec) { > throw new Error("instance spec is missing"); > } > instanceForBootDiskAttach.spec.secondaryDisks = [ > AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > deviceId: "original-boot-disk", > type: { > $case: "existingDisk", > existingDisk: ExistingDisk.create({ > id: originalBootDiskId, > }), > }, > }), > ]; > const attachBootDiskOperation = > await attachBootDiskService.update( > UpdateInstanceRequest.create({ > metadata: instanceForBootDiskAttach.metadata, > spec: instanceForBootDiskAttach.spec, > }), > ).result; > await attachBootDiskOperation.wait(); > ``` 5. [Connect to the debug VM by using SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 6. List the partitions and filesystems on the boot disk: ```bash lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS /dev/disk/by-id/virtio-original-boot-disk ``` 7. Mount the filesystem you need to inspect. The root filesystem is on the largest ext4 (or xfs) partition — usually `-part1`. To mount it: ```bash sudo mkdir -p /mnt/original-boot-disk sudo mount -o ro /dev/disk/by-id/virtio-original-boot-disk-part1 /mnt/original-boot-disk ``` For safety, use the `-o ro` parameter to mount the filesystem in read-only mode. This prevents any accidental changes to the boot disk you are inspecting. 8. (Optional) If you need to repair the filesystem by writing to it, remount it in read-write mode: ```bash sudo mount -o remount,rw /mnt/original-boot-disk ``` 9. When done inspecting, unmount the filesystem: ```bash sudo umount /mnt/original-boot-disk ``` 10. [Detach](https://docs.nebius.com/compute/storage/detach-volume.md#remove-the-volume-from-the-vm-specification) the boot disk of the original VM from the debug VM. 11. After the disk is detached, [start the original VM](https://docs.nebius.com/compute/virtual-machines/stop-start.md#how-to-stop-and-start-vms-manually). You can't start the VM if its boot disk is attached to another running VM. ## See also * [How to collect diagnostic logs from Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/logs.md) * [Viewing serial logs of virtual machines](https://docs.nebius.com/compute/monitoring/serial-logs.md) * [How to detach additional volumes from virtual machines](https://docs.nebius.com/compute/storage/detach-volume.md) * [Attaching and mounting Compute volumes to VMs](https://docs.nebius.com/compute/storage/use.md) # Quotas in Compute Source: https://docs.nebius.com/compute/resources/quotas-limits.md Compute has quotas on virtual machines (VMs), storage and InfiniBand™ usage. For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). Compute quota values depend on your [quota tier](https://docs.nebius.com/overview/quotas.md#quota-tiers). When the default and full values of a quota differ, the **Tier** column shows a separate row for each tier. **All** means the same value applies to all tiers. ## Virtual machines A VM and its resources count toward the quotas throughout the VM's lifecycle, from its creation to deletion, regardless of whether it is running or stopped. These quotas apply to Compute VMs and also to Managed Service for Soperator and Managed Service for Kubernetes® nodes, which are based on Compute VMs. ### All virtual machines | Quota name | Tier | `eu-north1` | `eu-west1` | `me-west1` | `us-central1` | `uk-south1` | `uk-south2` | `eu-north2` | `eu-south1` | `eu-west2` | `us-north1` | | - | - | - | - | - | - | - | - | - | - | - | - | | [Regular VMs](https://docs.nebius.com/compute/virtual-machines/create.md) | Default | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | | | Full | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | | [Preemptible VMs](https://docs.nebius.com/compute/virtual-machines/preemptible.md) | Default | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | | | Full | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | ### GPU virtual machines These quotas limit the number of NVIDIA® GPUs attached to regular VMs. GPUs allocated from [reservations](https://docs.nebius.com/compute/virtual-machines/reservations.md) don't count towards them. | Quota name | Tier | `eu-north1` | `eu-west1` | `me-west1` | `us-central1` | `uk-south1` | `uk-south2` | `eu-north2` | `eu-south1` | `eu-west2` | `us-north1` | | - | - | - | - | - | - | - | - | - | - | - | - | | Total NVIDIA® B300 GPUs for regular VMs without reservations | All | *N/A* | *N/A* | *N/A* | *N/A* | 0 | *N/A* | *N/A* | *N/A* | 0 | 0 | | Total NVIDIA® B200 GPUs for regular VMs without reservations | All | *N/A* | *N/A* | 0 | 0 | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | | Total NVIDIA® H200 GPUs for regular VMs without reservations | Default | 8 | 8 | *N/A* | 8 | *N/A* | *N/A* | 0 | *N/A* | *N/A* | *N/A* | | | Full | 32 | 32 | *N/A* | 32 | *N/A* | *N/A* | 0 | *N/A* | *N/A* | *N/A* | | Total NVIDIA® H100 GPUs for regular VMs without reservations | Default | 8 | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | | | Full | 32 | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | | Total NVIDIA® RTX PRO™ 6000 GPUs for regular VMs without reservations | Default | *N/A* | *N/A* | *N/A* | 8 | *N/A* | 8 | *N/A* | 8 | *N/A* | *N/A* | | | Full | *N/A* | *N/A* | *N/A* | 32 | *N/A* | 32 | *N/A* | 32 | *N/A* | *N/A* | | Total NVIDIA® L40S GPUs for regular VMs without reservations | Default | 8 | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | | | Full | 32 | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | *N/A* | ### Non-GPU virtual machines | Quota name | Tier | `eu-north1` | `eu-west1` | `me-west1` | `us-central1` | `uk-south1` | `uk-south2` | `eu-north2` | `eu-south1` | `eu-west2` | `us-north1` | | - | - | - | - | - | - | - | - | - | - | - | - | | Total vCPUs for non-GPU VMs | All | 0 | 200 | 200 | 0 | 200 | 200 | 0 | 200 | 200 | 200 | ## Storage | Quota name | Tier | `eu-north1` | `eu-west1` | `us-central1`, `me-west1`, `uk-south1`, `uk-south2`, `eu-west2`, `us-north1` | `eu-south1` | `eu-north2` | | - | - | - | - | - | - | - | | Disks | Default | 4 | 4 | 4 | 4 | 4 | | | Full | 20 | 20 | 20 | 20 | 20 | | Total disk capacity (Network SSD) | All | 4 TiB | 2 TiB | 5 TiB | 5 TiB | 2 TiB | | Total disk capacity (Network SSD Non-replicated) | All | 4 TiB | 2 TiB | 5 TiB | 5 TiB | 2 TiB | | Total disk capacity (Network SSD IO M3) | All | 4 TiB | 2 TiB | 5 TiB | 5 TiB | 0 | | Shared filesystems | Default | 32 | 32 | 32 | 32 | 1 | | | Full | 32 | 32 | 32 | 32 | 4 | | Total shared filesystem capacity | All | 4 TiB | 2 TiB | 5 TiB | 5 TiB | 2 TiB | | Number of images | All | 5 | 5 | 5 | 5 | 5 | | Total storage capacity of all images | All | 500 GiB | 500 GiB | 500 GiB | 500 GiB | 500 GiB | | Total number of disk snapshots | All | 32 | 32 | 32 | 32 | 32 | | Total storage capacity of all disk snapshots | All | 1 TiB | 1 TiB | 1 TiB | 1 TiB | 1 TiB | ## InfiniBand GPU cluster quotas apply to Compute GPU clusters and GPU clusters used by Managed Soperator or Managed Kubernetes. | Quota name | Tier | `eu-north1`, `eu-west1`, `me-west1`, `us-central1`, `uk-south1`, `uk-south2`, `eu-south1`, `eu-west2`, `us-north1` | `eu-north2` | | - | - | - | - | | Number of GPU clusters | All | 5 | 0 | ## Network See [Quotas in Virtual Networks](https://docs.nebius.com/vpc/resources/quotas-limits.md). ## Quota usage recommendations Best practices for using VM quotas: * When you create new VMs, calculate your available quotas, even if you plan to keep the VMs mostly in a stopped state. * From time to time, review and delete unused VMs to free up quotas. * If you need to temporarily free up VM resources, delete VMs instead of just stopping them. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Compute pricing in Nebius AI Cloud Source: https://docs.nebius.com/compute/resources/pricing.md This article provides detailed pricing for the Compute service in Nebius AI Cloud. ## How charges and prices work Each group of chargeable items in this article has two time units associated with it: * **Billing unit**: Minimum unit of usage for which you can be charged. * **Pricing unit**: Unit of usage for which the prices are shown. Charges for units smaller than the pricing unit are calculated proportionally. > For example, for GPUs on running VMs, the **billing unit** is 1 second, and the **pricing unit** is 1 hour (3600 seconds). For 30 minutes of usage, you will be charged half the hourly price. Prices in US dollars (USD, \$) apply to all customers except for companies from Israel, where prices in Israeli shekels (ILS, ₪) apply instead. All prices are shown without any applicable taxes, including VAT. Due to rounding errors, usage costs shown in the web console and final charges may slightly differ from calculations based on the prices in this article. ## Prices ### Virtual machines (GPUs, vCPUs, RAM) You are charged for computing resources (GPUs, vCPUs, RAM) of running virtual machines (VMs). Computing resources of stopped VMs are not charged (this does not apply to storage volumes; see [Volumes (disks and shared filesystems)](https://docs.nebius.com/compute/resources/pricing.md#volumes)). * **Billing unit**: 1 second * **Pricing unit**: 1 hour (3600 seconds) > [!NOTE] > > Spot prices for preemptible GPU platforms are dynamic: they can increase or decrease based on available capacity, cluster utilization, customer demand, and pricing preferences, and can change during use as often as every 15 minutes. Spot prices aren't capped and can rise above the on-demand service rates listed on this page. To limit the price you pay, set a max price in a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md). For current and historical spot prices, see [Getting spot prices](https://docs.nebius.com/signup-billing/spot-prices.md). #### NVIDIA® B300 NVLink, gpu-b300-sxm The platform is only available in the `uk-south1`, `eu-west2` and `us-north1` [regions](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® B300 NVLink | \$9.50 | 1 GPU hour | > | Preemptible NVIDIA® B300 NVLink | [From \$0.99](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® B300 NVLink | ₪29.45 | 1 GPU hour | > | Preemptible NVIDIA® B300 NVLink | [From ₪3.069](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® B200 NVLink, gpu-b200-sxm The platform is only available in the `us-central1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® B200 NVLink | \$8.50 | 1 GPU hour | > | Preemptible NVIDIA® B200 NVLink | [From \$0.99](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® B200 NVLink | ₪26.35 | 1 GPU hour | > | Preemptible NVIDIA® B200 NVLink | [From ₪3.069](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® B200 NVLink, gpu-b200-sxm-a The platform is only available in the `me-west1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® B200 NVLink | \$8.50 | 1 GPU hour | > | Preemptible NVIDIA® B200 NVLink | [From \$0.99](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® B200 NVLink | ₪26.35 | 1 GPU hour | > | Preemptible NVIDIA® B200 NVLink | [From ₪3.069](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® H200 NVLink The platform is available in the `eu-north1`, `eu-north2`, `eu-west1`, and `us-central1` [regions](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® H200 NVLink | \$5.40 | 1 GPU hour | > | Preemptible NVIDIA® H200 NVLink | [From \$0.79](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® H200 NVLink | ₪16.74 | 1 GPU hour | > | Preemptible NVIDIA® H200 NVLink | [From ₪2.449](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® H100 NVLink The platform is only available in the `eu-north1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® H100 NVLink | \$4.50 | 1 GPU hour | > | Preemptible NVIDIA® H100 NVLink | [From \$0.79](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® H100 NVLink | ₪13.95 | 1 GPU hour | > | Preemptible NVIDIA® H100 NVLink | [From ₪2.449](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® RTX PRO™ 6000, gpu-rtx6000 The platform is only available in the `us-central1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® RTX PRO™ 6000 | \$1.80 | 1 GPU hour | > | Preemptible NVIDIA® RTX PRO™ 6000 | [From \$0.79](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® RTX PRO™ 6000 | ₪5.58 | 1 GPU hour | > | Preemptible NVIDIA® RTX PRO™ 6000 | [From ₪2.449](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® RTX PRO™ 6000, gpu-rtx6000-a The platform is only available in the `uk-south2` and `eu-south1` [regions](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® RTX PRO™ 6000 | \$1.80 | 1 GPU hour | > | Preemptible NVIDIA® RTX PRO™ 6000 | [From \$0.79](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® RTX PRO™ 6000 | ₪5.58 | 1 GPU hour | > | Preemptible NVIDIA® RTX PRO™ 6000 | [From ₪2.449](https://docs.nebius.com/signup-billing/pricing-policy.md) | 1 GPU hour | #### NVIDIA® L40S Intel The platform is only available in the `eu-north1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® L40S Intel. GPU | \$1.35 | 1 GPU hour | > | NVIDIA® L40S Intel. CPU | \$0.012 | 1 CPU hour | > | NVIDIA® L40S Intel. RAM | \$0.0032 | 1 GiB hour | > | Preemptible NVIDIA® L40S Intel. GPU | \$0.65 | 1 GPU hour | > | Preemptible NVIDIA® L40S Intel. CPU | \$0.006 | 1 CPU hour | > | Preemptible NVIDIA® L40S Intel. RAM | \$0.0016 | 1 GiB hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® L40S Intel. GPU | ₪4.185 | 1 GPU hour | > | NVIDIA® L40S Intel. CPU | ₪0.0372 | 1 CPU hour | > | NVIDIA® L40S Intel. RAM | ₪0.00992 | 1 GiB hour | > | Preemptible NVIDIA® L40S Intel. GPU | ₪2.015 | 1 GPU hour | > | Preemptible NVIDIA® L40S Intel. CPU | ₪0.0186 | 1 CPU hour | > | Preemptible NVIDIA® L40S Intel. RAM | ₪0.00496 | 1 GiB hour | #### NVIDIA® L40S AMD The platform is only available for projects in the `eu-north1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® L40S AMD. GPU | \$1.35 | 1 GPU hour | > | NVIDIA® L40S AMD. CPU | \$0.01 | 1 CPU hour | > | NVIDIA® L40S AMD. RAM | \$0.0032 | 1 GiB hour | > | Preemptible NVIDIA® L40S AMD. GPU | \$0.65 | 1 GPU hour | > | Preemptible NVIDIA® L40S AMD. CPU | \$0.005 | 1 CPU hour | > | Preemptible NVIDIA® L40S AMD. RAM | \$0.0016 | 1 GiB hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | NVIDIA® L40S AMD. GPU | ₪4.185 | 1 GPU hour | > | NVIDIA® L40S AMD. CPU | ₪0.031 | 1 CPU hour | > | NVIDIA® L40S AMD. RAM | ₪0.00992 | 1 GiB hour | > | Preemptible NVIDIA® L40S AMD. GPU | ₪2.015 | 1 GPU hour | > | Preemptible NVIDIA® L40S AMD. CPU | ₪0.0155 | 1 CPU hour | > | Preemptible NVIDIA® L40S AMD. RAM | ₪0.00496 | 1 GiB hour | #### Non-GPU AMD Epyc Genoa The platform is available in all [regions](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | Non-GPU AMD Epyc Genoa. CPU | \$0.015 | 1 CPU hour | > | Non-GPU AMD Epyc Genoa. RAM | \$0.0045 | 1 GiB hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | Non-GPU AMD Epyc Genoa. CPU | ₪0.0465 | 1 CPU hour | > | Non-GPU AMD Epyc Genoa. RAM | ₪0.01395 | 1 GiB hour | #### Non-GPU Intel Ice Lake The platform is only available in the `eu-north1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | **Item** | **Price** | **Per** | > | - | - | - | > | Non-GPU Intel Ice Lake. CPU | \$0.012 | 1 CPU hour | > | Non-GPU Intel Ice Lake. RAM | \$0.0045 | 1 GiB hour | > [tab] ILS > > | **Item** | **Price** | **Per** | > | - | - | - | > | Non-GPU Intel Ice Lake. CPU | ₪0.0372 | 1 CPU hour | > | Non-GPU Intel Ice Lake. RAM | ₪0.01395 | 1 GiB hour | ### Volumes You are charged for existing volumes (disks, disk snapshots and shared filesystems), regardless of whether they are added to VMs. Charges are based on volume sizes, regardless of how much space is taken up on a volume. * **Billing unit**: 1 byte per 1 second * **Pricing unit**: 1 GiB per 730 hours (230 bytes per 2,628,000 seconds \~ 1 month) #### Disks > [tab] USD > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Network SSD disk | \$0.071 | > | Network SSD Non-replicated disk | \$0.053 | > | Network SSD IO M3 disk | \$0.118 | > [tab] ILS > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Network SSD disk | ₪0.221 | > | Network SSD Non-replicated disk | ₪0.164 | > | Network SSD IO M3 disk | ₪0.366 | #### Disk snapshots > [tab] USD > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Disk snapshot | \$0.071 | > [tab] ILS > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Disk snapshot | ₪0.22 | #### Shared filesystems > [tab] USD > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Shared Filesystem SSD | \$0.08 | > [tab] ILS > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Shared Filesystem SSD | ₪0.248 | #### Local SSD disks > [tab] USD > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Local SSD disk | \$0.065 | > [tab] ILS > > | **Item** | **Price per 1 GiB per 730 hours** | > | - | - | > | Local SSD disk | ₪0.2015 | Local SSD disks have finite write endurance defined by the manufacturer's Terabytes Written (TBW) rating. Workloads should not write more than the disk's total capacity per day. If a workload writes more data to a local SSD disk in a single day than the disk's total capacity, it exceeds the recommended write-endurance threshold. If you expect your workload to exceed this threshold, [contact support](https://console.nebius.com/support/create-ticket) in advance to discuss capacity planning. ### Slurm and Soperator in Nebius AI Cloud # Slurm and Soperator in Nebius AI Cloud Source: https://docs.nebius.com/slurm-soperator/index.md Soperator is an [open-source solution from Nebius](https://github.com/nebius/soperator) that allows you to consolidate Slurm and Kubernetes® into a single infrastructure. You can manage nodes by using standard Kubernetes resources and run machine learning experiments by using Slurm. You can use Soperator in the following different environments: * [Managed Service for Soperator](https://docs.nebius.com/slurm-soperator/deploy/overview.md#managed-service-for-soperator): Nebius AI Cloud service * [Pro Solution for Soperator](https://docs.nebius.com/slurm-soperator/deploy/overview.md#pro-solution-for-soperator): deployed by Nebius solution architects on Nebius AI Cloud * [Self-deployment on a Managed Service for Kubernetes cluster](https://docs.nebius.com/slurm-soperator/deploy/overview.md#self-deployment-in-nebius-ai-cloud) * [Other cloud platforms and on-premises](https://docs.nebius.com/slurm-soperator/deploy/overview.md#self-deployment-on-other-platforms-and-on-premises) *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* > [card] [About Slurm and Soperator](https://docs.nebius.com/slurm-soperator/overview/why-slurm-soperator.md) > > Get acquainted with key Soperator features > [card] [Deploying Soperator clusters](https://docs.nebius.com/slurm-soperator/deploy/overview.md) > > Choose a deployment method that fits your use case best > [card] [Creating clusters in Managed Service for Soperator](https://docs.nebius.com/slurm-soperator/managed-soperator/manage.md) > > Get started with Slurm and Soperator in Nebius AI Cloud with minimum effort > [card] [Connecting to Slurm nodes](https://docs.nebius.com/slurm-soperator/clusters/connect.md) > > Connect to login and worker nodes, so you can start managing machine learning workloads > [card] [Running batch jobs](https://docs.nebius.com/slurm-soperator/jobs/index.md) > > Define, configure, and launch your workloads in Slurm > [card] [Managing jobs and queue](https://docs.nebius.com/slurm-soperator/jobs/manage.md) > > View and control current and historical jobs > [card] [Running the all-reduce NCCL test](https://docs.nebius.com/slurm-soperator/jobs/examples/nccl-all-reduce.md) > > Check the NVLink and InfiniBand™ performance between GPUs on one or multiple nodes > [card] [Managing users](https://docs.nebius.com/slurm-soperator/users/manage.md) > > Create users, so they can connect to Slurm nodes > [card] [Monitoring job and node statuses](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md) > > Get up-to-date information about Slurm jobs and nodes > [card] [Ephemeral nodes](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md) > > Reuse reserved GPU capacity across training and inference workloads # Combining Slurm and Kubernetes by using Soperator Source: https://docs.nebius.com/slurm-soperator/overview/why-slurm-soperator.md [Slurm](https://slurm.schedmd.com) is widely used for managing machine learning (ML) workloads. It is dedicated to efficient resource management, allowing you to split large jobs into many steps, then run them in parallel for distributed ML training. But Slurm is not cloud-native. [Kubernetes®](https://kubernetes.io/) complements Slurm, as it provides auto-scaling and self-healing capabilities. However, Kubernetes is not tailored to model training needs. Features that Slurm and Kubernetes provide could be combined for an optimal solution. [Soperator](https://github.com/nebius/soperator) is an open-source Kubernetes operator that solves this problem. It runs Slurm nodes as Kubernetes Pods. A Soperator cluster is based on a Kubernetes cluster and uses Slurm as an additional infrastructure layer. Nebius AI Cloud offers [options to deploy Soperator clusters](https://docs.nebius.com/slurm-soperator/deploy/overview.md) that provide high availability and automatic scaling, to save computing resources and costs. ## Features of a Soperator cluster ### Easy scaling Thanks to the Kubernetes infrastructure layer, a Soperator cluster scales automatically to your current workload. This allows you to have sufficient resources during the compute-heavy stages of building your project and scale down when you do not need to use — and pay for — as much computing power. ### High availability The underlying Kubernetes cluster already has self-healing capabilities, such as automatic Pod restart. In addition, Soperator continuously monitors the state of the cluster and compares it to the configuration declared in the YAML manifests of Kubernetes resources. If there are any discrepancies, Soperator restores the configuration. ### Unified storage All login and worker nodes share the same root filesystem. This lets you work with a Soperator cluster in the same way as with other Slurm installations, such as an on-premises cluster. For example, you can run jobs with `sbatch` without any need to run each job in a container. With the shared filesystem, you do not need to keep nodes synchronized, because they have an identical state by default. The changes that you make on one node are spread across all other nodes. For example, these changes can include the installation of packages, the download of datasets, or adding Linux users. ### Secure environment User actions are isolated in a dedicated container-like environment. This ensures that users cannot accidentally interfere with the cluster configuration. ### Out-of-the-box solution Soperator clusters are provisioned with all necessary software pre-installed and ready to use. The software versions have been thoroughly tested and work together, to ensure optimal performance. However, if you have specific requirements, you can change software versions. The configuration of the Slurm cluster is also fine-tuned and does not require additional setup on your side. In Nebius AI Cloud, you can deploy a managed Soperator cluster in just a few clicks, or apply for a professional solution from Nebius for larger or enterprise-scale GPU workloads. For more details, see [Deploying Soperator clusters](https://docs.nebius.com/slurm-soperator/deploy/overview.md). ### Automated health checks Soperator regularly runs the following health checks: 1. Quick checks that use Slurm's [HealthCheckProgram](https://slurm.schedmd.com/slurm.conf.html#OPT_HealthCheckProgram). They check that there are no critical software or hardware issues. 2. Longer checks that run [NVIDIA® Collective Communications Library (NCCL) tests](https://github.com/NVIDIA/nccl-tests) as regular Slurm jobs. They check GPU performance and drain nodes that do not meet the test benchmark. 3. Slurm [Prolog and Epilog](https://slurm.schedmd.com/prolog_epilog.html) scripts. They perform GPU health checks before and after each Slurm job runs. 4. Compute maintenance events. They monitor all GPU and InfiniBand™ devices for errors. Soperator uses maintenance events for Slurm and automatically replaces all faulty nodes. ### Monitoring You can monitor the performance and status of various parts of the system: * Underlying Kubernetes cluster metrics, including node metrics, Pod resource metrics, and all event logs. * Slurm metrics, including job queue size, job statuses, node states, and resource consumption. * GPU (NVIDIA DCGM) metrics. ## See also * [Soperator cluster architecture](https://docs.nebius.com/slurm-soperator/overview/architecture.md). * [Explaining Soperator, Nebius' open-source Kubernetes operator for Slurm](https://nebius.com/blog/posts/soperator-in-open-source-explained) in the Nebius blog. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Soperator cluster architecture Source: https://docs.nebius.com/slurm-soperator/overview/architecture.md Soperator deploys Slurm to Kubernetes® clusters. In a Soperator cluster, Slurm nodes, storage and other components are Kubernetes resources: Pods, PersistentVolumes, etc. The diagram below outlines the architecture of a Soperator cluster: ![soperator-architecture](https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/slurm-soperator/soperator-arch.svg?fit=max\&auto=format\&n=1Ha0sWR6e1mnIaHS\&q=85\&s=3e8b01d9a537b075dd8b2c0393d47f4e) ## Cluster specification and Slurm configuration When Soperator is installed in a Kubernetes cluster, it adds the SlurmCluster [custom resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) to it. This resource contains the specification of the Soperator cluster deployed in the Kubernetes cluster. The Slurm operator itself is a Pod that uses the SlurmCluster specification to create and reconcile the Kubernetes resources in the Soperator cluster, such as login, worker and controller nodes, and storage resources. The configuration files of Slurm itself (`slurm.conf`, `gres.conf`, `cgroup.conf`, `plugstack.conf`, etc.) are [Kubernetes ConfigMaps](https://kubernetes.io/docs/concepts/configuration/configmap/) controlled by the Slurm operator. The operator renders them from the SlurmCluster specification and writes them to the shared root filesystem of the cluster, where every node reads them from `/etc/slurm`. > [!WARNING] > > Configuration changes made with `scontrol` or by editing files in `/etc/slurm` are not persistent: the operator rewrites the Slurm configuration from the SlurmCluster specification on every update. To make a change permanent, change the SlurmCluster specification: in Managed Soperator, use the web console or other Nebius AI Cloud interfaces; in Pro Solution for Soperator, [contact support](https://console.nebius.com/support/create-ticket). For details, see [Slurm configuration](https://github.com/nebius/soperator/blob/main/docs/slurm-configuration.md) in the Soperator repository. ## Nodes In Soperator clusters, all Slurm nodes are Kubernetes Pods. The main [types of Slurm nodes](https://slurm.schedmd.com/quickstart_admin.html#nodes) in Soperator clusters are the following: * [Login nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#login-node) provide users with access to the cluster. * [Worker nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#worker-node) execute Slurm jobs. * [Controller nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#controller-node) manage scheduling and orchestration. For simplicity, there are nodes that are not represented on the diagram in this article, for example, [DBD (database daemon) nodes](https://slurm.schedmd.com/quickstart_admin.html#dbd) for accounting, nodes that export metrics, nodes that other Kubernetes operators manage for backups and auto-healing. ### Login nodes To work with a Slurm (submit jobs, check their status, write `sbatch` scripts and prepare data for them, etc.), users connect to its *login nodes*. The `sshd` daemon runs on every login node. Soperator balances load between login nodes — each time a user connects to the cluster via SSH, they are directed to a random login node. ### Worker nodes *Worker nodes*, also known as *compute nodes*, perform computations for Slurm jobs. The [slurmd](https://slurm.schedmd.com/slurmd.html) daemon runs on every worker node. It monitors, launches, and terminates jobs. For more information on how to work with login and worker nodes, see [Connecting to login and worker nodes](https://docs.nebius.com/slurm-soperator/clusters/connect.md). ### Controller nodes *Controller nodes* orchestrate Slurm activities, such as job queuing, monitoring node states, and allocating resources. The central management daemon, [slurmctld](https://slurm.schedmd.com/slurmctld.html), runs on all controller nodes. ## Persistent storage Soperator's main storage feature is its *shared root filesystem*. It is mounted to all login and worker nodes in a special way — you see it as the root directory (`/`) in your SSH sessions and Slurm jobs. This helps maintain the traditional Slurm user experience where you work with the entire root filesystem on each node. The filesystem is shared, which means you do not need to keep it identical across nodes manually. When you make changes to the filesystem on one node, these changes automatically show up on other nodes. The shared root filesystem is implemented as a Kubernetes [PersistentVolume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) (PV) that ensures data is preserved when nodes restart. Soperator also uses PVs for system needs, like storing cluster and controller states, etc. ## Ephemeral storage [Local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) are available on [supported platforms, presets and regions](https://docs.nebius.com/compute/storage/local-disks.md#availability). Unlike the shared root filesystem, local SSD disks are added to an individual node and are not shared across the cluster. Use local SSD disks for data that can be recreated and benefits from high performance and low latency, such as scratch space, caches and intermediate files created by Slurm jobs. For durable or shared data, consider using persistent storage. ## See also For more information about the Soperator cluster architecture, see: * [Architecture](https://github.com/nebius/soperator/blob/dev/docs/architecture.md) in Soperator's GitHub repository. * [Explaining Soperator, Nebius' open-source Kubernetes operator for Slurm](https://nebius.com/blog/posts/soperator-in-open-source-explained) in the Nebius blog. # Deploying Soperator clusters Source: https://docs.nebius.com/slurm-soperator/deploy/overview.md Nebius AI Cloud offers two managed Slurm solutions powered by Soperator: Managed Service for Soperator and Pro Solution for Soperator. You can also deploy Soperator manually on a Managed Service for Kubernetes® cluster or on other cloud platforms. ## Nebius AI Cloud managed solutions If you share reserved GPU capacity between Soperator training workloads and inference in Managed Service for Kubernetes, see [Ephemeral nodes in Soperator](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md). ### Managed Service for Soperator Managed Service for Soperator allows you to deploy a Soperator cluster in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md) except for `us-north1` and `uk-south2`, with just a few clicks. The service takes care of the underlying infrastructure so that you can get started with Slurm and Soperator with minimum effort. > [!NOTE] > > GPU worker nodes in Soperator are only available if you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md) that reserve GPUs. For deployment steps, see [Creating and deleting Soperator clusters in Managed Service for Soperator](https://docs.nebius.com/slurm-soperator/managed-soperator/manage.md). For pricing and quotas, see [Pricing in Managed Service for Soperator](https://docs.nebius.com/slurm-soperator/managed-soperator/resources/pricing.md) and [Quotas in Managed Service for Soperator](https://docs.nebius.com/slurm-soperator/managed-soperator/resources/quotas.md). ### Pro Solution for Soperator Pro Solution for Soperator is an expert-run solution from Nebius for customized or enterprise-scale GPU workloads. Our team of high-performance computing experts assists you with deploying a Soperator cluster and your applications on it. Depending on the scope and nature of your usage, Pro Solution for Soperator offers contracts with reserved capacity and discounted pricing. To sign up for Pro Solution for Soperator, [contact sales](https://nebius.com/services/soperator#ai-contact-form). ## Self-deployment in Nebius AI Cloud If you want to manually deploy a Soperator cluster in Nebius AI Cloud, you can use the [Terraform recipe](https://github.com/nebius/nebius-solution-library/tree/main/soperator) from the Nebius solution library. The recipe creates a [Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/index.md) cluster with Soperator and all additional Nebius AI Cloud resources, such as networks and shared filesystems. You can change settings in the recipe according to your needs. ## Self-deployment on other platforms and on-premises You can install Soperator on any Kubernetes cluster that you deployed on a cloud platform or on-premises. For details, see [Soperator's GitHub repository](https://github.com/nebius/soperator/blob/main/docs/self-deploy.md). > [!NOTE] > > Soperator has not been tested on platforms other than Nebius AI Cloud. If you experience a problem when installing or using it, create an [issue in the GitHub repository](https://github.com/nebius/soperator/issues). # Ephemeral nodes in Soperator Source: https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md If you run both training and inference workloads on reserved GPU capacity, you can move nodes between them without taking down the entire Soperator cluster. *Ephemeral nodes* let you release specific worker nodes from a Soperator cluster and reuse the same [capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md) for other workloads, such as inference in a separate Managed Service for Kubernetes® cluster. Without ephemeral nodes, resizing a Soperator cluster to free GPUs for inference usually requires support-assisted operations. That process is slow, does not let you choose which nodes are removed and can interrupt running jobs or cause full-cluster downtime. Ephemeral nodes help you: * Reuse reserved GPU capacity across training and inference instead of buying pay-as-you-go capacity when demand shifts. * Release or add specific worker nodes without stopping the entire Soperator cluster. * Choose which nodes to deprovision, starting with idle nodes when possible. * Move capacity on your own schedule, without waiting for support to resize the cluster. > [!NOTE] > > Ephemeral nodes are available in Soperator clusters running version 3.0 or later. Nebius must also enable this feature in your cluster. ## How ephemeral nodes work Ephemeral nodes rely on a shared [capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md). A capacity block reserves a fixed number of GPUs in a region. Workloads that use the same capacity block draw GPUs from that pool. In the typical setup, you have two Managed Service for Kubernetes clusters that share one capacity block: * A **training cluster** that runs [Managed Service for Soperator](https://docs.nebius.com/slurm-soperator/managed-soperator/manage.md). * An **inference cluster** that runs inference workloads in one or more [node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md). When you deprovision worker nodes in the Soperator cluster, those GPUs are released back to the capacity block. You can then assign them to an inference node group that uses the same capacity block. The reverse flow applies when you move capacity from inference back to training. > [!NOTE] > > Both clusters must use the same capacity block group and GPU platform. If you are not sure how your capacity is set up, check the **Capacity block groups** tab on the **Limits** page in the [web console](https://console.nebius.com) or contact your Nebius manager. ## Deployment scenarios How you move capacity depends on how your training and inference workloads are deployed. In both cases, GPUs move through the shared capacity block: worker nodes are released from Soperator, then consumed by an inference node group, or the other way around. ### Training and inference in separate Kubernetes clusters In this scenario, one Managed Service for Kubernetes cluster hosts Soperator for training and a separate cluster hosts inference workloads in one or more node groups. Both clusters use the same capacity block group. To move capacity in this layout, see [Moving capacity between training and inference workloads](https://docs.nebius.com/slurm-soperator/capacity/move-capacity.md). ### Training and inference in the same Kubernetes cluster Soperator and inference can also run in different node groups within a single Managed Service for Kubernetes cluster. You still release worker nodes from the Soperator node group and adjust the inference node group size in the same cluster. To move capacity in this layout, see [Moving capacity between training and inference workloads](https://docs.nebius.com/slurm-soperator/capacity/move-capacity.md). ## Slurm power management commands In a Soperator cluster with ephemeral nodes enabled, you can provision and deprovision worker nodes with standard Slurm [power management](https://slurm.schedmd.com/power_save.html) commands. Run them from a [login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) after you connect to the cluster. | Command | Behavior | | - | - | | `scontrol power up ` | Provisions the specified nodes in the Soperator cluster if free GPUs are available in the capacity block. | | `scontrol power down ` | For each node, deprovisions the node when it is idle. Without the `asap` flag, power down has lower priority than starting new jobs from the queue, so Slurm may run queued jobs on the node before powering it down. | | `scontrol power down asap ` | Same as `power down`, but also [drains](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md#how-to-drain-and-resume-a-node) the nodes so no new jobs are scheduled on them. Slurm waits only for the current job to finish (if any), then deprovisions the node. | | `scontrol power down force ` | Deprovisions the nodes immediately and cancels all jobs running on them. | Replace `` in the commands above with a Slurm hostlist of worker node names, for example `worker-10,worker-11`, `worker-[10,11]` or `worker-[0-3,5-8,13],worker-cpu-18`. To check node names and states before you run a command, see [How to monitor job and node statuses in a Soperator cluster](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md). > [!NOTE] > > If `scontrol power` commands do not work, [contact technical support](https://console.nebius.com/support/) and ask to upgrade the cluster to Soperator 3.0 or later and enable ephemeral nodes on the relevant worker node sets. ### Automatic node provisioning Powered-down ephemeral nodes are automatically provisioned again when queued jobs need them. You can also trigger provisioning by submitting work with `srun` or `sbatch`: for ephemeral `CLOUD` nodes, these commands run `ResumeProgram`, and Soperator creates the corresponding worker Pods if capacity is available. If you want to release nodes and keep them powered down even when queued jobs target them, also [drain](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md#how-to-drain-and-resume-a-node) the nodes: ```bash scontrol update NodeName= State=drain Reason="prevent power up" ``` Use the same Slurm hostlist as in your `power down` command. ## See also * [Moving capacity between training and inference workloads](https://docs.nebius.com/slurm-soperator/capacity/move-capacity.md) * [Capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md) * [Health management of worker nodes in Soperator clusters](https://docs.nebius.com/slurm-soperator/worker-nodes-health.md) # Moving capacity between training and inference workloads Source: https://docs.nebius.com/slurm-soperator/capacity/move-capacity.md If you share a [capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md) between a Soperator cluster and an inference node group, you can move GPU capacity between them without stopping the entire Soperator cluster. The steps below are the same whether training and inference run in [separate Managed Service for Kubernetes clusters](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md#separate-kubernetes-clusters-for-training-and-inference) or in [different node groups within one cluster](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md#training-and-inference-in-the-same-kubernetes-cluster). Use Slurm power management commands to release or add worker nodes in Soperator, and change the inference node group size to consume or free capacity. For information on how ephemeral nodes work, see [Ephemeral nodes in Soperator](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md). ## Prerequisites 1. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. [Reserve a capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md) that your Soperator worker nodes and inference node group share. 3. Make sure your Soperator cluster runs version 3.0 or later and has ephemeral nodes enabled. Nebius enables this at cluster provisioning time; when you request the cluster, ask your Nebius manager or [technical support](https://console.nebius.com/support/) to enable ephemeral nodes on the relevant worker node sets. If `scontrol power` commands do not work, ask support to upgrade the cluster or enable ephemeral nodes. 4. Set up an inference [node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups) that uses the same capacity block: * **Separate clusters:** [Create a Managed Service for Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md) for inference workloads and add a node group to it. * **Same cluster:** [Add a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups) for inference workloads to the cluster that already runs Soperator. 5. [Generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md) and set up [access to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) in the Soperator cluster. ## How to move capacity from training to inference When training nodes are idle but inference needs more GPUs, release nodes from Soperator and add them to the inference node group. 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) in the Soperator cluster. 2. List worker nodes and their states: ```bash sinfo -Nel ``` Choose nodes that are `idle` or that you are ready to drain. See [node states](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md#node-states) for details. 3. Release the chosen nodes from the Soperator cluster: * To deprovision nodes when they are idle, use plain `power down`. Without the `asap` parameter, power down has lower priority than starting new jobs from the queue, so Slurm may run queued jobs on the node before powering it down: ```bash scontrol power down Reason="move capacity to inference" ``` * To [drain](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md#how-to-drain-and-resume-a-node) nodes so no new jobs are scheduled, wait for the current job to finish (if any), and then deprovision the nodes: ```bash scontrol power down asap Reason="move capacity to inference" ``` * To power down nodes immediately and cancel running jobs: ```bash scontrol power down force Reason="move capacity to inference" ``` Replace `` in the commands above with a Slurm hostlist of worker node names, for example `worker-10,worker-11`, `worker-[10,11]`, or `worker-[0-3,5-8,13],worker-cpu-18`. 4. To prevent the nodes from powering back up automatically when queued jobs target them, [drain](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md#how-to-drain-and-resume-a-node) them: ```bash scontrol update NodeName= State=drain Reason="prevent power up" ``` Use the same Slurm hostlist as in the `power down` command. For details, see [Automatic node provisioning](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md#automatic-node-provisioning). 5. Wait until the nodes are powered down. Confirm their state with the following command: ```bash sinfo -N -o "%N %t %E" ``` Powered-down ephemeral nodes remain in the node list with a powered-down cloud state. They no longer run worker Pods. 6. In the Managed Service for Kubernetes cluster that hosts your inference workloads, [increase the inference node group size](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups) by the same number of nodes you released from Soperator. Use a node group that draws GPUs from the same capacity block group. The released GPUs are now available to inference workloads. ## How to move capacity from inference to training When inference traffic drops and you want to run training jobs on idle GPUs, scale down the inference node group and power worker nodes back on in Soperator. 1. In the Managed Service for Kubernetes cluster that hosts your inference workloads, [reduce the inference node group size](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups) by the number of nodes you want to move to training. Wait until the nodes are removed and the GPUs are released to the capacity block. 2. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) in the Soperator cluster. 3. If you drained the nodes when you released them, resume them: ```bash scontrol update NodeName= State=resume ``` 4. Power on worker nodes in Soperator: ```bash scontrol power up ``` Replace `` in the command above with a Slurm hostlist of worker node names to bring back, for example `worker-10,worker-11`, `worker-[10,11]`, or `worker-[0-3,5-8,13],worker-cpu-18`. Soperator creates worker Pods for the requested nodes if enough free GPUs remain in the capacity block. Alternatively, submit a job with `srun` or `sbatch` that needs those nodes; Slurm may power them on automatically. For details, see [Automatic node provisioning](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md#automatic-node-provisioning). 5. Confirm that the nodes are available for scheduling: ```bash sinfo -N -o "%N %t %E" ``` The powered-on nodes should move toward the `idle` state when they are ready for new jobs. ## See also * [Ephemeral nodes in Soperator](https://docs.nebius.com/slurm-soperator/capacity/ephemeral-nodes.md) * [How to monitor job and node statuses in a Soperator cluster](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md) * [Creating and modifying Managed Service for Kubernetes® node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md) # Creating and deleting Soperator clusters in Managed Service for Soperator Source: https://docs.nebius.com/slurm-soperator/managed-soperator/manage.md You can create and manage Soperator clusters in Managed Service for Soperator in the [web console](https://console.nebius.com). A cluster includes login, controller and worker nodes, and provides a full Slurm environment for batch and interactive workloads. ## Prerequisites * If you need worker nodes with GPUs, make sure that you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md) that reserve GPUs. * Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. * Generate at least one [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md) to connect to [Slurm login nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#nodes) as the default `root` user. ## How to create a cluster > [tab] Web console > > 1. In the sidebar, go to  **AI orchestration** → **Soperator**. > > 2. Click **Create cluster**. > > 3. In the **Overview**, configure the cluster's general parameters: > > 1. Enter the cluster name. > 2. Add one or more SSH public keys (`ssh-ed25519 AAA***`) to access the login node. > > 4. Configure node sets. A cluster must have a [login node set](https://docs.nebius.com/slurm-soperator/overview/architecture.md#login-nodes) and at least one [worker node set](https://docs.nebius.com/slurm-soperator/overview/architecture.md#worker-nodes). > > 1. For the login node set, specify a number of nodes. > 2. For each worker node set, specify the following: > > * Name. > > * Whether the nodes should use GPUs. > > * [Platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). > > - Reservation ID from your [capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md). > - Number of nodes. > > If you already have a worker node set and would like to create another one with the same configuration, next to the worker set, click  → **Clone node set**. > > Each cluster also contains [service nodes](https://docs.nebius.com/slurm-soperator/managed-soperator/service-nodes.md): controller nodes, accounting nodes, and Soperator system nodes. They are subject to billing and quotas in the same way as login and worker nodes. > > 5. Add visible and, optionally, hidden partitions. You can use the default partitions or define your own ones. > > Partitions group nodes into logical (and possibly overlapping) sets and define how workloads are scheduled on those node sets. See details in the [Slurm quickstart on partitions](https://slurm.schedmd.com/quickstart.html#arch). > > In Managed Soperator, hidden partitions are not listed by Slurm CLI tools as available (per the `Hidden` parameter in [slurm.conf](https://slurm.schedmd.com/slurm.conf.html#OPT_Hidden)), but you can create and manage them in the web console and other Nebius AI Cloud interfaces. > > > [!WARNING] > > > > Manage partitions only through the web console and other Nebius AI Cloud interfaces. A partition created or changed with `scontrol` inside the cluster is not part of the cluster configuration and is removed the next time Soperator updates the Slurm configuration. For details, see [Cluster specification and Slurm configuration](https://docs.nebius.com/slurm-soperator/overview/architecture.md#cluster-specification-and-slurm-configuration). > > For each partition, specify: > > * [PartitionName](https://slurm.schedmd.com/slurm.conf.html#OPT_PartitionName): A unique partition name that you will use when submitting jobs. > * [Nodes](https://slurm.schedmd.com/slurm.conf.html#OPT_Nodes_1): The worker node sets that the partition can schedule jobs on. A partition can include one or more node sets, and a node set can belong to more than one partition. > * [PriorityTier](https://slurm.schedmd.com/slurm.conf.html#OPT_PriorityTier): Determines how Soperator prioritizes partitions when resources are limited. A higher partition priority means that more jobs from this partition are favored for the same resources. > * [DefaultTime](https://slurm.schedmd.com/slurm.conf.html#OPT_DefaultTime): The default time limit for jobs submitted to the partition, in `HH:MM:SS` format. Jobs inherit this limit unless they have a different time in their submission settings. > * [DefMemPerNode](https://slurm.schedmd.com/slurm.conf.html#OPT_DefMemPerNode): The default amount of memory available to each node for jobs scheduled in the partition. Must not exceed the node capacity. > * [PreemptMode](https://slurm.schedmd.com/slurm.conf.html#OPT_PreemptMode): Preemption mode controls what happens to currently running jobs when higher priority jobs require resources. > > 6. Add volumes. A cluster can include shared, local, and memory volumes. > > * **Cluster volumes** are created per cluster and are available to all node sets. > * **Shared volumes** are created per project and are available to all node sets. > * **Local volumes** are created per node and store temporary or runtime data. > * **Memory volumes** store data in RAM. You cannot change them. > > For more information about cluster and shared volumes, see [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md). > > 7. (Optional) If the selected platform and preset support local SSD disks, enable **Local SSD disks** to add ephemeral local storage to your cluster. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > 8. Review the configuration on the **Review** page and click **Create cluster**. ### What's next * [Connect to the cluster](https://docs.nebius.com/slurm-soperator/clusters/connect.md). * To save costs when you are not using the cluster, [stop and start it](https://docs.nebius.com/slurm-soperator/managed-soperator/stop-start.md). ## How to delete a cluster > [!WARNING] > > When you delete a cluster, all data stored on its nodes and volumes is permanently removed. If you want to stop using the cluster temporarily and save costs, see [stop and start it](https://docs.nebius.com/slurm-soperator/managed-soperator/stop-start.md). 1. In the sidebar, go to **Managed Soperator**. 2. In the list of clusters, find the one that you want to delete. 3. Next to the cluster, click  → **Delete**. 4. Enter the cluster name to confirm and click **Delete cluster**. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Stopping and starting Soperator clusters in Managed Service for Soperator Source: https://docs.nebius.com/slurm-soperator/managed-soperator/stop-start.md If you are not using the Soperator cluster that you have deployed in Managed Service for Soperator, you can stop it in the [web console](https://console.nebius.com) to save costs. While the cluster is stopped, Managed Service for Soperator [charges you](https://docs.nebius.com/slurm-soperator/managed-soperator/resources/pricing.md) for the cluster's storage resources: the disks of worker, login and controller nodes, and the shared filesystem. The service does not charge you for the cluster's computing resources (GPUs, vCPUs and RAM). When you need the cluster again, you can start it. Starting the cluster takes around 15 minutes. The cluster keeps the data that you saved in it, although you can only access it after you restart the cluster. Computing and storage resources of a stopped cluster count towards [Compute quotas](https://docs.nebius.com/compute/resources/quotas-limits.md), just like a running cluster. ## Prerequisites Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## How to stop and start a cluster > [tab] Web console > > 1. In the sidebar, go to  **AI orchestration** → **Soperator**. > 2. Find the required cluster in the list. > 3. Next to the cluster, click  → **Stop**. # Managed Service for Soperator service nodes Source: https://docs.nebius.com/slurm-soperator/managed-soperator/service-nodes.md In addition to login and worker nodes that you [create](https://docs.nebius.com/slurm-soperator/managed-soperator/manage.md) in your Managed Service for Soperator clusters, every cluster contains *service nodes* that facilitate the cluster's operation. Service nodes are [billed](https://docs.nebius.com/slurm-soperator/managed-soperator/resources/pricing.md) and count towards [quotas](https://docs.nebius.com/slurm-soperator/managed-soperator/resources/quotas.md) on vCPUs. You cannot configure service nodes. ## Service node types Managed Soperator service nodes vary by function: * *Controller nodes* orchestrate Slurm activities, such as job queuing, monitoring node states, and allocating resources. * *Accounting nodes,* also known as *database daemon nodes* or *DBD nodes,* collect accounting information for jobs and job steps that you run in the cluster. * *Soperator system nodes* host Soperator tools that manage Nebius AI Cloud resources, certificates, and telemetry. * *Network File System (NFS) nodes* provide shared storage mounted on login and worker nodes. For more details about controller and accounting nodes, see [Slurm documentation](https://slurm.schedmd.com/quickstart_admin.html#nodes). ## Service nodes in clusters Each Managed Soperator cluster contains the following service nodes: | Type | Number of nodes | Compute per node | Storage per node | | - | - | - | - | | Controller nodes | 1 | Non-GPU AMD Epyc Genoa, `16vcpu-64gb` | Network SSD disk, 256 GiB; Network SSD IO M3 disk, 93 GiB | | Accounting nodes | 1 | Non-GPU AMD Epyc Genoa, `8vcpu-32gb` | Network SSD disk, 128 GiB; Network SSD IO M3 disk, 1023 GiB | | Soperator system nodes | 3–9, autoscaled depending on load | Non-GPU AMD Epyc Genoa, `16vcpu-64gb` | Network SSD disk, 192 GiB | | NFS nodes | 1 | Non-GPU AMD Epyc Genoa, `32vcpu-128gb` | Network SSD disk, 512 GiB; Network SSD IO M3 disk, 4650 GiB | Therefore, for billing and quota purposes, at least the following computing and storage resources are added to login and worker nodes of a cluster: * Non-GPU AMD Epyc Genoa: 104 vCPUs, 416 GiB RAM * Network SSD disks: 1472 GiB * Network SSD IO M3 disks: 5766 GiB # Connecting to login and worker nodes Source: https://docs.nebius.com/slurm-soperator/clusters/connect.md In Soperator clusters, all Slurm nodes are Kubernetes Pods. The main [types of Slurm nodes](https://slurm.schedmd.com/quickstart_admin.html#nodes) in Soperator clusters are the following: * [Login nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#login-node) provide users with access to the cluster. * [Worker nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#worker-node) execute Slurm jobs. * [Controller nodes](https://docs.nebius.com/slurm-soperator/overview/architecture.md#controller-node) manage scheduling and orchestration. You can connect to login and worker nodes. ## Prerequisites Before you connect to nodes of a Soperator cluster for the first time, make sure that the following requirements are met: 1. [Get the public endpoint of the cluster](https://docs.nebius.com/slurm-soperator/clusters/connect.md#get-the-public-endpoint-of-the-cluster). 2. [Create a user account](https://docs.nebius.com/slurm-soperator/clusters/connect.md#create-a-user-account). 3. [(Optional) Establish a connection in Visual Studio Code](https://docs.nebius.com/slurm-soperator/clusters/connect.md#optional-establish-a-connection-in-visual-studio-code). ### Get the public endpoint of the cluster If you deployed the cluster in Managed Service for Soperator yourself, get the endpoint in the [web console](https://console.nebius.com): 1. In the sidebar, go to  **AI orchestration** → **Soperator**. 2. Under **General**, copy the public endpoint. If you are using the Pro Solution for Soperator, get the endpoint from your personal manager. ### Create a user account Contact the cluster administrator (the `root` user) to [create a user](https://docs.nebius.com/slurm-soperator/users/manage.md#how-to-create-a-user) for you. [Generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md) and share your public SSH key with the administrator. ### (Optional) Establish a connection in Visual Studio Code If you want to establish a connection in [Visual Studio Code](https://code.visualstudio.com/), do the following: 1. Install the [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) extension. 2. Open your `~/.ssh/config` file and add the following configuration: ```bash Host slurm HostName User IdentityFile ~/slurm_ed25519 ``` ## How to connect to login nodes Connect to a login node, so you can run Slurm commands and manage data stored on the shared filesystem. > [tab] Terminal > > By default, if a cluster has several login nodes, you connect to a random login node: > > ```bash > ssh @ -i > ``` > > If you are working in the terminal, you can choose which login node to connect to. > > > [!NOTE] > > > > If you use the [tmux](https://en.wikipedia.org/wiki/Tmux) terminal multiplexer, make sure to connect to the same node each time. `tmux` sessions are created on the node where they are started, so you can only access them on this node. > > To connect to a particular login node, use the cluster public endpoint as a jump host and the name of the required node. > > ```bash > ssh -J @ @login- -i > ``` > > Specify the parameters that were set during the user creation: > > * Username. The administrator has the `root` username. > * Path to the private key. > * Exact name of the node you need to connect to, if you are connecting to a specific node (`login-`). You can get the list of login nodes in your cluster from your personal manager. > > Output example: > > ```text > username@login-0:~$ > ``` > > Now, you can run Slurm commands, for example, `sinfo` to get a list of available Slurm nodes. > [tab] VS Code > > To establish a connection, in VS Code, click → **Connect to Host...** → **slurm**. > > The configuration already includes your username and the cluster endpoint, so you do not need to enter them to connect. > > Now, you can view and manage data in your cluster by using the VS Code interface. ## How to connect to worker nodes Connect to a worker node, so you can monitor, observe, and manage Slurm jobs. You can only connect to a specific worker node. To establish a connection, do the following: 1. From your personal manager, get a list of worker nodes in your cluster. Usually, worker nodes are named as `worker-0`, `worker-1`, `worker-2`, depending on how many exist. 2. [Connect to a login node by using a terminal](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes). 3. Connect to a specific worker node: ```bash ssh worker- ``` For example, if you have `worker-0` and `worker-1`, specify one of these nodes. Output example: ```text username@worker-0:~$ ``` Now, you can [monitor system usage](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md) with various tools, such as `htop`, `nvtop` or `nvidia-smi`. If you are working in the terminal, you can connect to a worker node directly by using the cluster public endpoint as a jump host and then connecting to the specific node by name. > [tab] Terminal > > ```bash > ssh -J @ @worker- -i > ``` > > Enter the exact name of the node you need to connect to. In addition, specify the parameters that were set during the user creation: > > * Username. The administrator has the `root` username. > * Path to the private key. > > Output example: > > ```text > username@worker-0:~$ > ``` # Running Slurm batch jobs Source: https://docs.nebius.com/slurm-soperator/jobs/index.md Slurm's main purpose is to run *batch jobs*. Batch jobs are limited in time and non-interactive. To run a batch job, you should define it in a shell script which is also called a *batch script*, and then run the `sbatch` command to submit the script. After that, Slurm allocates the requested resources, forming a *job allocation* (also known as *job*), and then runs the script on one of the allocated worker nodes. Batch scripts launch multi-node workloads by using `srun` commands, forming one or many *job steps*. A job step represents a separate unit of work within the job. The command that you pass to `srun` is executed in parallel on one or many worker nodes within the job allocation. One instance of the running command (a Linux process) is called *task*. By default, `srun` starts one task per allocated worker node, but you can configure it in job step settings. You can configure job settings in multiple ways, such as in `sbatch` and `srun` command parameters, special comments inside a batch script (`#SBATCH` directives) and environment variables. ## How to run a batch job 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes). 2. Create a batch script and name it, for example, `my_ml_job.sh`. Here is a basic example of a job script that runs your training application written in Python: ```bash #!/bin/bash # Directives that define the job's settings #SBATCH --job-name=my_ml_job #SBATCH --output=%x_%j.out # _.out #SBATCH --error=%x_%j.err # _.err #SBATCH --time=01:00:00 # time limit = 1 hour #SBATCH --exclusive # allocate all CPUs on nodes #SBATCH --gpus-per-node=8 # allocate 8 GPUs per node #SBATCH --ntasks-per-node=8 # launch 8 tasks in each job step by default # Commands that the batch script runs export CHECKPOINT_PATH="/mnt/data/gpt3/checkpoints" export DATA_PATH="/mnt/data/c4_data" export DTYPE="fp16" source .venv/bin/activate # Launch a job step on 4 nodes with 8 tasks per node, each pinned to 16 CPUs. srun --cpus-per-task=16 python train.py ``` For more details about writing batch scripts, see [Job configuration](https://docs.nebius.com/slurm-soperator/jobs/index.md#job-configuration) and [Examples](https://docs.nebius.com/slurm-soperator/jobs/index.md#examples). 3. Prepare the environment on the login node. > [!NOTE] > > In Soperator clusters, all nodes [share a root filesystem](https://docs.nebius.com/slurm-soperator/overview/architecture.md), so files and dependencies that you set up on the login node automatically appear on other nodes. 1. Make sure that the files that the script uses are on the login node: create them from scratch, [upload them from another machine](https://docs.nebius.com/slurm-soperator/storage/download-data.md) or copy their contents to files on the login node. The example above requires `train.py` to be in the same directory as the batch script. 2. Install the script dependencies. > For example, if your workload uses Python packages listed in [requirements.txt](https://pip.pypa.io/en/stable/user_guide/#requirements-files), create a Python [virtual environment](https://docs.python.org/3/library/venv.html) and install the packages into it: > > ```bash > python -m venv .venv > source .venv/bin/activate > pip install -r requirements.txt > ``` > [!TIP] > > You can make working with dependencies easier by turning your workload into a containerized job. For more details, see [Running jobs in containers in Soperator clusters](https://docs.nebius.com/slurm-soperator/jobs/containers/index.md). 3. Make sure all files have suitable permissions. 4. Define the required environment variables. Usually, you can put your environment variables right in the batch script, but there are cases when it's more convenient to define them inside your login shell. > For example, if your workload uses [Weights & Biases](https://docs.wandb.ai/quickstart/) (W\&B), define an environment variable for your W\&B API key: > > ```bash > export WANDB_API_KEY= > ``` 5. Submit the script to Slurm with `sbatch`, providing additional settings if needed. > For example, if you named your batch script `my_ml_job.sh` and you want to run the job on 4 worker nodes, run the following command: > > ```bash > sbatch --nodes=4 my_ml_job.sh > ``` The output contains the job ID, which you can use to [monitor the job's status](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md): ```text Submitted batch job 610 ``` The job prints its standard and error outputs to the files specified in the script directives. In the example above, the name pattern for the job's standard output file is `output_%j.txt` where `%j` stands for the job ID (for more details about patterns, see the [Slurm documentation](https://slurm.schedmd.com/sbatch.html#SECTION_FILENAME-PATTERN)). You can print the file's current contents: ```bash cat output_.txt ``` If your job takes some time, you can stream the standard output rather than repeatedly printing it: ```bash tail -f output_.txt ``` ## Job configuration To define a job, you should configure its settings, and add the commands that it should run to its batch script. ### sbatch settings `sbatch` settings configure job allocations and provide default values for corresponding `srun` settings. You can configure `sbatch` settings in the following ways, from highest to lowest priority (for example, the value of a command parameter overrides the value of an input environment variable for the same setting): 1. **Command parameters**: `sbatch --time="02:00:00"` The `sbatch` command has parameters that work and behave like regular parameters of a Linux command. Use command parameters when you want to use different values for different job runs or to overwrite settings from other sources. 2. **Input environment variables**: `export SBATCH_TIMELIMIT="01:00:00"` in login shell, `/etc/profile` or `~/profile` Most (but not all) command parameters have corresponding input environment variables with the same meaning. Some of these environment variables have different names from their command parameters. > For example, the `--time` command parameter corresponds to the `SBATCH_TIMELIMIT` input environment variable. For the list of all environment variables, see the [Slurm documentation](https://slurm.schedmd.com/sbatch.html#SECTION_INPUT-ENVIRONMENT-VARIABLES). You can define them on different levels, from highest to lowest priority: 1. **Session variables**: environment variables that you export in your login shell. They disappear after you reconnect to the cluster. Use session variables when you want to launch a few jobs with the same setting without keeping it forever. 2. **User variables**: environment variables from `~/profile`. The login shell exports them every time *you* connect to the cluster; after that, session variables can override them. Use user variables to set your personal default values for settings. 3. **Cluster variables**: environment variables from `/etc/profile`. The login shell exports them every time *any user* connects to the cluster; after that, user variables and then session variables can override them. Use cluster variables to set default values for all users. 3. **#SBATCH directives**: `#SBATCH --time="01:30:00"` in a batch script `#SBATCH` directives are special comments at the beginning of a batch script. Use `#SBATCH` directives to define settings that should apply to most runs of this particular job. > [!NOTE] > > All `#SBATCH` directives must appear at the beginning of the script. As soon as `sbatch` encounters the first line that does not start with `#` or consist of whitespace (spaces, tab characters, etc.), it interprets the rest of the file as commands and silently ignores misplaced `#SBATCH` directives. 4. **Slurm defaults**: `time="00:30:00"` in `~/.slurm/defaults` Slurm defaults are key-value pairs in the `~/.slurm/defaults`. These values apply only to you and are not applicable to other users. Use Slurm defaults when you need a low-priority default value, or a default value for a command parameter that does not have a corresponding input environment variable. > [!WARNING] > > `~/.slurm/defaults` defines settings for both `sbatch` and `srun`. Do not use them for settings that have the same name but different meaning for these commands; for example, `--exclusive` ([sbatch](https://slurm.schedmd.com/sbatch.html#OPT_exclusive), [srun](https://slurm.schedmd.com/srun.html#OPT_exclusive)). #### Common sbatch settings
**Command parameter****Description****Environment variable****#SBATCH directive****Slurm default**
`--job-name=` or `-J=`The name of your job.`SBATCH_JOB_NAME``#SBATCH --job-name=` or `#SBATCH -J=``job-name=` or `J=`
`--nodes=` or `-N=`The number of worker nodes to allocate for the job.*N/A*`#SBATCH --nodes=` or `#SBATCH -N=``nodes=` or `N=`
`--nodelist=` or `-w=`The list of specific worker nodes to allocate for the job. For example, `--nodelist="worker-0,worker-2"` or `--nodelist="worker-[0-2,3]"`.*N/A*`#SBATCH --nodelist=` or `#SBATCH -w=``nodelist=` or `w=`
`--exclude=` or `-x=`The list of worker nodes to exclude from the job allocation. For example, `--exclude="worker-3"` or `--nodelist="worker-[4-7]"`.*N/A*`#SBATCH --exclude=` or `#SBATCH -x=``exclude=` or `x=`
`--output=` or `-o=`The path to the file for the job's standard output. The path can contain special replacement symbols; for example, `%j` is replaced by the job ID. For more details, see the [Slurm documentation](https://slurm.schedmd.com/sbatch.html#SECTION_FILENAME-PATTERN).`SBATCH_OUTPUT``#SBATCH --output=` or `#SBATCH -o=``output=` or `o=`
`--error=` or `-e=`The path to the file for the job's error output. The path can contain the replacement symbols as described for the `output` setting.`SBATCH_ERROR``#SBATCH --error=` or `#SBATCH -e=``error=` or `e=`
`--time=` or `-t=`The time limit for the job. When the job reaches the time limit, all its tasks (processes) are terminated. For example, `01:00` limits the job to one hour, and `1-00` limits the job to one day (24 hours).`SBATCH_TIMELIMIT``#SBATCH --time=` or `#SBATCH -t=``time=` or `t=`
`--gpus-per-node=`The number of GPUs to allocate for the job on each worker node.`SBATCH_GPUS_PER_NODE``#SBATCH --gpus-per-node=``gpus-per-node=`
`--ntasks-per-node=`The maximum number of tasks to run on each worker node. When you define resources for the job in per-task settings like `gpus-per-task`, `cpus-per-task`, etc., total resources in the job allocation are based on the value of `ntasks-per-node`.*N/A*`#SBATCH --ntasks-per-node=``ntasks-per-node=`
`--exclusive`Allocates all CPUs on the allocated worker nodes to the job, preventing other jobs from using these nodes. This allows the total number of tasks of the job to be unlimited.`SBATCH_EXCLUSIVE``#SBATCH --exclusive`*N/A*
`--cpus-per-task=` or `-c=`The number of CPUs to allocate for the job per task.*N/A*`#SBATCH --cpus-per-task=` or `#SBATCH -c=``cpus-per-task=` or `c=`
`--mem=[]` or `-m=[]`The RAM size to allocate for the job on each worker node. For example, `mem=4G`. To allocate all available RAM, specify `mem=0`.`SBATCH_MEM_PER_NODE``#SBATCH --mem=[]` or `#SBATCH -m=[]``mem=[]` or `m=[]`
`--partition=` or `-p=`The Slurm partition to allocate nodes from.`SBATCH_PARTITION``#SBATCH --partition=` or `#SBATCH -p=``partition=` or `p=`
`--account=` or `-A=`The Slurm account name.`SBATCH_ACCOUNT``#SBATCH --account=` or `#SBATCH -A=``account=` or `A=`
`--requeue`Requeues the job automatically: restarts it (with the same ID) when its worker nodes fail or other, higher-priority jobs preempt them.`SBATCH_REQUEUE``#SBATCH --requeue``requeue`
`--no-requeue`Disables automatically requeuing the job (see `requeue`).`SBATCH_NO_REQUEUE``#SBATCH --no-requeue``no-requeue`
`--dependency=` or `-d=`Dependencies of the job. For example:\
  • `dependency=singleton` requires that the job only starts after other jobs with the same name and user are terminated. This means that at any moment, there can only be one job with this name and owned by this user.
  • `dependency=afterany:20:21` requires that the job only starts after the jobs with IDs 20 and 21 are terminated.
For more details, see the [Slurm documentation](https://slurm.schedmd.com/sbatch.html#OPT_dependency).
*N/A*`#SBATCH --dependency=` or `#SBATCH -d=``dependency=` or `d=`
`--parsable`Changes the standard output of `sbatch` from `Submitted batch job ` to just ``.*N/A*`#SBATCH --parsable``parsable`
`--verbose` or `-v`Increases the verbosity of `sbatch`'s informational messages. For more verbosity, use the parameter, `#SBATCH` directive or Slurm default multiple times, or set the `SBATCH_DEBUG` environment variable to `2`, `3`, etc.`SBATCH_DEBUG``#SBATCH --verbose` or `#SBATCH -v``verbose` or `v`
### Commands The commands block of a batch script defines commands that the batch script runs. Commands in a batch script are executed on one worker node. Typically, you would need to run your main computational commands on multiple worker nodes in parallel. To do that, use the `srun` command in the script. > In the [example above](https://docs.nebius.com/slurm-soperator/jobs/index.md#how-to-run-a-batch-job), `srun python train.py` makes `python train.py` run in parallel. If it was just `python train.py`, the Python script would run on one worker node. In commands, you can use the *output environment variables* set by [sbatch](https://slurm.schedmd.com/sbatch.html#SECTION_OUTPUT-ENVIRONMENT-VARIABLES) (general job details: ID, job allocation, launch node and worker nodes, etc.) and [srun](https://slurm.schedmd.com/srun.html#SECTION_OUTPUT-ENVIRONMENT-VARIABLES) (`sbatch`'s variables, plus details about the current job step and task: local and global ranks, world size, CPUs in use, etc.). For example: * `SLURM_JOB_NODELIST` is the list of worker nodes allocated to the job; `SLURM_NNODES` is the number of the worker nodes. * `SLURM_SUBMIT_DIR` is the directory where you executed `sbatch`. * `SLURM_NODEID` is the node ID for each worker node. ## Examples ### Training with Hugging Face Accelerate The following example uses [Hugging Face Accelerate](https://huggingface.co/docs/accelerate/index) to run a training workload (`train.py`) on two nodes with 8 GPUs each. It requires that you add Accelerate to `train.py`, as described in the [Accelerate documentation](https://huggingface.co/docs/accelerate/basic_tutorials/migration), and install it into your Python virtual environment (`pip install accelerate`). `llm_training.sh`: ```bash #!/bin/bash #SBATCH --job-name=llm_training #SBATCH --output=%x_%j.out #SBATCH --error=%x_%j.err #SBATCH --nodes=2 #SBATCH --gpus-per-node=8 #SBATCH --exclusive #SBATCH --mem=0 # Get the hostname of worker node where this sbatch script runs, # SLURMD_NODENAME is the Slurm output environment variable for sbatch. MAIN_PROCESS_ADDR=$SLURMD_NODENAME MAIN_PROCESS_PORT=12345 srun \ --cpus-per-task=64 \ --hint=nomultithread \ bash -c 'accelerate launch \ # SLURM_STEP_NUM_NODES is the number of worker nodes allocated for the step (2) --num_machines $SLURM_STEP_NUM_NODES \ # SLURM_NODEID is the ID of the current worker node (0 or 1) --machine_rank $SLURM_NODEID \ --main_process_ip $MAIN_PROCESS_ADDR \ --main_process_port $MAIN_PROCESS_PORT \ --num_processes $(($SLURM_STEP_NUM_NODES * $SLURM_GPUS_ON_NODE)) \ train.py' ``` For `accelerate launch` parameters, see [Accelerate documentation](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch). ### Fine-tuning with PyTorch (torchrun) The following example uses [PyTorch](https://pytorch.org/docs/stable/index.html) to fine-tune a model (`llama-3-8b`) on a sample dataset (`alpaca_dataset`). The job runs on three nodes with 8 GPUs each. For the full example, including `finetuning.py` with added PyTorch and instructions to download the model and the dataset, see the [Multi-node LLM fine-tuning on Slurm](https://github.com/alex000kim/multi-node-llm-finetuning-slurm) repository on GitHub. * `sbatch.sh`: ```bash #!/bin/bash #SBATCH --job-name=llama-finetune #SBATCH --nodes=3 #SBATCH --output=O-%x_%j.txt #SBATCH --error=E-%x_%j.txt #SBATCH --gres=gpu:8 #SBATCH --cpus-per-task=120 # Loads all environment variables into the job #SBATCH --export=ALL srun srun.sh ``` * `srun.sh`: ```bash #!/bin/bash export GPUS_PER_NODE=8 # Get the hostname of the first node from the list of the job's worker nodes # (SLURM_JOB_NODELIST, set by Slurm) HOST_ADDR=$(scontrol show hostnames $SLURM_JOB_NODELIST | head -n 1) MAIN_PROCESS_PORT=12345 echo "SLURM_NNODES=$SLURM_NNODES" echo "SLURM_NODEID=$SLURM_NODEID" echo "HOST_ADDR=$HOST_ADDR" echo "MAIN_PROCESS_PORT=$MAIN_PROCESS_PORT" source .venv/bin/activate torchrun --nnodes $SLURM_NNODES \ --nproc_per_node $GPUS_PER_NODE \ --master_addr $HOST_ADDR \ --master_port $MAIN_PROCESS_PORT \ --node_rank=$SLURM_NODEID \ finetuning.py \ --model_name ./llama-3-8b \ --output_dir saved_peft_model \ --use_peft \ --peft_method lora \ --enable_fsdp \ --use_fast_kernels \ --use_wandb \ --dataset alpaca_dataset ``` For details about `torchrun`, see the [PyTorch documentation](https://pytorch.org/docs/stable/elastic/run.html) and the source code of [torch.distributed.run](https://github.com/pytorch/pytorch/blob/main/torch/distributed/run.py) on GitHub. ### Containerized jobs You can run containerized jobs with batch scripts by using special `srun` parameters. For example: ```bash srun --container-image="nvcr.io#nvidia/tensorflow:23.02-tf1-py3" \ python -c "import tensorflow as tf; print (tf.__version__)" ``` For more details and examples, see [Running jobs in containers in Soperator clusters](https://docs.nebius.com/slurm-soperator/jobs/containers/index.md). # Running jobs in containers in Soperator clusters Source: https://docs.nebius.com/slurm-soperator/jobs/containers/index.md Soperator enables you to run jobs in containers. Containers allow you to run applications across different cloud providers, in a portable and consistent way. You can create a container image once and then run it in different cloud services. In addition, many widespread solutions are already available in container registries. Soperator clusters allow you to run jobs in containers by using the following tools: * [Enroot and Pyxis](https://docs.nebius.com/slurm-soperator/jobs/containers/pyxis-enroot.md) * [Apptainer](https://docs.nebius.com/slurm-soperator/jobs/containers/apptainer.md) * [Docker](https://docs.nebius.com/slurm-soperator/jobs/containers/docker.md) For the best performance, we recommend using Enroot and Pyxis, because Soperator includes performance optimizations for them. # Running jobs in containers by using Enroot and Pyxis Source: https://docs.nebius.com/slurm-soperator/jobs/containers/pyxis-enroot.md Soperator clusters support Enroot and Pyxis to run jobs in containers: * [Enroot](https://github.com/nvidia/enroot) is a simple container runtime. It was created by NVIDIA® specifically for machine learning and high-performance computing. Enroot supports Docker images and can execute the same containers, but works better with Slurm. It allows you to pull the images from container registries, such as [Docker Hub](https://hub.docker.com/), [NVIDIA NGC](https://catalog.ngc.nvidia.com/containers) (`nvcr.io`) or [Container Registry](https://docs.nebius.com/container-registry/index.md) by Nebius. * [Pyxis](https://github.com/NVIDIA/pyxis) is a plug-in for Slurm, which uses Enroot to allow cluster users to run containerized jobs by using the `srun` command with additional `--container-***` parameters. You can run a Slurm job within a container created from an image that is stored either [in a registry](https://docs.nebius.com/slurm-soperator/jobs/containers/pyxis-enroot.md#how-to-run-a-job-for-a-container-registry-image) or [locally](https://docs.nebius.com/slurm-soperator/jobs/containers/pyxis-enroot.md#how-to-run-a-job-for-a-local-image). ## How to run a job for a container registry image 1. Create the following job called `test.sbatch`: ```bash #!/bin/bash #SBATCH -J test #SBATCH --output=log.out #SBATCH --error=log.out #SBATCH --gpus=1 srun --container-image="nvcr.io#nvidia/tensorflow:23.02-tf1-py3" \ python -c "import tensorflow as tf; print (tf.__version__)" ``` This job pulls a TensorFlow image from the NVIDIA container registry, starts a container and executes a simple Python script within it. Use the `--container-image=""` parameter for the `srun` command, to specify a container image. In Soperator clusters, a container image is first pulled from the registry, then saved to the cluster's shared filesystem. Next, all worker nodes can use this image to start the container, without repeated downloads of the same data from the registry. You can disable this default behavior and add the `--container-image-save=""` parameter with an empty value to the `srun` command. In this parameter, you can also set the path where the image is stored in the filesystem: `--container-image-save=""`. For more information about other parameters available for `srun`, see [Pyxis documentation](https://github.com/NVIDIA/pyxis/wiki/Usage). 2. Run the job: ```bash sbatch test.sbatch ``` ### How to authenticate in a container registry Docker Hub and NVIDIA NGC container registries are configured by default, and you do not need to authenticate to pull public container images from them. If you need to pull images from another registry, or to pull private container images, configure credentials in the `~/.config/enroot/.credentials` file: ```bash machine login password ``` The password requirements depend on the image: * To pull a private container image, the password is required. For more information about the login and password, consult the documentation of the selected container registry. * To pull a public container image from a registry other than Docker Hub or NVIDIA NGC, you can use an arbitrary string instead of a password. The endpoint for Container Registry by Nebius is `cr..nebius.cloud`, where `` is the ID of a [Nebius AI Cloud region](https://docs.nebius.com/overview/regions.md); for example, `cr.eu-north1.nebius.cloud`. For more information, see [Container Registry documentation](https://docs.nebius.com/container-registry/registries/manage.md) and [Enroot documentation](https://github.com/NVIDIA/enroot/blob/master/doc/cmd/import.md#description). ## How to run a job for a local image > [!WARNING] > > You can only use images in the [squashfs](https://www.kernel.org/doc/Documentation/filesystems/squashfs.txt) format (`.sqsh`, `.sqshfs`, `.squashfs`). You can get the images by using the [enroot import](https://github.com/NVIDIA/enroot/blob/master/doc/cmd/import.md) command. Alternatively, they can be saved when you pull the image from the registry by using `--container-image-save="/image.sqshfs"`. To run a job in a container with a local image, do the following: 1. Create the following job called `test.sbatch`: ```bash #!/bin/bash #SBATCH -J test #SBATCH --output=log.out #SBATCH --error=log.out #SBATCH --gpus=1 srun --container-image="./tensorflow.sqsh" \ python -c "import tensorflow as tf; print (tf.__version__)" ``` This job starts a container with a local image, then executes a simple Python script within the container. Use the `--container-image=""` parameter for the `srun` command, to specify the container image. For more information about other parameters available for `srun`, see [Pyxis documentation](https://github.com/NVIDIA/pyxis/wiki/Usage). 2. Run the job: ```bash sbatch test.sbatch ``` # Running jobs in containers by using Apptainer Source: https://docs.nebius.com/slurm-soperator/jobs/containers/apptainer.md Soperator clusters allow you to run jobs in containers by using [Apptainer](https://apptainer.org/). Apptainer is a secure and portable container runtime compatible with Slurm. It is designed for high-performance computing (HPC) and scientific computing. Apptainer was formerly known as Singularity and supports the same `.sif` container image format. > [!NOTE] > > Apptainer may provide lower performance than other [supported tools for running jobs in containers](https://docs.nebius.com/slurm-soperator/jobs/containers/index.md). We recommend using container runtimes that Soperator has performance optimizations for, such as Enroot. To run a containerized job by using Apptainer: 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) to a login node of your Soperator cluster. 2. Install Apptainer: ```bash sudo add-apt-repository -y ppa:apptainer/ppa sudo apt update sudo apt install -y apptainer ``` 3. Verify that the installation was successful by checking the Apptainer version: ```bash apptainer --version ``` Expected output: ```bash apptainer version 1.3.4 ``` 4. Use `srun` to pull a container image and convert it to the `.sif` format: ```bash srun apptainer pull cuda_image.sif docker://nvidia/cuda:12.4.1-cudnn-devel-rockylinux8 ``` The `pull` command can download or convert a container from the specified URL. In particular, you can pull an image from Docker Hub or another container registry. For more information, see the [Apptainer documentation](https://apptainer.org/docs/user/main/cli/apptainer_pull.html). 5. Create the `apptainer_job.sh` script with the following contents: ```bash #!/bin/bash #SBATCH --job-name=apptainer_job #SBATCH --gres=gpu:8 #SBATCH --output=output.log #SBATCH --error=error.log apptainer exec --nv cuda_image.sif nvidia-smi ``` This script uses the following parameters: * `--gres=gpu:8` requests 8 GPUs for the job. * `--nv` enables NVIDIA® GPU support inside the container. This script runs the [nvidia-smi monitoring utility by NVIDIA](https://docs.nvidia.com/deploy/nvidia-smi/index.html) to print information on GPU visibility inside the container. To run custom workloads, replace `cuda_image.sif` with a different container image. Also, replace `nvidia-smi` with the required application or command. For example: ```bash apptainer exec --nv my_custom_image.sif python train.py ``` Ensure that `my_custom_image.sif` contains Python and all other dependencies of `train.py`. 6. Run the job: ```bash sbatch apptainer_job.sh ``` The output contains the following confirmation: ```bash Submitted batch job ``` 7. When the job completes, check the logs. The `output.log` file contains the list of all 8 GPUs that are available for usage inside the container: ```bash cat output.log Wed Apr 16 13:55:48 2025 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.54.15 Driver Version: 550.54.15 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA H100 80GB HBM3 On | 00000000:8D:00.0 Off | 0 | | N/A 29C P0 73W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 1 NVIDIA H100 80GB HBM3 On | 00000000:91:00.0 Off | 0 | | N/A 27C P0 67W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 2 NVIDIA H100 80GB HBM3 On | 00000000:95:00.0 Off | 0 | | N/A 29C P0 67W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 3 NVIDIA H100 80GB HBM3 On | 00000000:99:00.0 Off | 0 | | N/A 27C P0 71W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 4 NVIDIA H100 80GB HBM3 On | 00000000:AB:00.0 Off | 0 | | N/A 29C P0 70W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 5 NVIDIA H100 80GB HBM3 On | 00000000:AF:00.0 Off | 0 | | N/A 27C P0 70W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 6 NVIDIA H100 80GB HBM3 On | 00000000:B3:00.0 Off | 0 | | N/A 29C P0 69W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ | 7 NVIDIA H100 80GB HBM3 On | 00000000:B7:00.0 Off | 0 | | N/A 26C P0 68W / 700W | 0MiB / 81559MiB | 0% Default | | | | Disabled | +-----------------------------------------+------------------------+----------------------+ +-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | No running processes found | +-----------------------------------------------------------------------------------------+ ``` # Running jobs in containers by using Docker Source: https://docs.nebius.com/slurm-soperator/jobs/containers/docker.md Soperator clusters allow you to use Docker Engine to run jobs in containers. ## Limitations When using Docker Engine with Slurm, consider the following limitations: * **Docker Engine doesn't respect Slurm resource allocations.** Docker may use all resources of a node, regardless of the settings that you specify in `sbatch`. We recommend using [Enroot](https://docs.nebius.com/slurm-soperator/jobs/containers/pyxis-enroot.md) or [other supported container runtimes](https://docs.nebius.com/slurm-soperator/jobs/containers/index.md) to run Docker containers. If you want to use Docker Engine, use the `-N` and `--exclusive` settings to allocate entire nodes to Slurm jobs. * **Docker containers aren't managed as part of the Slurm job lifecycle.** If a job is canceled, fails or times out, containers started with `srun docker run` continue running. Stop them manually or adjust your job script to stop the containers when the job receives the `SIGTERM` or `SIGKILL` signals. * **Performance may be degraded without local disks.** If no local disk is available, Docker uses the [VFS storage driver](https://docs.docker.com/engine/storage/drivers/vfs-driver/), which leads to significantly lower performance. ## How to run a Docker container in a Slurm job 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) to a login node of your Soperator cluster. 2. Create a batch script that runs your workload in a container. For example, create the `test_nccl.sh` script with the following contents: ```bash #!/bin/bash #SBATCH -J docker-all-reduce #SBATCH -N 2 #SBATCH --exclusive #SBATCH --output=output.log srun docker run --device=/dev/infiniband nvidia/cuda:12.8.0-runtime-ubuntu24.04 bash -c ' echo "Installing additional dependencies..." apt update -y && apt install -y wget rdma-core ibverbs-utils echo "Installing NCCL tests..." wget -P /tmp https://github.com/nebius/slurm-deb-packages/releases/download/nccl_tests_12.8.0/nccl-tests-perf.tar.gz tar -xvzf /tmp/nccl-tests-perf.tar.gz -C /usr/bin && rm -rf /tmp/nccl-tests-perf.tar.gz echo "Starting all_reduce_perf..." /usr/bin/all_reduce_perf -b 512M -e 8G -f 2 -g 8 ' ``` This script pulls a Docker image with Ubuntu and CUDA® toolkit from NVIDIA®, then installs [NVIDIA Collective Communications Library (NCCL) tests](https://github.com/NVIDIA/nccl-tests) and their dependencies, and runs NCCL tests in a Docker container. The script uses the following parameters: * `#SBATCH -N` specifies how many nodes to allocate. * `#SBATCH --exclusive` specifies that no other jobs may be scheduled on these nodes until this job is completed. * `--device=/dev/infiniband` parameter for `docker` allows access to InfiniBand™ from inside Docker containers. If your workload needs access to the shared filesystem, you can add the `-v` parameter to make paths from the shared filesystem visible from inside the container: ```bash srun docker run -v : ``` 3. Start the job: ```bash sbatch test_nccl.sh ``` The output contains the job ID: ```bash Submitted batch job ``` 4. When the job is completed, review the contents of `output.log`. The output contains the logs of the container starting up and installing dependencies, followed by the results of NCCL tests. For example: ```bash ========== == CUDA == ========== CUDA Version 12.8.0 ... Installing additional dependencies... Get:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64 Packages [1607 kB] ... Starting all_reduce_perf... # nThread 1 nGpus 8 minBytes 536870912 maxBytes 8589934592 step: 2(factor) warmup iters: 5 iters: 20 agg iters: 1 validation: 1 graph: 0 # # Using devices # Rank 0 Group 0 Pid 1 on 1ae1d8baa190 device 0 [0x8d] NVIDIA H100 80GB HBM3 # Rank 1 Group 0 Pid 1 on 1ae1d8baa190 device 1 [0x91] NVIDIA H100 80GB HBM3 # Rank 2 Group 0 Pid 1 on 1ae1d8baa190 device 2 [0x95] NVIDIA H100 80GB HBM3 # Rank 3 Group 0 Pid 1 on 1ae1d8baa190 device 3 [0x99] NVIDIA H100 80GB HBM3 # Rank 4 Group 0 Pid 1 on 1ae1d8baa190 device 4 [0xab] NVIDIA H100 80GB HBM3 # Rank 5 Group 0 Pid 1 on 1ae1d8baa190 device 5 [0xaf] NVIDIA H100 80GB HBM3 # Rank 6 Group 0 Pid 1 on 1ae1d8baa190 device 6 [0xb3] NVIDIA H100 80GB HBM3 # Rank 7 Group 0 Pid 1 on 1ae1d8baa190 device 7 [0xb7] NVIDIA H100 80GB HBM3 # # out-of-place in-place # size count type redop root time algbw busbw #wrong time algbw busbw #wrong # (B) (elements) (us) (GB/s) (GB/s) (us) (GB/s) (GB/s) 536870912 134217728 float sum -1 2145.0 250.29 438.01 0 2146.1 250.16 437.78 0 1073741824 268435456 float sum -1 4036.8 265.99 465.47 0 4041.8 265.66 464.90 0 2147483648 536870912 float sum -1 7917.9 271.22 474.63 0 7921.6 271.09 474.41 0 4294967296 1073741824 float sum -1 15729 273.06 477.85 0 15710 273.40 478.45 0 8589934592 2147483648 float sum -1 31257 274.81 480.93 0 31278 274.63 480.60 0 # Out of bounds values : 0 OK # Avg bus bandwidth : 467.303 ``` ## How to run a Docker container in an interactive mode 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) to a login node of your Soperator cluster. 2. To run an interactive session on a node and prevent any other allocations on this node, use [salloc](https://slurm.schedmd.com/salloc.html): ```bash salloc --exclusive ``` This command allocates a worker node to a new job and opens a terminal on this node. Output example: ```bash salloc: Granted job allocation @worker-:~$ ``` 3. Start a Docker container on a worker node: ```bash docker run --rm ``` The `--rm` parameter ensures that the container is automatically deleted when it exits. If your workload needs access to the shared filesystem, use the `-v` parameter to make paths from the shared filesystem visible from inside the container: ```bash docker run --rm -v : ``` For multi-node GPU workloads, use the `--device=/dev/infiniband` parameter for `docker` that allows access to InfiniBand from inside Docker containers. 4. After you finish the interactive session and exit, you can see the confirmation that the node is no longer allocated: ```bash exit salloc: Relinquishing job allocation salloc: Job allocation has been revoked. @login-0:~$ ``` ## How to get information about your Docker containers To list all containers, including the ones that are already finished, [connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-worker-nodes) to a worker node and run the following command: ```bash docker ps -a ``` For more details on Docker commands and parameters, see the [Docker documentation](https://docs.docker.com/reference/cli/docker/container/). *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Managing jobs in Soperator clusters Source: https://docs.nebius.com/slurm-soperator/jobs/manage.md You can use Slurm commands to view and manage jobs in your Soperator cluster. To run these commands, [connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) to the cluster's login node. ## How to view job list and details ### Jobs in queue To list all jobs that are currently in the queue, use the [squeue](https://slurm.schedmd.com/squeue.html) command. You can use various parameters to specify the output format: * `--long` to include more details. For example: ```bash squeue --long ``` Output example: ```bash JOBID PARTITION NAME USER STATE TIME TIME_LIMI NODES NODELIST(REASON) 837 main test-job user RUNNING 0:11 UNLIMITED 2 worker-[0-1] ``` * `--Format` to customize output columns and their width. For example: ```bash squeue --Format "JobID:8,Partition:10,Name,UserName,State:16,TimeUsed:8,NumNodes:6,ReasonList" ``` Output example: ```bash JOBID PARTITION NAME USER STATE TIME NODES NODELIST(REASON) 837 main test-job user RUNNING 0:05 2 worker-[0-1] ``` * `--steps` to show job steps, that is, sets of tasks within a job. For example: ```bash squeue --steps ``` Output example: ```bash Tue Apr 29 16:23:39 2025 STEPID NAME PARTITION USER TIME NODELIST 837.0 test main user 1:26 worker-[0-1] 837.batch batch main user 1:27 worker-1 ``` ### All jobs The `squeue` command doesn't list completed or failed jobs. To get the full details of all recently run jobs, use the [scontrol](https://slurm.schedmd.com/scontrol.html) command: ```bash scontrol show jobs | less ``` Output example: ```bash JobId= JobName= UserId=(1001) GroupId=(1001) MCS_label=N/A Priority=1 Nice=0 Account=(null) QOS=normal JobState=RUNNING Reason=None Dependency=(null) Requeue=1 Restarts=0 BatchFlag=1 Reboot=0 ExitCode=0:0 RunTime=00:00:38 TimeLimit=UNLIMITED TimeMin=N/A SubmitTime=2025-04-30T15:51:21 EligibleTime=2025-04-30T15:51:21 AccrueTime=2025-04-30T15:51:21 StartTime=2025-04-30T15:51:21 EndTime=Unknown Deadline=N/A PreemptEligibleTime=2025-04-30T15:51:21 PreemptTime=None SuspendTime=None SecsPreSuspend=0 LastSchedEval=2025-04-30T15:51:21 Scheduler=Main Partition=main AllocNode:Sid=login-0:919915 ReqNodeList=(null) ExcNodeList=(null) NodeList=worker-[0-1] BatchHost=worker-1 NumNodes=2 NumCPUs=256 NumTasks=2 CPUs/Task=1 ReqB:S:C:T=0:0:*:* ReqTRES=cpu=2,mem=3034G,node=2,billing=2 AllocTRES=cpu=256,mem=3034G,node=2,billing=256 Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* MinCPUsNode=1 MinMemoryNode=1517G MinTmpDiskNode=0 Features=(null) DelayBoot=00:00:00 OverSubscribe=NO Contiguous=0 Licenses=(null) Network=(null) Command= WorkDir= StdErr= StdIn=/dev/null StdOut= JobId= ... ... ``` By default, this command shows the jobs finished in the last 24 hours. The output is limited to 10,000 jobs. To find out how many jobs are displayed for your cluster, run the following command: ```bash scontrol show config | grep -E "MaxJobCount|MinJobAge" ``` Output for default settings: ```bash MaxJobCount = 10000 MinJobAge = 86400 sec ``` To list all jobs that were run on the cluster, use the [sacct](https://slurm.schedmd.com/sacct.html) command. ### Jobs and processes that run on specific nodes To get the list of jobs running on particular nodes, run the following command: ```bash squeue --nodelist="worker-[0-1]" ``` Change the `--nodelist` parameter value to include the nodes that you need. Output example: ```bash JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) 837 main test user R 0:05 2 worker-[0-1] ``` To get the job processes that are currently running on a given worker node, [connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-worker-nodes) to this node and use `scontrol listpids`. Run the following command: ```bash ssh worker-0 scontrol listpids ``` Output example: ```bash PID JOBID STEPID LOCALID GLOBALID 992342 933 0 0 1 992333 933 0 - - ``` ### Full details and batch script of a job To get the full details of a job, run the following command: ```bash scontrol show job ``` Output example: ```bash JobId= JobName= UserId=(1001) GroupId=(1001) MCS_label=N/A Priority=1 Nice=0 Account=(null) QOS=normal JobState=RUNNING Reason=None Dependency=(null) Requeue=1 Restarts=0 BatchFlag=1 Reboot=0 ExitCode=0:0 RunTime=00:00:38 TimeLimit=UNLIMITED TimeMin=N/A SubmitTime=2025-04-30T15:51:21 EligibleTime=2025-04-30T15:51:21 AccrueTime=2025-04-30T15:51:21 StartTime=2025-04-30T15:51:21 EndTime=Unknown Deadline=N/A PreemptEligibleTime=2025-04-30T15:51:21 PreemptTime=None SuspendTime=None SecsPreSuspend=0 LastSchedEval=2025-04-30T15:51:21 Scheduler=Main Partition=main AllocNode:Sid=login-0:919915 ReqNodeList=(null) ExcNodeList=(null) NodeList=worker-[0-1] BatchHost=worker-1 NumNodes=2 NumCPUs=256 NumTasks=2 CPUs/Task=1 ReqB:S:C:T=0:0:*:* ReqTRES=cpu=2,mem=3034G,node=2,billing=2 AllocTRES=cpu=256,mem=3034G,node=2,billing=256 Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=* MinCPUsNode=1 MinMemoryNode=1517G MinTmpDiskNode=0 Features=(null) DelayBoot=00:00:00 OverSubscribe=NO Contiguous=0 Licenses=(null) Network=(null) Command= WorkDir= StdErr= StdIn=/dev/null StdOut= ``` You can also retrieve the batch script used to run the job: ```bash scontrol write batch_script ``` This command creates a `slurm-.sh` file with the contents of the script. ### Job states You can see the current job state in the `STATE` column when you list jobs with `squeue` or in the `JobState` parameter when you get job details with `scontrol show job(s)`. Some of the common job states include: | Job state | Description | | - | - | | `PD` `PENDING` | The job is waiting for resource allocation. | | `R` `RUNNING` | The job is currently running. | | `S` `SUSPENDED` | The job execution was [suspended](https://docs.nebius.com/slurm-soperator/jobs/manage.md#suspend-and-resume-a-job). | | `CD` `COMPLETED` | The job has been completed successfully (processes on all nodes finished with a zero exit code). | | `RQ` `REQUEUED` | The job is being [requeued](https://docs.nebius.com/slurm-soperator/jobs/manage.md#requeue-a-job). | For a complete list of all possible job states, see the [Slurm documentation](https://slurm.schedmd.com/squeue.html#SECTION_JOB-STATE-CODES). ## How to manage jobs The `scontrol` command lets you manage the jobs in the queue. ### Suspend and resume a job You can suspend a job, which means that the job processes are terminated, but resource allocations are retained. Run the following command: ```bash scontrol suspend ``` The job is returned to the queue and waits in `SUSPENDED` status until you manually resume it: ```bash scontrol resume ``` The job is resumed and continues execution. ### Requeue a job You can requeue a job, which means that the job is terminated and returned to the queue. It restarts automatically when the resources are available. Run the following command to requeue a job: ```bash scontrol requeue ``` > [!WARNING] > > A requeued job keeps the same job ID. If your job writes some data at paths that depend only on the job ID, the data from the previous attempt may be overwritten by the requeued job. In Soperator clusters, some failed jobs are requeued by default. To check this setting for your cluster, run the following command: ```bash scontrol show config | grep JobRequeue ``` Output for default settings: ```bash JobRequeue = 1 ``` You may want to prevent a requeued job from being scheduled again automatically. To requeue a running job and put it on hold until you explicitly allow it to be scheduled, run the following command: ```bash scontrol requeuehold ``` To requeue and put on hold a job that hasn't started yet, run the following command: ```bash scontrol hold ``` To allow the job to be scheduled again as soon as there are available resources, run the following command: ```bash scontrol release ``` ### Cancel a job You can cancel job execution. Run the following command: ```bash scontrol cancel ``` The job is terminated and all resources are freed. # Running the all-reduce NCCL performance test in Soperator clusters Source: https://docs.nebius.com/slurm-soperator/jobs/examples/nccl-all-reduce.md Soperator includes pre-built [NVIDIA® Collective Communications Library (NCCL) tests](https://github.com/NVIDIA/nccl-tests) that you can use to validate collective communication between GPUs over the available high-performance network and assess network performance in your cluster. NCCL used in these benchmarks enables communication over NVLink for single-node runs, and over a combination of NVLink and InfiniBand™ for multi-node runs. There are two versions of NCCL tests included in Soperator: a single-node version (`all_reduce_perf`) and a multi-node version with the `_mpi` suffix (`all_reduce_perf_mpi`). In this article, you will run the `all_reduce_perf_mpi` NCCL test on multiple nodes. The all-reduce operation is important for synchronizing gradients during multi-GPU training, which makes `all_reduce_perf_mpi` useful for evaluating both network and compute resources. ## How to run the test 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md). 2. Create an output directory for Slurm logs: ```bash mkdir -p results ``` 3. Create an sbatch script for your platform and save it as `nccl_all_reduce.sbatch`: > [tab] 8 × NVIDIA H100/H200 > > ```bash title="nccl_all_reduce.sbatch" > #!/bin/bash > > #SBATCH --job-name=nccl_all_reduce > #SBATCH --time=30:00 > #SBATCH --output=results/%x-%j.out > #SBATCH --error=results/%x-%j.out > #SBATCH --nodes=8 > #SBATCH --gpus-per-node=8 > #SBATCH --ntasks-per-node=8 > #SBATCH --cpus-per-task=16 > #SBATCH --mem=0 > > echo "Job ID: ${SLURM_JOB_ID}" > echo "Start time: $(date -u '+%Y-%m-%d %H:%M:%SZ')" > > export UCX_NET_DEVICES=mlx5_0:1,mlx5_1:1,mlx5_2:1,mlx5_3:1,mlx5_4:1,mlx5_5:1,mlx5_6:1,mlx5_7:1 > > export NCCL_IB_QPS_PER_CONNECTION=2 > export NCCL_NVLS_ENABLE=1 > export NCCL_BUFFSIZE=8388608 > > srun --mpi=pmix all_reduce_perf_mpi -b 512M -e 16G -f 2 -g 1 > ``` > [tab] 8 × NVIDIA B200 > > ```bash title="nccl_all_reduce.sbatch" > #!/bin/bash > > #SBATCH --job-name=nccl_all_reduce > #SBATCH --time=30:00 > #SBATCH --output=results/%x-%j.out > #SBATCH --error=results/%x-%j.out > #SBATCH --nodes=8 > #SBATCH --gpus-per-node=8 > #SBATCH --ntasks-per-node=8 > #SBATCH --cpus-per-task=20 > #SBATCH --mem=0 > > echo "Job ID: ${SLURM_JOB_ID}" > echo "Start time: $(date -u '+%Y-%m-%d %H:%M:%SZ')" > > export UCX_NET_DEVICES=mlx5_4:1,mlx5_5:1,mlx5_6:1,mlx5_7:1,mlx5_8:1,mlx5_9:1,mlx5_10:1,mlx5_11:1 > > export NCCL_IB_QPS_PER_CONNECTION=2 > export NCCL_NVLS_ENABLE=1 > export NCCL_BUFFSIZE=8388608 > > srun --mpi=pmix all_reduce_perf_mpi -b 512M -e 16G -f 2 -g 1 > ``` > [tab] 8 × NVIDIA B300 > > ```bash title="nccl_all_reduce.sbatch" > #!/bin/bash > > #SBATCH --job-name=nccl_all_reduce > #SBATCH --time=30:00 > #SBATCH --output=results/%x-%j.out > #SBATCH --error=results/%x-%j.out > #SBATCH --nodes=8 > #SBATCH --gpus-per-node=8 > #SBATCH --ntasks-per-node=8 > #SBATCH --cpus-per-task=24 > #SBATCH --mem=0 > > echo "Job ID: ${SLURM_JOB_ID}" > echo "Start time: $(date -u '+%Y-%m-%d %H:%M:%SZ')" > > export UCX_NET_DEVICES=mlx5_4:1,mlx5_5:1,mlx5_6:1,mlx5_7:1,mlx5_8:1,mlx5_9:1,mlx5_10:1,mlx5_11:1 > > export NCCL_IB_QPS_PER_CONNECTION=2 > export NCCL_NVLS_ENABLE=1 > export NCCL_BUFFSIZE=8388608 > > srun --mpi=pmix all_reduce_perf_mpi -b 512M -e 16G -f 2 -g 1 > ``` 4. Submit the job: ```bash sbatch nccl_all_reduce.sbatch ``` The examples above assume the job is run on 8 nodes using the `#SBATCH --nodes` directive. To run on a different number of nodes, override this value using the command-line argument when submitting the job: `sbatch --nodes= nccl_all_reduce.sbatch`. Slurm uses the command-line value when both are present. For more details about running and configuring jobs, see [Running Slurm batch jobs](https://docs.nebius.com/slurm-soperator/jobs/index.md). ## Script structure and configuration The example scripts include three sections: 1. Slurm configuration parameters 2. Environment variables for NCCL tuning 3. Launch command for the parallel NCCL testing ### Slurm configuration parameters This section defines job parameters using `#SBATCH` directives. These directives configure job submission options. For more details, see [Job configuration](https://docs.nebius.com/slurm-soperator/jobs/index.md#job-configuration) and the [SBATCH documentation](https://slurm.schedmd.com/sbatch.html). * `--job-name`: Job name shown in the `squeue` and `sacct` output. * `--time`: Job time limit (30 minutes in these examples). * `--output`, `--error`: File names for the job output and error. You can use pattern substitution, for example: `%x` (job name) and `%j` (job ID). * `--nodes`: Number of Slurm worker nodes used for the test. You can override this with `sbatch --nodes=`. * `--gpus-per-node`: Number of GPUs per node. The examples use all available GPUs for each platform (for example, 8 GPUs on 8xH200 nodes). * `--ntasks-per-node`: Number of parallel processes per node. This example uses one process per GPU, so the value matches the number of GPUs (for example, 8). Some ML frameworks instead launch one process per node and handle parallelism internally; if you want to test how such frameworks would work, set this value to `1`. * `--cpus-per-task`: Number of CPUs per process. In these examples, all CPUs are evenly divided across processes (total cores ÷ number of GPUs). This helps ensure consistent performance and avoids interference from cluster defaults. For one-process-per-node setups, set the value to the total number of CPUs per node. For CPU counts for each platform, see [presets](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-gpu-platforms). * `--mem`: Amount of system memory per node. The examples use all available memory (`--mem=0`) to avoid unintended limitations from cluster defaults. You can also set a specific memory amount using units, for example: `--mem=4G`. ### Environment variables for NCCL tuning This section defines environment variables for NCCL and related parallel libraries. For more details, see the [NCCL environment variables documentation](https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/env.html). * `UCX_NET_DEVICES`: Comma-separated list of high-speed network interfaces used by the [Unified Communication X](https://openucx.org/documentation/) (UCX) library. UCX is commonly used as a transport layer in [Message Passing Interface](https://www.mpi-forum.org/) (MPI) implementations and other libraries (for example, [NVIDIA Inference Xfer Library](https://github.com/ai-dynamo/nixl) — NIXL). Use platform-specific values of 8 specific InfiniBand ports to achieve maximum bandwidth. Otherwise, use an Ethernet interface with IP connectivity across all worker nodes, for example: `UCX_NET_DEVICES=eth0`. * NCCL tuning variables: * `NCCL_IB_QPS_PER_CONNECTION=2`: Sets the number of InfiniBand queue pairs per connection to 2 (instead of the default 1). Using more queue pairs may improve throughput by increasing routing entropy. * `NCCL_NVLS_ENABLE=1`: Enables NVLink SHARP support, allowing the NVSwitch to offload part of the computation work. This option is typically enabled by default, but may be disabled in some container images. * `NCCL_BUFFSIZE=8388608`: Sets the size of the internal NCCL communication buffer to 8 MB. A larger buffer can help improve performance in some scenarios by allowing more data to be processed in each communication step. ### Launch command configuration This section uses the `srun` command to start the application in parallel across multiple nodes and processes, and defines arguments for both `srun` and NCCL tests. * `srun --mpi=pmix`: Selects the [Process Management Interface for Exascale](https://pmix.org/) (PMIx) used to exchange rank information between Slurm's launcher (`srun`) and the MPI library (in the case of `all_reduce_perf_mpi`, [Open MPI](https://docs.open-mpi.org/)). * `all_reduce_perf_mpi`: Runs the NCCL benchmark for the all-reduce operation, built with support for multi-node execution. NCCL also provides similar benchmarks for other collective operations like AllGather and ReduceScatter. After the executable name, the following [NCCL test arguments](https://github.com/NVIDIA/nccl-tests#arguments) are used: * `-b 512M`: Sets the minimum message size, meaning the test begins with messages of 512 MB. * `-e 16G`: Defines the maximum message size, so the test will go up to 16 GB. * `-f 2`: Specifies the multiplication factor, so each step doubles the message size (for example, 512 MB → 1 GB → 2 GB, etc.). * `-g 1`: Indicates that each thread will use 1 GPU. * `-t 1`: Sets the number of threads per process to 1. ## How to validate the results When the job finishes, it saves both the standard output and standard error to a file named `results/nccl_all_reduce-.out`. A successful run should: * Complete without errors * Show `# Out of bounds values : 0 OK` * Show increasing bus bandwidth (`busbw`) as the collective message size grows. In most cases, `busbw` will reach a stable peak bandwidth at larger collective operation sizes. ### Example output This example was generated on a cluster of 8 virtual machines, each equipped with 8 NVIDIA H200 GPUs: ```text # Rank 0 Group 0 Pid 121061 on worker-0 device 0 [0000:8d:00] NVIDIA H200 ... # Rank 63 Group 0 Pid 89331 on worker-13 device 7 [0000:b7:00] NVIDIA H200 # # out-of-place in-place # size count type redop root time algbw busbw #wrong time algbw busbw #wrong # (B) (elements) (us) (GB/s) (GB/s) (us) (GB/s) (GB/s) 536870912 134217728 float sum -1 3489.1 153.87 302.94 0 3343.1 160.59 316.16 0 1073741824 268435456 float sum -1 6060.2 177.18 348.82 0 6061.9 177.13 348.72 0 2147483648 536870912 float sum -1 11523 186.36 366.89 0 11799 182.00 358.32 0 4294967296 1073741824 float sum -1 22312 192.49 378.97 0 22410 191.65 377.31 0 8589934592 2147483648 float sum -1 44596 192.62 379.22 0 44542 192.85 379.67 0 # Out of bounds values : 0 OK # Avg bus bandwidth : 355.703 # ``` > [!NOTE] > > The values above are provided for illustrative purposes. Actual results may vary depending on factors such as hardware or system configuration. The result file begins with a header that includes metadata about the run, such as the NCCL tests version, NCCL library version, the list of GPUs used and the rank assigned to each GPU on every allocated worker node. This is followed by multiple lines, with one line per collective message size. Each line contains several fields describing the test configuration and results for that message size, including: * Size of the exchange (in bytes) * Element count (based on the data type) * Data type (for example, floating point) * Reduction operation (for example sum) * Rank-related information For each message size, the test runs in two modes: * Out-of-place, where input and output buffers are separate * In-place, where input and output share the same buffer For each iteration of the test, three metrics are reported: * **Time:** Duration of a single collective operation iteration, measured in microseconds (μs). * **Algorithm bandwidth** (`algbw`): Size of the input array for collective operation divided by time. Shows how fast one iteration completes based on the data size. * **Bus bandwidth** (`busbw`): Algorithm bandwidth corrected for the number of communicating ranks to better estimate the peak hardware bandwidth. Due to this correction and the large speed difference of NVLink and InfiniBand, the final bus bandwidth value may not accurately reflect true hardware bandwidth. For example, in some scenarios, such as two-node runs that involve both NVLink and InfiniBand, the `busbw` value can overestimate the load on InfiniBand. `Avg bus bandwidth` is the average of all `busbw` values reported across the different message sizes. When interpreting or comparing this average, consider the range of message sizes used in the test (defined by the `-b`, `-e` and `-f 2` arguments, and visible in the `size` column). Smaller message sizes typically result in lower bus bandwidth, while larger sizes reach higher bandwidth. As a result, the average can vary significantly depending on the size range included in the test. For more details about the test and understanding its results, see [NCCL tests documentation](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md). *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Health management of worker nodes in Soperator clusters Source: https://docs.nebius.com/slurm-soperator/worker-nodes-health.md Soperator has built-in health checks that continuously monitor the fleet of worker nodes in your cluster, and an auto-healing system that isolates and replaces broken nodes. When deployed in Nebius AI Cloud (Managed Service for Soperator or Pro Solution for Soperator), Soperator also relies on maintenance events from the Compute service and Kubernetes® to auto-heal worker nodes. You can also use custom health checks to run additional checks on worker nodes. ## Health management in Soperator ### Built-in health checks For all deployment types, Soperator runs built-in health checks on a schedule for each worker node with GPUs. Most of these checks are considered critical: if a worker node fails a critical check, Soperator marks it as requiring further action. Critical checks include, but are not limited to, the following checks: * GPU checks: * [AllReduce](https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md#allreduce), an [NCCL test](https://github.com/NVIDIA/nccl-tests/tree/master) (with and without InfiniBand™, outside and inside Docker containers) * [CUDA samples](https://github.com/NVIDIA/cuda-samples), such as [vectorAdd](https://github.com/NVIDIA/cuda-samples/blob/master/Samples/0_Introduction/vectorAdd), [simpleMultiGPU](https://github.com/NVIDIA/cuda-samples/tree/master/Samples/0_Introduction/simpleMultiGPU), [deviceQuery](https://github.com/NVIDIA/cuda-samples/blob/master/Samples/1_Utilities/deviceQuery) and [p2pBandwidthLatencyTest](https://github.com/NVIDIA/cuda-samples/tree/master/Samples/5_Domain_Specific/p2pBandwidthLatencyTest) * [NVIDIA® Data Center GPU Manager](https://docs.nvidia.com/datacenter/dcgm/latest/user-guide/index.html) (DCGM) diagnostics * GPU stress test * RAM checks: bandwidth and latency For technical details and the full list of checks, see these resources in the Soperator repository on GitHub: * [Active Checks – Health and system checks framework](https://github.com/nebius/soperator/blob/main/docs/active-checks.md): description of checks' architecture and implementation * `soperator-activechecks` Helm chart: * [values.yaml](https://github.com/nebius/soperator/blob/main/helm/soperator-activechecks/values.yaml): list of checks * [scripts/](https://github.com/nebius/soperator/tree/main/helm/soperator-activechecks/scripts): scripts for each check ### Node isolation When a critical check fails, Soperator performs the *extensive check procedure*: 1. Drains the node, waiting for running Slurm jobs to finish. The drain reason has the `[node_problem]` prefix. 2. Moves the node into the *suspicious reservation*, preventing new jobs from being scheduled on it. 3. Runs extensive checks on the node, which include hardware-level tests and re-runs of most critical checks. ### Node replacement If the extensive checks fail, Soperator drains the node. The drain reason now has the `[hardware_problem]` prefix — Soperator marks all worker nodes with this prefix as unhealthy Kubernetes nodes, which triggers automatic re-creation of the node. If the node passes the extensive checks, Soperator removes it from the suspicious reservation, and jobs can run on the node again. In Managed Service for Soperator and Pro Solution for Soperator, Compute may schedule maintenance for an underlying virtual machine (VM) of the worker node during the extensive check procedure. This typically indicates a hardware issue already detected by Compute. In this case, Soperator immediately stops the checks, and then drains and recreates the node. ### Custom health checks (Slurm prolog and epilog programs) All Soperator deployment types support Slurm *prolog and epilog programs* for job steps. You can configure them by using `--task-prolog` and `--task-epilog` parameters of `srun`, either in [batch scripts](https://docs.nebius.com/slurm-soperator/jobs/index.md) or in direct `srun` calls. The prolog and epilog programs specified in `--task-prolog` and `--task-epilog` run on each worker node before and after the job step that is launched by the `srun` call. You can use them to run custom health checks on worker nodes. > For example, you can run `nvidia-smi` before and after the training step in your batch script (`my_ml_job.sh`) to check the GPU utilization and health: > > ```bash title="my_ml_job.sh" highlight={5} > #!/bin/bash > > # Directives, preparation steps, etc. > > srun --cpus-per-task=16 --task-prolog="/mnt/checks/smi.sh" --task-epilog="/mnt/checks/smi.sh" python train.py > ``` > > ```bash title="/mnt/checks/smi.sh" > #!/bin/bash > > nvidia-smi > ``` For more details about prolog and epilog programs, see [Slurm documentation](https://slurm.schedmd.com/prolog_epilog.html). By default, Soperator doesn't auto-heal worker nodes that fail custom health checks. To set up custom auto-healing in your Managed Soperator or Pro Solution for Soperator clusters, [contact support](https://console.nebius.com/support/create-ticket) or your personal manager. ## Upstream health checks in Managed Soperator In Managed Soperator, worker nodes are Compute virtual machines that serve as nodes in a Managed Service for Kubernetes cluster. Both Compute and Managed Kubernetes run their own health checks on worker nodes with GPUs, and Managed Soperator uses these health checks to automatically heal worker nodes, in addition to the [built-in health management system](https://docs.nebius.com/slurm-soperator/worker-nodes-health.md#health-management-in-soperator). ### Compute Compute continuously monitors hardware problems on VMs. When such a problem is detected on a VM, Compute [issues a maintenance event](https://docs.nebius.com/compute/virtual-machines/maintenance.md) for it. If a VM with a maintenance event is associated with a GPU worker node in a Managed Soperator cluster, Managed Soperator drains the node, waiting for running Slurm jobs to finish, and then re-creates the node. ### Kubernetes When Managed Service for Kubernetes signals a Kubernetes-specific maintenance condition that was not triggered by Compute, Managed Soperator drains the worker node, waiting for running Slurm jobs to finish, and then restarts the node. For more details about maintenance events and automatic recovery of nodes, see [Managed Kubernetes documentation](https://docs.nebius.com/kubernetes/maintenance/index.md). *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Downloading data in Soperator clusters Source: https://docs.nebius.com/slurm-soperator/storage/download-data.md Tasks that run on a Soperator cluster need large amounts of data, for example, datasets and machine learning checkpoints. You can download the data either to the shared filesystem of your Soperator cluster or to a [bucket in Object Storage](https://docs.nebius.com/object-storage/overview.md). You can use various tools to download data, depending on the size of data and the source of the download: * To download data from other Slurm clusters via SSH: * For smaller files, like code, binaries or container images, use [rsync](https://docs.nebius.com/slurm-soperator/storage/download-data.md#how-to-download-data-by-using-rsync). * For larger files, like datasets or ML checkpoints, use [rclone](https://docs.nebius.com/slurm-soperator/storage/download-data.md#how-to-download-data-by-using-rclone). * To download data to or from an Object Storage bucket or other S3-compatible storage: * For smaller files (up to 10 TiB), use [AWS CLI](https://docs.nebius.com/slurm-soperator/storage/download-data.md#how-to-download-data-by-using-the-aws-cli). * For larger files (up to 100 TiB), use [rclone](https://docs.nebius.com/slurm-soperator/storage/download-data.md#how-to-download-data-by-using-rclone). ## How to download data by using rsync [Rsync](https://rsync.samba.org/) can transfer files via SSH between a Soperator cluster and a remote server. You can use `rsync` to migrate data from an external data source to a Soperator cluster. Use `rsync` to download binaries, configuration files, container images, or other small files. It is not intended for transferring large files. Unlike other tools, `rsync` can preserve file permissions and ownerships. You can combine `rsync` with `rclone` to download the files with `rclone`, then update their permissions with `rsync`. For more information, see the [example](https://docs.nebius.com/slurm-soperator/storage/download-data.md#example-with-rclone-and-rsync-combined) below. You can transfer data with `rsync` [directly](https://docs.nebius.com/slurm-soperator/storage/download-data.md#download-data-directly) or [within a Slurm job](https://docs.nebius.com/slurm-soperator/storage/download-data.md#download-data-within-a-slurm-job). ### Download data directly For example, to download a directory via SSH from a remote server to the shared filesystem of your Soperator cluster: 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) of your Soperator cluster. 2. Run the following command: ```bash rsync -azP --no-sparse \ -e "ssh -i " \ @: \ ``` In this command, specify the following: * Private SSH key for the remote server * Username and host to connect to the remote server * Path to the remote directory with data * Path to the directory in the shared filesystem where the data should be downloaded ### Download data within a Slurm job A Slurm job uses a worker node that has more processing resources than a login node. In addition, data transfer via a Slurm job continues even if your connection to a login node is interrupted. To download data within a Slurm job: 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) of your Soperator cluster. 2. Create the `rsync_copy.batch` file in the shared filesystem of your Soperator cluster and paste the following contents into it: ```bash #!/bin/bash #SBATCH -J "rsync_copy" #SBATCH --nodes=1 #SBATCH --cpus-per-task=1 #SBATCH --mem=10G usage() { echo "usage: ${0} -f -t [-i ] [-h]" >&2 echo "" >&2 echo "Arguments and should follow the rsync syntax" >&2 echo "For example:" >&2 echo " -f bob@89.168.111.222:/home/bob/remote/path/ -t /home/bob/local/path/" >&2 echo " -f /home/bob/files -t /home/alice/files" >&2 echo "Argument is required if either or is an SSH endpoint" >&2 exit 1 } while getopts f:t:i:h flag do case "${flag}" in f) COPY_FROM=${OPTARG};; t) COPY_TO=${OPTARG};; i) COPY_SSH_KEY=${OPTARG};; h) usage;; *) usage;; esac done if [ -z "${COPY_FROM}" ] || [ -z "${COPY_TO}" ]; then usage fi echo "Copy data from ${COPY_FROM} to ${COPY_TO}" srun --export=COPY_FROM,COPY_TO,COPY_SSH_KEY \ rsync -azP --no-sparse \ -e "ssh -i ${COPY_SSH_KEY}" \ "${COPY_FROM}" \ "${COPY_TO}" ' echo "Done" ``` 3. Run a job to transfer data: ```bash sbatch rsync_copy.batch -- \ -i \ -f @: \ -t ``` In this command, specify the following: * Private SSH key for the remote server * Username and host to connect to the remote server * Path to the remote directory with data * Path to the directory in the shared filesystem where the data should be downloaded ## How to download data by using rclone [Rclone](https://rclone.org/docs/) is a versatile tool for downloading or uploading data between various locations. It needs more configuration than `rsync`, but after the initial setup it allows you to download large amounts of data (10-100 TiB) fast. To work with `rclone`, create the `~/.config/rclone/rclone.conf` configuration file on the machine from which you are running the commands. In this configuration file, create profiles for each remote location and specify in them information such as the address and type of the location, or credentials for connecting to it. For the full list of location types and possible settings for them, see the [rclone documentation](https://rclone.org/docs/). After you configure `rclone` profiles for several remote locations, you can move data between these locations or to the local machine. For example, to download data from an Object Storage bucket to a shared filesystem of a Soperator cluster: 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) of your cluster. 2. Create the `~/.config/rclone/rclone.conf` configuration file. For example, this file can have the following contents: ```ini [s3mlperf] type = s3 provider = AWS env_auth = false region = eu-north1 no_check_bucket = true endpoint = https://storage.eu-north1.nebius.cloud acl = private bucket_acl = private ``` This is a remote profile for an Object Storage bucket. Add more profiles for other locations if needed. 3. Create the `rclone_copy.batch` script that transfers data between remote locations that have `rclone` profiles configured, or to the shared filesystem of your Soperator cluster. Paste the following contents into the `rclone_copy.batch` file: ```bash #!/bin/bash #SBATCH -J "rclone_copy" #SBATCH --nodes=1 #SBATCH --cpus-per-task=64 #SBATCH --mem=500G usage() { echo "usage: ${0} -f -t [-h]" >&2 echo "" >&2 echo "Arguments and should follow the rclone syntax" >&2 echo "For example:" >&2 echo " -f my-s3-profile:s3-bucket/subpath -t /home/bob/local/path" >&2 echo " -f /home/bob/local/path -t my-ssh-profile:/home/bob/remote/path" >&2 exit 1 } while getopts f:t:h flag do case "${flag}" in f) COPY_FROM=${OPTARG};; t) COPY_TO=${OPTARG};; h) usage;; *) usage;; esac done if [ -z "${COPY_FROM}" ] || [ -z "${COPY_TO}" ]; then usage fi echo "Copy data from ${COPY_FROM} to ${COPY_TO}" srun --export=COPY_FROM,COPY_TO \ bash -c ' echo "Set umask so that new files have 666 permission" umask 000 echo "Start rclone" rclone copy "${COPY_FROM}" "${COPY_TO}" --progress --links \ --transfers=32 --buffer-size=128Mi \ --multi-thread-streams=24 --multi-thread-chunk-size=128Mi \ --multi-thread-cutoff=4Gi --multi-thread-write-buffer-size=128Mi \ --checkers=24 --size-only \ --update --use-server-modtime --fast-list \ --s3-no-head-object --s3-chunk-size=32M \ --sftp-chunk-size=120k --sftp-concurrency=64 ' echo "Done" ``` The [rclone sync](https://rclone.org/commands/rclone_sync/) command synchronizes the contents of directories in two locations. To download data into an empty directory, you can also use [rclone copy](https://rclone.org/commands/rclone_copy/) or other [rclone subcommands](https://rclone.org/docs/#subcommands). 4. Run a job to download the data from the `slurm-mlperf-training` Object Storage bucket to the `mlperf-data` directory in the shared filesystem of your Soperator cluster: ```bash sbatch rclone_copy.batch -- \ -f s3mlperf:slurm-mlperf-training \ -t /mlperf-data ``` The job runs on one of the worker nodes and downloads the data to the shared filesystem, so that all nodes can access it. ### How to use several nodes for data download `rclone` is a single-node utility and doesn't let you take full advantage of Slurm parallelism. However, to speed up large downloads, you can distribute the load manually. To do so, start several jobs by using the `rclone_copy.batch` script described above and specify a different subdirectory in each job. As the Soperator cluster has a shared filesystem, the downloaded data is available to all nodes. ## Example with rclone and rsync combined `rclone` downloads files from a remote server faster than `rsync`. However, `rsync` can preserve file ownerships and permissions. You can combine these two instruments: download the files first with `rclone`, which is fast, then adjust permissions with `rsync`. To download data from a remote location configured in the `rclone` configuration file to a local directory: 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) of your Soperator cluster. 2. Create the `~/.config/rclone/rclone.conf` configuration file. In this file, specify profiles for all remote locations that you are going to use. 3. Submit the job that runs the [rclone\_copy.batch](https://docs.nebius.com/slurm-soperator/storage/download-data.md#how-to-download-data-by-using-rclone) script: ```bash sbatch rclone_copy.batch \ -f : \ -t ``` In this command, specify the following: * Name of the remote profile configured in `rclone.conf` and path to the remote directory with data * Path to the directory in the shared filesystem where the data should be downloaded 4. Get the job ID from the output of the last command: ```bash Submitted batch job ``` 5. Submit the job that runs the [rsync\_copy.batch](https://docs.nebius.com/slurm-soperator/storage/download-data.md#how-to-download-data-by-using-rsync) script with the condition that it should start after the previous job completes: ```bash sbatch rsync_copy.batch \ --dependency=afterok: \ -i \ -f @: \ -t ``` In this command, specify: * ID of the job running `rclone` that you obtained in the previous step * Private SSH key for the remote server * Username and host to connect to the remote server, and path to the remote directory with data * Path to the directory in the shared filesystem where the data should be downloaded ## How to download data by using the AWS CLI The [AWS CLI](https://docs.aws.amazon.com/cli/latest/) allows you to download data from any S3-compatible storage, including buckets in Object Storage. You can use it for smaller amounts of data (no more than 10 TiB). 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) of your Soperator cluster. 2. Create the `aws_copy.batch` file with the following contents: ```bash #!/bin/bash #SBATCH -J "aws_copy" #SBATCH --nodes=1 #SBATCH --cpus-per-task=64 #SBATCH --mem=500G srun aws s3 sync s3:///[] ``` 3. Submit the `aws_copy.batch` job: ```bash sbatch aws_copy.batch ``` For more information, see the [AWS CLI reference](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html). # Managing file access in a Soperator cluster Source: https://docs.nebius.com/slurm-soperator/storage/manage-access.md As you run machine learning workloads on the Managed Service for Soperator cluster, you need to manage access to the training data and the results of training. You can create multiple groups and users to give people with separate roles different levels of access to your data. ## How to create user groups You can [create users](https://docs.nebius.com/slurm-soperator/users/manage.md#how-to-create-a-user) for everyone who works with your cluster and add multiple groups that give their members different access permissions. Each user may be a member of several groups. > [!NOTE] > > You need administrator privileges to create users and groups. ### Add a group ```bash sudo addgroup ``` ### Add a user to a group ```bash sudo adduser ``` For the group membership to take effect, after you add a user to a new group, ask them to log out and [reconnect](https://docs.nebius.com/slurm-soperator/clusters/connect.md) to your cluster. ## How to manage default permissions for created files When you create a new file or directory, its permissions are determined by the [`umask` value](https://docs.nebius.com/slurm-soperator/storage/manage-access.md#umask) and the [default group settings](https://docs.nebius.com/slurm-soperator/storage/manage-access.md#default-groups) on the directory where the file is created. ### umask The `umask` specifies which bits are removed from the full permissions (`666` for files and `777` for directories). All possible permissions are listed in full in the [Ubuntu documentation](https://help.ubuntu.com/community/FilePermissions). Check your `umask` value: ```bash umask ``` The usual default value is `0002`, which means that the permissions are the following: * For new files: `0666-0002 → 0664` — everyone can read, the owner and file group members can write. * For new directories `0777-0002 → 0775` — everyone can read and execute, the owner and file group members can write. To create new files and directories with more restrictive permissions, set a different `umask`, for example: ```bash umask 0022 ``` This setting removes the write permissions from anyone but the file owner. New files are created with `644` permission, and new directories with `775`. To make the `umask` setting permanent for the current user, add it to the shell configuration: ```bash echo 'umask 0022' >> ~/.bashrc ``` ### Default groups By default, a new file belongs to the primary group of the user who created it. For a shared directory owned by a group, you may want all new files created in the directory to inherit the same group. To do that, set the `setgid` bit in its permissions: `2` instead of `0` in the high-order octal digit of the group permissions. To set the group ownership and inherit file permissions, run the following commands: ```bash sudo chown : sudo chmod 2755 ``` ## How to set granular permissions with ACLs Access Control Lists (ACLs) let you override the default permissions and explicitly specify which users or groups have different levels of access to specific files or directories. Use the `setfacl` command to set the ACL for a file or directory. For example, to give a user read and write permissions to a file, run the following command: ```bash setfacl -m u::rw- ``` To give all group members read-only access to a file, run the following command: ```bash setfacl -m g::r-- ``` ### Set default access to a directory To set default permissions, add the `-d` parameter to the `setfacl` command. This modifies the default ACL, and all new files created in this directory inherit these permissions. For example, to give all group members read, write and execute permissions to a directory and all new files created in it, run the following command: ```bash setfacl -d -m g::rwx / ``` To give a specific user read and execute permissions to a directory and all new files created in it, run the following command: ```bash setfacl -d -m u::r-x / ``` ### View current ACLs To check the current ACLs for a file or directory, run the following command: ```bash getfacl ``` Example output for a file: ```bash # file: file.txt # owner: alice # group: developers user::rw- user:test_user:r-- group::rw- group:testers:r-- other::r-- ``` Example output for a directory: ```bash # file: mnt/data # owner: alice # group: developers user::rwx user:test_user:r-- group::rwx group:testers:r-- other::r-- ``` ## Main scenarios Depending on your workflow, you can create read-only datasets or read-write working directories and configure access for individual groups or all users. ### Read-only dataset shared with all users Create a shared dataset that contains source data for training or evaluation. Make it read-only to prevent accidental changes or data corruption and ensure consistency across all training runs. 1. Create a directory in a shared filesystem, for example: ```bash sudo mkdir /mnt/data/datasets/imagenet ``` 2. Set permissions so that all users can read files, but only administrators can modify them: ```bash sudo chown root:root /mnt/data/datasets/imagenet sudo chmod 755 /mnt/data/datasets/imagenet ``` 3. Make sure your users can access it: * Single jobs can access the shared filesystem and the directory in it. * If needed, the users can mount the shared directory as a volume to their jobs or containers, in read-only mode. If at some point the users need to write to this directory, they have to use `sudo`. ### Read-write directory for training results Use a separate directory to save checkpoints, model outputs, and logs. Make it writable by the job owners or a specific team. 1. Create a directory for results: ``` sudo mkdir /mnt/data/results ``` 2. [Create user groups](https://docs.nebius.com/slurm-soperator/storage/manage-access.md#add-a-group) (for example, `mlteam`) and [add users to them](https://docs.nebius.com/slurm-soperator/storage/manage-access.md#add-a-user-to-a-group). For the group membership to take effect, ask the users to log out and reconnect to your cluster. 3. Grant write permissions to the required group, for example: ```bash sudo chown :mlteam /mnt/data/results sudo chmod 2775 /mnt/data/results ``` The `2` in `2775` sets the `setgid` bit to ensure that all new files in the directory inherit the group. Encourage users to organize their work into subdirectories by project or date to avoid file conflicts when writing to the directory. ### Collaboration between two groups When two groups work on related tasks, configure three shared directories: private to group A, private to group B, and accessible to everyone. 1. [Create user groups](https://docs.nebius.com/slurm-soperator/storage/manage-access.md#add-a-group). For example, `groupA` and `groupB` for each of the teams, and `users` for everyone. 2. [Add users](https://docs.nebius.com/slurm-soperator/storage/manage-access.md#add-a-user-to-a-group) to the groups. For the group membership to take effect, ask the users to log out and reconnect to your cluster. 3. Create the directories: ```bash sudo mkdir -p /mnt/data/collab/groupA /mnt/data/collab/groupB /mnt/data/collab/common ``` 4. Set the `groupA` and `groupB` directory permissions to full access for the corresponding group and no access for anyone else: ```bash sudo chown :groupA /mnt/data/collab/groupA sudo chmod 2770 /mnt/data/collab/groupA sudo chown :groupB /mnt/data/collab/groupB sudo chmod 2770 /mnt/data/collab/groupB ``` The `2` in `2770` sets the `setgid` bit to ensure that all new files in the directory inherit the group. 5. Set the `common` directory permissions to let everyone in the `users` group have full access: ```bash sudo chown :users /mnt/data/collab/common sudo chmod 2775 /mnt/data/collab/common ``` This structure allows each group to store private data while sharing common outputs or logs with all users. # Managing users in a Soperator cluster Source: https://docs.nebius.com/slurm-soperator/users/manage.md Create users in a Soperator cluster so they can [connect to the cluster nodes](https://docs.nebius.com/slurm-soperator/clusters/connect.md). A Soperator cluster uses the [Ubuntu user management tools](https://documentation.ubuntu.com/server/how-to/security/user-management/index.html), so user administration on Soperator is similar to user administration on Ubuntu. The general difference is that you [create users](https://docs.nebius.com/slurm-soperator/users/manage.md#how-to-create-a-user) with the `soperator-createuser` command, Soperator's wrapper over Ubuntu's [adduser](https://manpages.ubuntu.com/manpages/jammy/en/man8/adduser.8.html) command. Every Soperator cluster has a default administrator called `root`. To manage users, connect to cluster nodes as `root`. > [!WARNING] > > Only users with administrator privileges can create and delete other users. If you are not the `root` user, run the creation and deletion commands with `sudo`. ## How to create a user 1. Ask a user to [generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md) and provide you with their SSH public key. They will use this key for connections. 2. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes). 3. Run the user creation command and specify a new username: ```bash soperator-createuser [--with-password] [--without-sudo] [--without-docker] ``` You can add optional parameters. The `soperator-createuser` command supports the [same parameters](https://manpages.ubuntu.com/manpages/jammy/en/man8/adduser.8.html) as `adduser` and has several parameters of its own: * `--with-password`: Requires a password for the new user, in addition to their SSH key. * `--without-sudo`: Disables the default option to run commands with `sudo` for the user. * `--without-docker`: Disables the default option to run `docker` commands without `sudo` for the user. By default, `soperator-createuser` adds the user to the Unix `docker` group, which allows running `docker` commands without `sudo`. You can disable this by using the `--without-docker` parameter. For more information about the group, see the [Docker documentation](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user). 4. At the prompt that appears, enter the following information: * Password of the user, if you specified the `--with-password` parameter. * Optional full name of the user. We recommend specifying it, especially if the username does not match the full name. This helps you recognize the user. * Additional optional information, such as their room number or work phone. * SSH public key of the user. ## How to get a list of users 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes). 2. Run the user list command: ```bash getent passwd ``` Output example: ```text root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin ... test-user-1:x:1004:1004:Test User Name,,,:/home/test-user-1:/bin/bash ``` System users have IDs that are less than `1000`. Regular users have IDs that are larger than or equal to `1000`. In the example above, the system `bin` user has the ID `2` and the regular `test-user-1` user has the ID `1004`. ## How to delete a user 1. [Connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes). 2. To copy the username, [get the list of users](https://docs.nebius.com/slurm-soperator/users/manage.md#how-to-get-a-list-of-users). 3. Run the user deletion command: ```bash deluser --remove-home ``` The command deletes the user and its home directory. Output example: ```text Looking for files to backup/remove ... Removing files ... Removing user `test-user-1' ... Warning: group `test-user-1' has no more members. Done. ``` For more information about deleting users by using `deluser`, see the [Ubuntu documentation](https://documentation.ubuntu.com/server/how-to/security/user-management/index.html#delete-a-user). # How to monitor job and node statuses in a Soperator cluster Source: https://docs.nebius.com/slurm-soperator/monitoring/statuses.md In a Soperator cluster, Slurm nodes run as Kubernetes® Pods. You can monitor the nodes by using Slurm commands, which are listed in a [cheat sheet](https://github.com/nebius/nebius-solution-library/blob/main/docs/SLURM-Quick-reference.pdf). For more information about monitoring an underlying Kubernetes cluster, see [Managed Service for Kubernetes® documentation](https://docs.nebius.com/kubernetes/monitoring.md). To run the monitoring commands, [connect to a login node](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes). ## Cluster status To list current worker nodes, run the following command: ```bash sinfo -Nel ``` This command returns a list of detailed information about the nodes. For more information about other parameters available for `sinfo`, see [Slurm documentation](https://slurm.schedmd.com/sinfo.html#SECTION_OPTIONS). Output example: ```text NODELIST NODES PARTITION STATE CPUS S:C:T MEMORY TMP_DISK WEIGHT AVAIL_FE REASON worker-0 1 main* idle 128 2:32:2 155340 0 1 (null) none worker-1 1 main* idle 128 2:32:2 155340 0 1 (null) none ``` Only worker nodes are listed in this view. If the node state has an asterisk next to it, for example, `idle*`, this means that the node did not respond and it is unavailable. The node goes `down` if it does not respond quickly. For more information about common node states, see [Node states](https://docs.nebius.com/slurm-soperator/monitoring/statuses.md#node-states). You can customize the columns in the `sinfo` output by using the `-o` parameter. For example, `sinfo -o "%20P %5D %14F %8z %10m %10d %11l %16f %N"` lists the partitions, gives you the total number of nodes and shows which nodes are free, how much memory is available and the time limits for jobs currently being executed. For more information about these parameters, see [Slurm documentation](https://slurm.schedmd.com/sinfo.html#OPT_format). To get more information about a particular node, run the following command: ```bash scontrol show node ``` ### Node states Some of the common node states include: | Node state | Description | State causes | | - | - | - | | `idle` | The node is not currently running any jobs and is available for scheduling. | No jobs assigned yet. | | `allocated` | The node is actively running one or more jobs. | A job has been assigned and is executing. | | `mixed` | Some CPUs on the node are allocated to jobs, while others remain idle. | Partial job allocations. | | `down` | The node is unavailable for use. | Hardware failure, maintenance, or manual marking by an admin. | | `drained` | The node is excluded from the scheduling pool for new jobs. Jobs submitted before the node was drained may run to completion. | Marked for draining manually or by Soperator health checks. | | `unknown` | The node state cannot be determined. | Communication issues between the controller and the node. | | `fail` | The node has failed and cannot execute jobs. | Critical hardware or software issues. | For a complete list of all possible node states, see [Slurm documentation](https://slurm.schedmd.com/sinfo.html#SECTION_NODE-STATE-CODES). ### How to drain and resume a node To drain a node (that is, stop scheduling more jobs and make the node unavailable), run the following command: ```bash scontrol update NodeName= State=drain Reason="" ``` To resume a node that was drained, run the following command: ```bash scontrol update NodeName= State=resume ``` ## Job queue To list all jobs currently running or pending (that is, waiting for resources), run the following command: ```bash squeue -a ``` To list all jobs currently running, run the following command: ```bash squeue -tR ``` Output example: ```text JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) 116 main nccl test-user R 0:17 1 worker-1 ``` For pending jobs with the `PD` status, the `NODELIST(REASON)` column shows the reason why the job is pending. For more information about possible reasons for this status, see [Slurm documentation](https://slurm.schedmd.com/squeue.html#SECTION_JOB-REASON-CODES). ### Job details To use the job ID to get more details about the job, run the following command: ```bash scontrol show job ``` ### Completed job statistics To get the details about the jobs already completed, run the following command: ```bash sacct -a ``` Output example: ```text JobID JobName Partition Account AllocCPUS State ExitCode ------------ ---------- ---------- ---------- ---------- ---------- -------- 24 nccl_test main root 16 COMPLETED 0:0 24.0 nccl_test root 16 COMPLETED 0:0 ``` For more information about additional parameters available for `sacct`, see [Slurm documentation](https://slurm.schedmd.com/sacct.html#SECTION_OPTIONS). # Monitoring metrics of Soperator clusters Source: https://docs.nebius.com/slurm-soperator/monitoring/metrics.md You can monitor the performance of your Soperator cluster on preconfigured dashboards in Grafana®. ## Prerequisites 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md) to your cluster. You should see the SSH welcome message. For example: ``` Welcome to Soperator cluster ... System information as of Thu May 8 10:43:02 UTC 2025: ... Slurm nodes: PARTITION CPUS MEMORY GRES NODES NODELIST STATE REASON main 128 1553408 gpu:nvidia_h100_80gb_hbm3:8(S:0-1) 2 worker-[0-1] idle none No user jobs in the queue No other users are currently logged in To open monitoring dashboards in your browser: 1. Execute this command on your local computer: `ssh -L 3000:metrics-grafana.monitoring-system.svc:80 -N @` 2. Open `localhost:3000` in your browser ... ``` 2. Get the command to open monitoring dashboards from the instructions in the SSH welcome message. In the example above, it is `ssh -L 3000:metrics-grafana.monitoring-system.svc:80 -N @`. The URL for your cluster might be different. ## How to view metrics in Grafana 1. On your local machine, run the command to open monitoring dashboards that you got from the SSH welcome message. For example: ```bash ssh -L 3000:metrics-grafana.monitoring-system.svc:80 -N @ ``` In this command, specify the `username` and `public_IP_address` that you use to [connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md) to the cluster. Optionally, change port `3000` if it is already in use on your local machine. 2. Open `localhost:3000` (or `localhost:`) in your browser. 3. In the sidebar, select **Dashboards**. Review the metrics on these dashboards. For example, you can see the metrics of Slurm jobs and resource allocations. ## How to view metrics for worker nodes The nodes of your Soperator cluster are Compute virtual machines. You can view their metrics on Monitoring [dashboards in the web console](https://docs.nebius.com/compute/monitoring/virtual-machines.md#explore-the-dashboard). To find out the ID of the virtual machine for a worker node: 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-login-nodes) to a login node of your Soperator cluster. 2. Run the following command: ```bash scontrol show node worker- ``` Output example: ```bash NodeName=worker-0 Arch=x86_64 CoresPerSocket=32 CPUAlloc=0 CPUEfctv=128 CPUTot=128 CPULoad=0.97 AvailableFeatures=(null) ActiveFeatures=(null) Gres=gpu:nvidia_h100_80gb_hbm3:8(S:0-1) NodeAddr=10.0.35.138 NodeHostName=worker-0 Version=24.05.5 OS=Linux 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 RealMemory=1553408 AllocMem=0 FreeMem=1421003 Sockets=2 Boards=1 State=IDLE+DYNAMIC_NORM ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A MCS_label=N/A Partitions=main BootTime=2025-03-11T11:28:45 SlurmdStartTime=2025-03-11T12:39:23 LastBusyTime=2025-05-08T13:42:21 ResumeAfterTime=None CfgTRES=cpu=128,mem=1517G,billing=128 AllocTRES= CurrentWatts=0 AveWatts=0 Extra={ "monitoring": "https://console.eu.nebius.com/project-e00x6706bdmd42yjyn/compute/instances/computeinstance-****/monitoring" } InstanceId=computeinstance-**** ``` Get the link from the `monitoring` parameter. 3. Open the link in your browser. There, you can view the dashboards for the virtual machine that runs the worker node. *** *The Grafana Labs Marks are trademarks of Grafana Labs, and are used with Grafana Labs' permission. We are not affiliated with, endorsed or sponsored by Grafana Labs or its affiliates.* # Viewing logs of Soperator clusters Source: https://docs.nebius.com/slurm-soperator/monitoring/logs.md You can view logs of your Soperator cluster either [in a browser](https://docs.nebius.com/slurm-soperator/monitoring/logs.md#how-to-view-logs-in-a-browser) or directly [on the worker nodes](https://docs.nebius.com/slurm-soperator/monitoring/logs.md#how-to-view-log-files-on-a-worker-node). ## Prerequisites 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md) to your cluster. You should see the SSH welcome message. For example: ``` Welcome to Soperator cluster ... System information as of Thu May 8 10:43:02 UTC 2025: ... Slurm nodes: PARTITION CPUS MEMORY GRES NODES NODELIST STATE REASON main 128 1553408 gpu:nvidia_h100_80gb_hbm3:8(S:0-1) 2 worker-[0-1] idle none ... To open logs explorer in your browser: 1. Execute this command on your local computer: `ssh -L 9428:vm-logs-victoria-logs-single-server.logs-system.svc:9428 -N @` 2. Open `localhost:9428/select/vmui` in your browser ... ``` 2. Get the command to open monitoring dashboards from the instructions in the SSH welcome message. In the example above, it is `ssh -L 9428:vm-logs-victoria-logs-single-server.logs-system.svc:9428 -N @`. The URL for your cluster might be different. ## How to view logs in a browser 1. On your local machine, run the command to open logs explorer that you got from the SSH welcome message. For example: ```bash ssh -L 9428:vm-logs-victoria-logs-single-server.logs-system.svc:9428 -N @ ``` In this command, specify the `username` and `public_IP_address` that you use to [connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md) to the cluster. 2. Open `localhost:9428/select/vmui` in your browser. 3. Explore the logs. You can use the [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/) language to write queries that filter the logs you want to review. For example: * Logs of the Slurm daemon that runs on the `worker-0` node: ``` k8s.container.name: "slurmd" AND k8s.pod.name: "worker-0" ``` * Logs of all Slurm controllers: ``` kubernetes.container_name: "slurmctld" ``` * Logs of Slurm daemons and controllers that relate to the job with the ID `123`: ``` k8s.container.name: ~"slurmctld|slurmd" AND 123 ``` * Logs of the SSH daemon that runs on the `login-0` node: ``` k8s.container.name: "sshd" AND k8s.pod.name: "login-0" ``` * Errors in logs of Slurm daemons and controllers: ``` k8s.container.name: ~"slurmctld|slurmd" AND "error" ``` ## How to view log files on a worker node 1. [Connect](https://docs.nebius.com/slurm-soperator/clusters/connect.md#how-to-connect-to-worker-nodes) to a worker node of your Soperator cluster. 2. View the logs of the Slurm daemon that runs on this node: ```bash less /var/log/slurm/slurmd.log ``` # Quotas in Managed Service for Soperator Source: https://docs.nebius.com/slurm-soperator/managed-soperator/resources/quotas.md Managed Service for Soperator shares some quotas with Compute. For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). ## Nodes (virtual machines) Login, worker and [service nodes](https://docs.nebius.com/slurm-soperator/managed-soperator/service-nodes.md) in Managed Soperator clusters count towards the [Compute quota](https://docs.nebius.com/compute/resources/quotas-limits.md#virtual-machines) on the total number of vCPUs across non-GPU virtual machines (VMs). The quotas on GPUs by type for regular VMs without reservations don't apply to Managed Soperator nodes because they require [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md) that reserve GPUs. Compute quotas on total numbers of GPU VMs and non-GPU VMs are not affected by Managed Soperator nodes. ## Disks and shared filesystems Disks and shared filesystems for login, worker and [service nodes](https://docs.nebius.com/slurm-soperator/managed-soperator/service-nodes.md) count towards [Compute quotas on storage capacity](https://docs.nebius.com/compute/resources/quotas-limits.md#storage) (total sizes of disks and shared filesystems by type). Quotas on total numbers of disks and shared filesystems are not affected by Managed Soperator clusters. # Pricing in Managed Service for Soperator Source: https://docs.nebius.com/slurm-soperator/managed-soperator/resources/pricing.md This article provides pricing details for Managed Service for Soperator in Nebius AI Cloud. ## How charges and prices work Each group of chargeable items in this article has two time units associated with it: * **Billing unit**: Minimum unit of usage for which you can be charged. * **Pricing unit**: Unit of usage for which the prices are shown. Charges for units smaller than the pricing unit are calculated proportionally. > For example, for GPUs on running VMs, the **billing unit** is 1 second, and the **pricing unit** is 1 hour (3600 seconds). For 30 minutes of usage, you will be charged half the hourly price. Prices in US dollars (USD, \$) apply to all customers except for companies from Israel, where prices in Israeli shekels (ILS, ₪) apply instead. All prices are shown without any applicable taxes, including VAT. Due to rounding errors, usage costs shown in the web console and final charges may slightly differ from calculations based on the prices in this article. ## Prices ### Cluster resources You are charged for the following resources: * Login, worker and [service nodes](https://docs.nebius.com/slurm-soperator/managed-soperator/service-nodes.md) are Compute virtual machines. Their GPUs, vCPUs, RAM and boot disks are charged according to [Compute pricing](https://docs.nebius.com/compute/resources/pricing.md). * Shared filesystems provisioned for the cluster are also priced in Compute. See [Compute pricing](https://docs.nebius.com/compute/resources/pricing.md#shared-filesystems) for storage rates. * Any buckets used with the cluster are charged according to [Object Storage pricing](https://docs.nebius.com/object-storage/resources/pricing.md). ### Managed Service for Kubernetes® # Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/index.md With [Kubernetes](https://kubernetes.io), you can efficiently manage and scale your containerized ML/AI applications and ensure they are portable and fault-tolerant. Nebius AI Cloud offers Managed Service for Kubernetes, which simplifies cluster deployment and management for Kubernetes. The service is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* > [card] [Getting started](https://docs.nebius.com/kubernetes/quickstart.md) > > Create your first cluster for Kubernetes and connect to it > [card] [Creating and modifying clusters](https://docs.nebius.com/kubernetes/clusters/manage.md) > > Learn how to manage clusters and their parameters > [card] [Creating and modifying node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md) > > Manage node groups that form clusters for Kubernetes > [card] [Connecting to clusters with kubectl](https://docs.nebius.com/kubernetes/connect.md) > > Use the Kubernetes native CLI to work with your clusters > [card] [Setting up GPUs](https://docs.nebius.com/kubernetes/gpu/set-up.md) > > Add GPUs to nodes in your clusters for ML/AI workloads > [card] [Interconnecting GPUs with InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md) > > Accelerate your GPU-powered workloads with high-performance networking > [card] [Monitoring clusters and nodes](https://docs.nebius.com/kubernetes/monitoring.md) > > Control resource usage and health of your clusters and nodes # How to get started with Managed Service for Kubernetes®: Create your first cluster for Kubernetes Source: https://docs.nebius.com/kubernetes/quickstart.md With [Kubernetes](https://kubernetes.io/), you can efficiently manage and scale your containerized ML/AI applications and ensure they are portable and fault-tolerant. To get started, create a Managed Service for Kubernetes cluster and its child node group in the `eu-north1` region. Then, connect to the cluster. ## Prerequisites > [tab] Web console > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to get the cluster credentials for connecting with kubectl. > > 2. Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), the Kubernetes command-line interface: > > ```bash Ubuntu > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl > ``` > > ```bash macOS > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl" > chmod +x ./kubectl > sudo mv ./kubectl /usr/local/bin/kubectl > sudo chown root: /usr/local/bin/kubectl > ``` > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), the Kubernetes command-line interface: > > ```bash Ubuntu > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl > ``` > > ```bash macOS > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl" > chmod +x ./kubectl > sudo mv ./kubectl /usr/local/bin/kubectl > sudo chown root: /usr/local/bin/kubectl > ``` > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to get the cluster credentials for connecting with kubectl. > > 3. Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), the Kubernetes command-line interface: > > ```bash Ubuntu > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl > ``` > > ```bash macOS > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl" > chmod +x ./kubectl > sudo mv ./kubectl /usr/local/bin/kubectl > sudo chown root: /usr/local/bin/kubectl > ``` > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to get the cluster credentials for connecting with kubectl. > > 3. Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), the Kubernetes command-line interface: > > ```bash Ubuntu > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl > ``` > > ```bash macOS > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl" > chmod +x ./kubectl > sudo mv ./kubectl /usr/local/bin/kubectl > sudo chown root: /usr/local/bin/kubectl > ``` > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to get the cluster credentials for connecting with kubectl. > > 3. Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl), the Kubernetes command-line interface: > > ```bash Ubuntu > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl > ``` > > ```bash macOS > curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl" > chmod +x ./kubectl > sudo mv ./kubectl /usr/local/bin/kubectl > sudo chown root: /usr/local/bin/kubectl > ``` ## Steps ### Create a cluster and a node group The cluster's control plane runs Kubernetes version 1.36, which is the default [version](https://docs.nebius.com/kubernetes/versions.md) for Managed Kubernetes clusters. > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > > 2. Click  **Create cluster**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. On the **Cluster** step, enter the cluster name and review the settings: > > * Select the network and subnet. > * Keep the recommended Kubernetes version 1.36. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * Keep the public endpoint enabled. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > 4. On the **Node groups** step, add a node group to the cluster: > > 1. Click  **Add node group**. > 2. On the **General** step, enter the node group name. Keep the rest of the settings unchanged. > 3. On the **Compute resources** step, select **Without GPU**. Select the **Non-GPU Intel Ice Lake** [platform](https://docs.nebius.com/compute/virtual-machines/types.md). Under **Size**, set the **Number of nodes** to 2. Under **Settings**, select your project. Select the preset with 2 CPUs and 8 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) of RAM. Then, select an operating system for the nodes, for example, Ubuntu 24.04 LTS. > 4. On the **Storage** step, under **Node storage**, select the **SSD** disk type and set the size to 128 GiB. > 5. On the **Additional** step, keep the default settings. > 6. Click **Add node group**. > > 5. Go to the **Review** step, check the cluster configuration and click **Create**. > > 6. After the cluster is created, copy the cluster ID from its page and save the ID to an environment variable. You will need it to connect to the cluster: > > ```bash > export CLUSTER_ID= > ``` > [tab] CLI > > 1. Your cluster's control plane and nodes use private IP addresses from the default subnet. Get its ID: > > ```bash > export SUBNET_ID=$(nebius vpc subnet list \ > --format jsonpath='{.items[0].metadata.id}') > ``` > > 2. Create a cluster with a public endpoint allocated to its control plane, and get the cluster ID: > > ```bash > export CLUSTER_ID=$(nebius mk8s cluster create \ > --name quickstart-mk8s-cluster \ > --control-plane-subnet-id $SUBNET_ID \ > --control-plane-endpoints-public-endpoint=true \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Create a node group and add it to the cluster: > > ```bash > nebius mk8s node-group create \ > --name quickstart-mk8s-nodes \ > --parent-id $CLUSTER_ID \ > --fixed-node-count 2 \ > --template-resources-platform "cpu-e2" \ > --template-resources-preset "2vcpu-8gb" \ > --template-boot-disk-type network_ssd \ > --template-boot-disk-size-bytes 137438953472 \ > --template-network-interfaces "[{\"subnet_id\": \"$SUBNET_ID\"}]" > ``` > > The command creates a group of 2 nodes. Each node is a non-GPU (`--template-resources-platform "cpu-e2"`) virtual machine that has 2 vCPUs, 8 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) of RAM and a 128 GiB Network SSD boot disk. > [tab] Go SDK > > 1. Your cluster's control plane and nodes use private IP addresses from the default subnet. Get its ID: > > ```go > subnets, err := sdk.Services().VPC().V1(). > Subnet().List( > ctx, > &vpc.ListSubnetsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > if len(subnets.GetItems()) == 0 { > return fmt.Errorf("no subnets found") > } > subnetID := subnets.GetItems()[0].GetMetadata().GetId() > ``` > > For `ParentId`, specify your [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). The code saves the ID of the first subnet in the project to `subnetID`. > > 2. Create a cluster with a public endpoint allocated to its control plane, and get the cluster ID: > > ```go > clusterOperation, err := sdk.Services().MK8S().V1(). > Cluster().Create( > ctx, > &mk8s.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "quickstart-mk8s-cluster", > }, > Spec: &mk8s.ClusterSpec{ > ControlPlane: &mk8s.ControlPlaneSpec{ > SubnetId: subnetID, > Endpoints: &mk8s.ControlPlaneEndpointsSpec{ > PublicEndpoint: &mk8s.PublicEndpointSpec{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = clusterOperation.Wait(ctx); err != nil { > return err > } > clusterID := clusterOperation.ResourceID() > if clusterID == "" { > return fmt.Errorf("cluster ID is missing") > } > ``` > > 3. Create a node group and add it to the cluster: > > ```go > publicKeyData, err := os.ReadFile( > os.ExpandEnv("$HOME/.ssh/id_ed25519.pub"), > ) > if err != nil { > return err > } > publicKey := strings.TrimSpace(string(publicKeyData)) > cloudInitUserData := "#cloud-config\nusers:\n" + > " - name: user\n" + > " sudo: ALL=(ALL) NOPASSWD:ALL\n" + > " shell: /bin/bash\n" + > " ssh_authorized_keys:\n" + > " - " + publicKey > networkInterfaces := []*mk8s.NetworkInterfaceTemplate{ > { > PublicIpAddress: &mk8s.PublicIPAddress{}, > SubnetId: subnetID, > }, > } > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: clusterID, > Name: "quickstart-mk8s-nodes", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "cpu-e2", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &mk8s.DiskSpec{ > Size: &mk8s.DiskSpec_SizeBytes{ > SizeBytes: 137438953472, > }, > Type: mk8s.DiskSpec_NETWORK_SSD, > }, > CloudInitUserData: cloudInitUserData, > NetworkInterfaces: networkInterfaces, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > nodeGroupID := nodeGroupOperation.ResourceID() > if nodeGroupID == "" { > return fmt.Errorf("node group ID is missing") > } > ``` > > The code creates a group of 2 nodes. Each node is a non-GPU (`Platform: "cpu-e2"`) virtual machine that has 2 vCPUs, 8 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) of RAM and a 128 GiB Network SSD boot disk. > > The nodes get public IP addresses, and `CloudInitUserData` grants the `user` account access with the SSH key from `$HOME/.ssh/id_ed25519.pub`. Create this key pair before you run the code. > [tab] Python SDK > > 1. Your cluster's control plane and nodes use private IP addresses from the default subnet. Get its ID: > > ```python > subnet_service = SubnetServiceClient(sdk) > subnets = await subnet_service.list( > ListSubnetsRequest(parent_id=""), > ) > if not subnets.items: > raise ValueError("no subnets found") > subnet_id = subnets.items[0].metadata.id > ``` > > For `parent_id`, specify your [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). The code saves the ID of the first subnet in the project to `subnet_id`. > > 2. Create a cluster with a public endpoint allocated to its control plane, and get the cluster ID: > > ```python > cluster_service = ClusterServiceClient(sdk) > cluster_operation = await cluster_service.create( > CreateClusterRequest( > metadata=ResourceMetadata( > parent_id="", > name="quickstart-mk8s-cluster", > ), > spec=ClusterSpec( > control_plane=ControlPlaneSpec( > subnet_id=subnet_id, > endpoints=ControlPlaneEndpointsSpec( > public_endpoint=PublicEndpointSpec(), > ), > ), > ), > ), > ) > await cluster_operation.wait() > cluster_id = cluster_operation.resource_id > if not cluster_id: > raise ValueError("cluster ID is missing") > ``` > > 3. Create a node group and add it to the cluster: > > ```python > public_key_path = Path.home() / ".ssh" / "id_ed25519.pub" > public_key = public_key_path.read_text().strip() > cloud_init_user_data = "\n".join( > [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > f" - {public_key}", > ], > ) > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=cluster_id, > name="quickstart-mk8s-nodes", > ), > spec=NodeGroupSpec( > fixed_node_count=2, > template=NodeTemplate( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=DiskSpec( > size_bytes=137438953472, > type=DiskSpec__DiskType.NETWORK_SSD, > ), > cloud_init_user_data=cloud_init_user_data, > network_interfaces=[ > NetworkInterfaceTemplate( > public_ip_address=PublicIPAddress(), > subnet_id=subnet_id, > ), > ], > ), > ), > ), > ) > await node_group_operation.wait() > node_group_id = node_group_operation.resource_id > if not node_group_id: > raise ValueError("node group ID is missing") > ``` > > The code creates a group of 2 nodes. Each node is a non-GPU (`platform="cpu-e2"`) virtual machine that has 2 vCPUs, 8 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) of RAM and a 128 GiB Network SSD boot disk. > > The nodes get public IP addresses, and `cloud_init_user_data` grants the `user` account access with the SSH key from `~/.ssh/id_ed25519.pub`. Create this key pair before you run the code. > [tab] JavaScript SDK > > 1. Your cluster's control plane and nodes use private IP addresses from the default subnet. Get its ID: > > ```ts > const subnetService = new SubnetService(sdk); > const subnets = await subnetService.list( > ListSubnetsRequest.create({ > parentId: "", > }), > ); > const subnetId = subnets.items[0]?.metadata?.id; > if (!subnetId) { > throw new Error("no subnets found"); > } > ``` > > For `parentId`, specify your [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). The code saves the ID of the first subnet in the project to `subnetId`. > > 2. Create a cluster with a public endpoint allocated to its control plane, and get the cluster ID: > > ```ts > const clusterService = new ClusterService(sdk); > const clusterOperation = await clusterService.create( > CreateClusterRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "quickstart-mk8s-cluster", > }), > spec: ClusterSpec.create({ > controlPlane: ControlPlaneSpec.create({ > subnetId: subnetId, > endpoints: ControlPlaneEndpointsSpec.create({ > publicEndpoint: PublicEndpointSpec.create({}), > }), > }), > }), > }), > ).result; > await clusterOperation.wait(); > const clusterId = clusterOperation.resourceId(); > if (!clusterId) { > throw new Error("cluster ID is missing"); > } > ``` > > 3. Create a node group and add it to the cluster: > > ```ts > const homeDir = process.env.HOME; > if (!homeDir) { > throw new Error("HOME is not set"); > } > const publicKey = ( > await readFile(`${homeDir}/.ssh/id_ed25519.pub`, "utf8") > ).trim(); > const cloudInitUserData = [ > "#cloud-config", > "users:", > " - name: user", > " sudo: ALL=(ALL) NOPASSWD:ALL", > " shell: /bin/bash", > " ssh_authorized_keys:", > " - " + publicKey, > ].join("\n"); > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: clusterId, > name: "quickstart-mk8s-nodes", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: DiskSpec.create({ > size: { > $case: "sizeBytes", > sizeBytes: 137438953472, > }, > type: DiskSpec_DiskType.NETWORK_SSD, > }), > cloudInitUserData, > networkInterfaces: [ > NetworkInterfaceTemplate.create({ > publicIpAddress: PublicIPAddress.create({}), > subnetId: subnetId, > }), > ], > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > const nodeGroupId = nodeGroupOperation.resourceId(); > if (!nodeGroupId) { > throw new Error("node group ID is missing"); > } > ``` > > The code creates a group of 2 nodes. Each node is a non-GPU (`platform: "cpu-e2"`) virtual machine that has 2 vCPUs, 8 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) of RAM and a 128 GiB Network SSD boot disk. > > The nodes get public IP addresses, and `cloudInitUserData` grants the `user` account access with the SSH key from `$HOME/.ssh/id_ed25519.pub`. Create this key pair before you run the code. ### Connect to the cluster Cluster credentials for kubectl come from the CLI regardless of the interface that you used to create the cluster. 1. Create a kubeconfig file containing the cluster details for kubectl. If you created the cluster with an SDK, first save the returned cluster ID to the `CLUSTER_ID` environment variable: ```bash export CLUSTER_ID= ``` Then, create the file: ```bash nebius mk8s cluster get-credentials \ --id $CLUSTER_ID --external ``` 2. Check that the cluster is accessible. For example: * Get addresses of the control plane and cluster services: ```bash kubectl cluster-info ``` * Get the list of Pods: ```bash kubectl get pods -A ``` ## What's next * [How to create and modify Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/clusters/manage.md) * [Creating and modifying Managed Service for Kubernetes® node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md) # Components in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/components.md This article provides a quick overview of the Managed Service for Kubernetes components, their interactions and functions. A Managed Service for Kubernetes cluster consists of: * [Control plane](https://docs.nebius.com/kubernetes/components.md#control-plane-components) * [Node components](https://docs.nebius.com/kubernetes/components.md#node-based-control-plane-components) * Sets of worker VMs ([nodes](https://docs.nebius.com/kubernetes/components.md#node) and [node groups](https://docs.nebius.com/kubernetes/components.md#node-group)) that run groups of containerized applications ([Pods](https://docs.nebius.com/kubernetes/components.md#pod)) ## Control plane components **Control plane** components manage the overall state of the cluster. ### API server The **API server** exposes the Kubernetes API to customers, acting as a frontend for [REST](https://www.geeksforgeeks.org/rest-api-introduction/) operations. To learn more, see the official Kubernetes documentation for [kube-apiserver](https://kubernetes.io/docs/concepts/overview/kubernetes-api/). ### Scheduler **Scheduler** is responsible for determining which [node](https://docs.nebius.com/kubernetes/components.md#node) runs a particular [Pod](https://docs.nebius.com/kubernetes/components.md#pod) with specified containers. When selecting a node to allocate a Pod, the scheduler takes into account quotas, resource requirements, deployments, taints and tolerations, and other factors. To learn more, see the official Kubernetes documentation for [Kubernetes scheduler](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/). ### Cluster autoscaler In Managed Service for Kubernetes, the **cluster autoscaler** seamlessly adds nodes when there are unschedulable Pods, and removes underutilized nodes as needed. For more information, see [Autoscaling in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md). ### Controller manager **Controller manager** runs controllers to implement Kubernetes API behavior. To reduce complexity, multiple controllers are compiled into one binary and run as a single process. Below are examples of frequently used controllers: * **Node controller** ensures that each node is operational. If a node shuts down, node controller tries to restart it or relocate its Pods and containers to other nodes. * **Replication controller** ensures that the same Pods are deployed across multiple nodes if required. * **Endpoint controller** ensures that containers are accessible to users. To learn more, see the official Kubernetes documentation for [kube-controller-manager](https://kubernetes.io/docs/concepts/architecture/controller/). ### etcd **etcd** is a consistent and highly available key-value store for API server data. By default, a Managed Kubernetes cluster is [created](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters) with three etcd stores. This ensures high availability: The cluster is more reliable; data stored in etcd is more likely to be accessed in case of failures. The enabled high availability does not affect the cost of the cluster. You can find in-depth information on etcd in its [official documentation](https://etcd.io/docs/). ## Node-based control plane components These components are located not in the control plane itself, but on each [node](https://docs.nebius.com/kubernetes/components.md#node) running on the cluster. ### kubelet **kubelet** ensures that [Pods](https://docs.nebius.com/kubernetes/components.md#pod) and their containers are running. It communicates with the [scheduler](https://docs.nebius.com/kubernetes/components.md#scheduler) and [controller manager](https://docs.nebius.com/kubernetes/components.md#controller-manager). To learn more, see the official Kubernetes documentation for [kubelet](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/). ### kube-proxy **kube network proxy** manages traffic flow, ensuring that network rules work on [nodes](https://docs.nebius.com/kubernetes/components.md#node). To learn more, see the official Kubernetes documentation for [kube-proxy](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/). ### Cilium **Cilium** ensures that only specific services and traffic can access certain [Pods](https://docs.nebius.com/kubernetes/components.md#pod). For example: * Some [Pods](https://docs.nebius.com/kubernetes/components.md#pod) might contain sensitive data, and Cilium enforces rules that only certain internal services or authorized users are allowed to access it. * If a [node](https://docs.nebius.com/kubernetes/components.md#node) requires restricted access, Cilium ensures that only internal services with proper credentials or traffic with specific labels are allowed. Also, Cilium provides observability into traffic between [Pods](https://docs.nebius.com/kubernetes/components.md#pod) and [nodes](https://docs.nebius.com/kubernetes/components.md#node) to optimize network paths and enforce network security policies. You can find in-depth information on Cilium in its [official documentation](https://docs.cilium.io/en/stable/index.html). ## Worker components This section describes the components that run and manage user workloads on your Managed Service for Kubernetes cluster. ### Node In Managed Service for Kubernetes, **nodes** are [Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/types.md). There must be at least one node in a cluster for applications to function properly. On [supported platforms, presets and regions](https://docs.nebius.com/compute/storage/local-disks.md#availability), you can enable [local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) for worker nodes. Local SSD disks provide ephemeral storage intended for temporary data. By default, Managed Service for Kubernetes uses them as the node's [local ephemeral storage](https://kubernetes.io/docs/concepts/storage/ephemeral-storage/). > [!WARNING] > > Do **not** modify Managed Service for Kubernetes nodes in Compute. Kubernetes nodes are listed on the **Kubernetes nodes** tab of the **Virtual machines** page, but manage them in the **Managed Service for Kubernetes®** section instead. To learn more, see the official Kubernetes documentation for [nodes](https://kubernetes.io/docs/concepts/architecture/nodes/). ### Node group **Node groups** in Managed Service for Kubernetes organize [nodes](https://docs.nebius.com/kubernetes/components.md#node) that serve a specific purpose. All nodes in a group share the same template. The number of nodes per node group cannot exceed 100. See more details in [Creating and modifying Managed Service for Kubernetes® node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md). Node groups can use the cluster autoscaler to seamlessly add or remove nodes as needed. For more information, see [Autoscaling in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md). ### Pod **Pod** is a group of one or more containers with shared storage and network resources. In a Managed Service for Kubernetes cluster, each Pod has a unique IP address so that workloads don't conflict. To learn more, see the official Kubernetes documentation for [Pods](https://kubernetes.io/docs/concepts/workloads/pods/). ### Taints and tolerations **Taints** act like restrictions or rules for specific [nodes](https://docs.nebius.com/kubernetes/components.md#node). **Tolerations** are like clearances or permissions that certain [Pods](https://docs.nebius.com/kubernetes/components.md#pod) have to be placed on specified [nodes](https://docs.nebius.com/kubernetes/components.md#node). To learn more, see the official Kubernetes documentation for [taints and tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). ### DaemonSets **DaemonSets** ensure that every node creates a Pod with a certain type of container. In Kubernetes, DaemonSets are used for infrastructure-related workloads, such as logging, monitoring or networking agents that must be deployed on every node. To learn more, see the official Kubernetes documentation for [DaemonSets](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/). # Kubernetes® versions in Managed Service for Kubernetes Source: https://docs.nebius.com/kubernetes/versions.md You can configure the [Kubernetes version](https://kubernetes.io/releases/) that is used on your Managed Kubernetes clusters and node groups. * **Clusters**: The Kubernetes version is used for [control plane components](https://kubernetes.io/docs/concepts/architecture/#control-plane-components). It is *required* when [creating a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters). * **Node groups**: The Kubernetes version is used for node components. It is *optional* when [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups). By default, a node group uses the same Kubernetes version as its parent cluster. A node group cannot have a higher version than the cluster. ## Available Kubernetes versions The following Kubernetes versions are currently supported for clusters and node groups: * [1.36](https://kubernetes.io/releases/#release-v1-36): Recommended. New clusters use this version. * [1.35](https://kubernetes.io/releases/#release-v1-35) * [1.34](https://kubernetes.io/releases/#release-v1-34) * [1.33](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.33.md), [1.32](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.32.md), [1.31](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.31.md) and [1.30](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.30.md): Not recommended as they reached end of life. These versions are supported for clusters created earlier, but we recommend upgrading to the newest version. For the version deprecation policy and end-of-life timeline, see [Kubernetes® version deprecation policy in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/version-deprecation.md). ## Upgrading Kubernetes version You can upgrade a cluster to a newer Kubernetes version manually; automatic upgrade is not supported. To do so, upgrade the control plane first and then the node groups. Node groups are not upgraded automatically together with the cluster, even if you created the cluster and node groups with the same version. Consider possible downtimes during the upgrade: * If the control plane is not highly available—that is, it has only one [etcd store](https://docs.nebius.com/kubernetes/components.md#etcd)—the cluster becomes unavailable during the control plane upgrade. * When you upgrade a node group, the nodes are replaced one by one, according to the node group's [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). If the maximum unavailable deployment strategy parameter is greater than `0`, some nodes might be unavailable during the upgrade. You can check the node group specifications: > [tab] CLI > > ```bash > nebius mk8s node-group get --id > ``` > [tab] Go SDK > > ```go > nodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(nodeGroup) > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > print(node_group) > ``` > [tab] JavaScript SDK > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroup = await nodeGroupService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > console.log(nodeGroup); > ``` See detailed instructions in [Setting and upgrading Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/manage-versions.md). # Setting and upgrading Kubernetes® versions in Managed Service for Kubernetes Source: https://docs.nebius.com/kubernetes/manage-versions.md You can set the [Kubernetes version](https://kubernetes.io/releases/) that is used on your Managed Kubernetes clusters and node groups during creation. For existing clusters and node groups, you can upgrade the version. For more information about available versions and the upgrade, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to set a Kubernetes version > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > > 2. Click  **Create cluster**. > > 3. In the **Control plane** section, select the Kubernetes version from the drop-down list. > > > [!NOTE] > > > > It is not currently possible to set a Kubernetes version for a node group in the web console. > [tab] CLI > > Use the following parameters: > > * For clusters ([nebius mk8s cluster create](https://docs.nebius.com/cli/reference/mk8s/cluster/create.md)): > > ```sh > --control-plane-version > ``` > > * For node groups ([nebius mk8s node-group create](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md)): > > ```sh > --version > ``` > > > [!WARNING] > > > > The Kubernetes version for a node group must not be higher than for the control plane. > [tab] Go SDK > > Set the following parameters when creating a [cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-go-sdk) or [node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > * For clusters, in `mk8s.CreateClusterRequest`, set `Spec.ControlPlane.Version` to ``. > * For node groups, in `mk8s.CreateNodeGroupRequest`, set `Spec.Version` to ``. > > > [!WARNING] > > > > The Kubernetes version for a node group must not be higher than for the control plane. > [tab] Python SDK > > Set the following parameters when creating a [cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-python-sdk) or [node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > * For clusters, in `CreateClusterRequest`, set `spec.control_plane.version` to ``. > * For node groups, in `CreateNodeGroupRequest`, set `spec.version` to ``. > > > [!WARNING] > > > > The Kubernetes version for a node group must not be higher than for the control plane. > [tab] JavaScript SDK > > Set the following parameters when creating a [cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-javascript-sdk) or [node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > * For clusters, in `CreateClusterRequest`, set `spec.controlPlane.version` to ``. > * For node groups, in `CreateNodeGroupRequest`, set `spec.version` to ``. > > > [!WARNING] > > > > The Kubernetes version for a node group must not be higher than for the control plane. ## How to upgrade a Kubernetes version To upgrade a Managed Kubernetes cluster to a new version, upgrade the control plane first and then the node groups. > [!NOTE] > > The Kubernetes version for a node group must not be higher than for the control plane. > [tab] CLI > > 1. Get the ID of the cluster: > > ```bash > nebius mk8s cluster get-by-name \ > --name --format jsonpath='{.metadata.id}' > ``` > > 2. Upgrade the control plane: > > ```bash > nebius mk8s cluster update \ > --id \ > --control-plane-version > ``` > > 3. After the upgrade is completed, get the ID of the node group: > > ```bash > nebius mk8s node-group get-by-name \ > --parent-id \ > --name --format jsonpath='{.metadata.id}' > ``` > > 4. Upgrade the node group: > > ```bash > nebius mk8s node-group update \ > --id \ > --auto-approve \ > --version > ``` > [tab] Go SDK > > 1. Get the ID of the cluster: > > ```go > clusterByName, err := sdk.Services().MK8S().V1(). > Cluster().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > clusterByNameID := clusterByName.GetMetadata().GetId() > if clusterByNameID == "" { > return errors.New("cluster ID is missing") > } > fmt.Println(clusterByNameID) > ``` > > 2. Upgrade the control plane. Set the new version in `Spec.ControlPlane.Version`: > > ```go > cluster, err := sdk.Services().MK8S().V1(). > Cluster().Get( > ctx, > &mk8s.GetClusterRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > clusterSpec := cluster.GetSpec() > if clusterSpec == nil || clusterSpec.GetControlPlane() == nil { > return errors.New("cluster control plane spec is missing") > } > clusterSpec.GetControlPlane().Version = "" > clusterOperation, err := sdk.Services().MK8S().V1(). > Cluster().Update( > ctx, > &mk8s.UpdateClusterRequest{ > Metadata: cluster.GetMetadata(), > Spec: clusterSpec, > }, > ) > if err != nil { > return err > } > if _, err = clusterOperation.Wait(ctx); err != nil { > return err > } > ``` > > 3. After the upgrade is completed, get the ID of the node group: > > ```go > nodeGroupByName, err := sdk.Services().MK8S().V1(). > NodeGroup().GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > nodeGroupByNameID := nodeGroupByName.GetMetadata().GetId() > if nodeGroupByNameID == "" { > return errors.New("node group ID is missing") > } > fmt.Println(nodeGroupByNameID) > ``` > > 4. Upgrade the node group. Set the new version in `Spec.Version`: > > ```go > nodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > nodeGroupSpec := nodeGroup.GetSpec() > if nodeGroupSpec == nil { > return errors.New("node group spec is missing") > } > nodeGroupSpec.Version = "" > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: nodeGroup.GetMetadata(), > Spec: nodeGroupSpec, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the cluster: > > ```python > cluster_service = ClusterServiceClient(sdk) > cluster_by_name = await cluster_service.get_by_name( > GetByNameRequest(name=""), > ) > cluster_by_name_id = cluster_by_name.metadata.id > print(cluster_by_name_id) > ``` > > 2. Upgrade the control plane. Set the new version in `spec.control_plane.version`: > > ```python > cluster_service = ClusterServiceClient(sdk) > cluster = await cluster_service.get( > GetClusterRequest(id=""), > ) > if cluster.spec is None or cluster.spec.control_plane is None: > raise ValueError("cluster control plane spec is missing") > cluster.spec.control_plane.version = "" > cluster_operation = await cluster_service.update( > UpdateClusterRequest( > metadata=cluster.metadata, > spec=cluster.spec, > ), > ) > await cluster_operation.wait() > ``` > > 3. After the upgrade is completed, get the ID of the node group: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_by_name = await node_group_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > node_group_by_name_id = node_group_by_name.metadata.id > print(node_group_by_name_id) > ``` > > 4. Upgrade the node group. Set the new version in `spec.version`: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None: > raise ValueError("node group spec is missing") > node_group.spec.version = "" > node_group_operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await node_group_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the cluster: > > ```ts > const clusterLookupService = new ClusterService(sdk); > const clusterByName = await clusterLookupService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const clusterByNameId = clusterByName.metadata?.id; > if (!clusterByNameId) { > throw new Error("cluster ID is missing"); > } > console.log(clusterByNameId); > ``` > > 2. Upgrade the control plane. Set the new version in `spec.controlPlane.version`: > > ```ts > const clusterService = new ClusterService(sdk); > const cluster = await clusterService.get( > GetClusterRequest.create({ > id: "", > }), > ); > if (!cluster.spec?.controlPlane) { > throw new Error("cluster control plane spec is missing"); > } > cluster.spec.controlPlane.version = ""; > const clusterOperation = await clusterService.update( > UpdateClusterRequest.create({ > metadata: cluster.metadata, > spec: cluster.spec, > }), > ).result; > await clusterOperation.wait(); > ``` > > 3. After the upgrade is completed, get the ID of the node group: > > ```ts > const nodeGroupLookupService = new NodeGroupService(sdk); > const nodeGroupByName = await nodeGroupLookupService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ); > const nodeGroupByNameId = nodeGroupByName.metadata?.id; > if (!nodeGroupByNameId) { > throw new Error("node group ID is missing"); > } > console.log(nodeGroupByNameId); > ``` > > 4. Upgrade the node group. Set the new version in `spec.version`: > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroup = await nodeGroupService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!nodeGroup.spec) { > throw new Error("node group spec is missing"); > } > nodeGroup.spec.version = ""; > const nodeGroupOperation = await nodeGroupService.update( > UpdateNodeGroupRequest.create({ > metadata: nodeGroup.metadata, > spec: nodeGroup.spec, > }), > ).result; > await nodeGroupOperation.wait(); > ``` # Kubernetes® version deprecation policy in Managed Service for Kubernetes Source: https://docs.nebius.com/kubernetes/version-deprecation.md This article describes how Managed Service for Kubernetes handles Kubernetes version deprecation. ## How many versions are available Managed Service for Kubernetes supports a limited set of Kubernetes minor versions. At any time, no more than four Kubernetes minor versions are available: * No more than three supported versions: fully supported for new and existing clusters. * One deprecated version: supported for existing clusters, receives updates from Managed Service for Kubernetes, but **isn't available** for creating new clusters. See the current list in [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). ## When a version becomes deprecated A version becomes **deprecated** when a newer minor version is introduced and the oldest supported version moves out of the supported set. A deprecated version stays available for existing clusters for **two months**, after which it becomes unavailable. Creating new clusters with that version isn't possible. The end-of-life date for each version is shown in [nebius mk8s cluster list-control-plane-versions](https://docs.nebius.com/cli/reference/mk8s/cluster/list-control-plane-versions.md). If your cluster uses a deprecated version, you'll see a notification in the [web console](https://console.nebius.com/mk8s), when using Terraform, or when reading cluster info via [nebius mk8s cluster get](https://docs.nebius.com/cli/reference/mk8s/cluster/get.md). When a version reaches its end-of-life date, clusters using it are upgraded automatically within a short period. ## How clusters are upgraded by the service Managed Service for Kubernetes keeps clusters within the supported version window to maintain security and reliability. * **Control plane**: upgraded automatically when your cluster with a deprecated version reaches end of life. * **Node groups**: upgraded automatically only when required to keep the control plane within the [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/#kubelet) (no more than three minor versions behind the control plane). Node groups are upgraded to match the control plane version, so they can jump several versions at once. > For example, if your cluster's control plane is running 1.35 and its worker nodes are running 1.33, when 1.35 is deprecated, both the control plane and the worker nodes are upgraded to 1.36. ## How to upgrade your cluster yourself You can upgrade your cluster on your own schedule. This gives you control over timing and allows you to prepare workloads in advance. See the step-by-step guide in [Setting and upgrading Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/manage-versions.md). ## Risks of not upgrading a cluster yourself If you don't upgrade a cluster in time, Managed Service for Kubernetes will upgrade your cluster automatically. This can introduce the following risks: * The cluster specification and status don’t match. Managed Service for Kubernetes doesn’t modify the cluster specification; however, the cluster continues to be updated, as reflected in its status. * Unexpected maintenance timing for control plane or node group upgrades. * Workload disruption from node replacements during node group upgrades. * Compatibility issues due to Kubernetes API removals. * Larger version jumps, which are harder to validate than planned, gradual upgrades. To reduce risk, plan upgrades ahead of deprecation dates and keep clusters on supported versions. # How to create and modify Managed Service for Kubernetes® clusters Source: https://docs.nebius.com/kubernetes/clusters/manage.md Managed Service for Kubernetes clusters manage and run containerized applications, providing automatic scaling, load balancing, and streamlined deployment and management. In this guide, you will learn how to create, modify, and delete clusters in Managed Service for Kubernetes. For more information on managing node groups and adding them to clusters, see [Creating and modifying Managed Service for Kubernetes® node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to create clusters > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > > 2. Click  **Create cluster**. > > 3. On the **Cluster** step, configure the cluster: > > 1. In the **General** section: > > * Enter the cluster name. > * (Optional) Enter labels in the `key:value` format. > > 2. In the **Network** section, review the network and subnet. They are selected by default. > > 3. In the **Control plane** section: > > * The Kubernetes version is set by default. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * A public endpoint is allocated by default. As a result, the cluster is available from the internet, you can connect to it from any machine. If you want to prevent access to the cluster from the internet, disable the public endpoint option. Then, you can connect to the cluster only from a virtual machine (VM) located in the same subnet as the cluster. > > > [!TIP] > > > > To only allow certain addresses to connect to the cluster, enable the public endpoint and [configure an allowlist of IP addresses](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md) for the cluster. > > 4. (Optional) In the **Observability** section, enable **Audit logs** to record metadata about operations that modify the cluster. For details, see [Logs in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/logs.md). > > 5. Click **Next**. > > 4. On the **Node groups** step, optionally configure one or more node groups. > > You can create a cluster without node groups and add them later. For more information, see [Creating and modifying Managed Service for Kubernetes® node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md). > > To add a node group during cluster creation: > > 1. Click **Add node group**. > > 2. Configure the node group. If you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md), the **Reservations** step is also shown between **General** and **Compute resources**. > > 1. On the **General** step: > > * Enter the node group name. > > * (Optional) Enable **Assign public IPv4 addresses** if you want the nodes to be accessible from the internet. > > * Under **Size**: > > * (Optional) Enable **Autoscaling** if you want to let the node group scale up or down depending on the workload. > * Specify the initial **Number of nodes**. > > * Under **Advanced**: > > * **Auto-repair** is enabled by default. When enabled, Managed Kubernetes automatically replaces unhealthy nodes. > * (Optional) Specify **Max pods per node** to limit how many Pods can run on each node in the group. > > 2. If the **Reservations** step is shown, select **Reservation usage**: > > * **With reservations**: Resources are allocated from reservations ([capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md)). This ensures that resources are always available, even if VMs in the node group are stopped (for example, by you or a [maintenance event](https://docs.nebius.com/kubernetes/maintenance/index.md)). > > In the **Reservation** section, you can configure the following options: > > * **Any (existing and future)** (default): Compute selects among your matching capacity block groups automatically. > * **Specific capacity block groups**: Select one or more capacity block groups. Each option shows the capacity block group ID, reservation period, and GPU usage. Make sure the selected groups have enough capacity and do not expire soon. > * **Switch to PAYG**: Choose whether the VM can start after you create or restart it without active intervals in selected capacity block groups: > > * **When reservation is exhausted** (default): The VM can start as a pay-as-you-go VM when no capacity is available in the selected capacity block groups. > * **Never**: The VM cannot start without available capacity in the selected capacity block groups. > > This does not affect the VM when it is running. If an interval in a selected capacity block group expires while the VM is running, the VM always continues as a pay-as-you-go VM, regardless of this setting. > > If you have capacity block groups in multiple regions, select a **Region** first. > > * **Without reservations**: Resources are allocated from a common pool, and no reservations are used for the node group. > > 3. On the **Compute resources** step: > > * Select whether the node group should have GPUs. > > * Select a regular or preemptible VM type. > > VMs without GPUs only support the regular type. For information about preemptible node groups, see [Creating and modifying Managed Service for Kubernetes® node groups — Preemptible node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#preemptible-node-groups-web-console). > > * If you create the node group with reservations, specify a **Reservation ID**. > > * Select an available [platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md) (a combination of GPUs, vCPUs and RAM) that fits your workload requirements. > > * (Optional) If you create a node group with 8 GPUs (for example, for training models), use a GPU cluster for the node group. InfiniBand™ in the cluster allows you to accelerate tasks that require high-performance computing (HPC) power. To use a GPU cluster, select an existing one or click  **Create** in the **GPU cluster** field and specify the cluster name and InfiniBand fabric. To select the fabric, see [InfiniBand fabrics](https://docs.nebius.com/compute/clusters/gpu.md#infiniband-fabrics). > > * (Optional) Enable or disable **GPU settings**. They are enabled by default, and they allow Managed Kubernetes to pre-install NVIDIA drivers and the [Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html). You can also select a specific NVIDIA CUDA driver version. > > * Select an operating system for the nodes (for example, `Ubuntu 24.04 LTS`). > > 4. On the **Storage** step, select the disk type and specify the size in GiB. Supported [disk types](https://docs.nebius.com/compute/storage/types.md#disk-types) are **SSD**, **SSD NRD**, and **SSD IO**. > > (Optional) To attach a shared filesystem, click  **Attach shared filesystem**, select an existing filesystem or create a new one, and specify a mount tag. > > 5. On the **Additional** step: > > * (Optional) In the **Username and SSH key** field, add credentials, so you can [connect to the node group](https://docs.nebius.com/compute/virtual-machines/connect.md): > > 1. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > 2. In the **Username and SSH key** field, select an existing key or click  **Create** to add a new one. > * (Optional) Select or create a [service account](https://docs.nebius.com/iam/overview.md) that will perform actions on behalf of the nodes. > > 3. To add another node group with a different configuration, click **Add node group**. > > 4. To remove a node group, click → **Delete** next to its name. > > 5. Click **Next**. > > 5. (Optional) On the **Applications** step, select applications to deploy to the cluster. Each application requires at least one node group. For more information, see [Deploying and deleting applications for Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/manage-applications.md). > > 1. Click **Next**. > > 6. On the **Review** step, check the cluster configuration and click **Create cluster**. > [tab] CLI > > Create a cluster: > > ```bash > nebius mk8s cluster create \ > --name \ > --labels \ > --control-plane-endpoints-public-endpoint= \ > --control-plane-endpoints-public-endpoint-allowed-cidrs \ > --control-plane-version 1.36 \ > --control-plane-subnet-id \ > --control-plane-etcd-cluster-size > ``` > > The command contains the following parameters: > > * `--name`: Cluster name. > > * `--labels`: Labels in the `key=value` format. > > - `--control-plane-endpoints-public-endpoint`: Enables a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set the parameter to `false`. Then, users can connect to the cluster only from a virtual machine in the same subnet. > > - `--control-plane-endpoints-public-endpoint-allowed-cidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. > > Pass each CIDR block as a separate `--control-plane-endpoints-public-endpoint-allowed-cidrs` parameter. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > * `--control-plane-version`: Kubernetes version. The default and recommended version is 1.36. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * `--control-plane-subnet-id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli). > * `--control-plane-etcd-cluster-size`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). If you do not specify the number, the cluster is created with three etcd stores. This ensures high availability and makes the cluster more reliable; data stored in etcd is accessible even in case of failures. > > You can specify a lower number. However, the enabled high availability does not affect the cost of the cluster. > [tab] Terraform > > 1. Create the following configuration file: > > ```hcl > resource "nebius_mk8s_v1_cluster" "" { > name = "" > parent_id = "" > labels = { > = "" > = "" > ... > = "" > } > control_plane = { > endpoints = { > public_endpoint = {} > } > version = "1.36" > subnet_id = "" > etcd_cluster_size = > } > } > ``` > > The file contains the following parameters: > > * `name`: Cluster name. > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > * `labels`: Labels in the `key=value` format. > * `control_plane`: Settings of the cluster's [control plane](https://docs.nebius.com/kubernetes/components.md#control-plane-components): > > * `endpoints.public_endpoint`: Its value `{}` enables a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, delete the parameter. Then, users can connect to the cluster only from a virtual machine in the same subnet. > * `version`: Kubernetes version. The default and recommended version is 1.36. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * `subnet-id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). > * `etcd_cluster_size`: Number or [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). If you do not specify the number, the cluster is created with three etcd stores. This ensures high availability and makes the cluster more reliable; data stored in etcd is accessible even in case of failures. > > You can specify a lower number. However, the enabled high availability does not affect the cost of the cluster. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Create a cluster: > > ```go > var endpoints *mk8s.ControlPlaneEndpointsSpec > if { > endpoints = &mk8s.ControlPlaneEndpointsSpec{ > PublicEndpoint: &mk8s.PublicEndpointSpec{ > AllowedCidrs: strings.Split("", ","), > }, > } > } > createOperation, err := sdk.Services().MK8S().V1(). > Cluster().Create( > ctx, > &mk8s.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > Labels: map[string]string{"key1": "value1", "key2": "value2"}, > }, > Spec: &mk8s.ClusterSpec{ > ControlPlane: &mk8s.ControlPlaneSpec{ > Version: "1.36", > SubnetId: "", > Endpoints: endpoints, > EtcdClusterSize: , > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = createOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * ``: Set to `true` to create a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set it to `false`. Then, the cluster gets no public endpoint and users can connect to it only from a virtual machine in the same subnet. > > * `PublicEndpoint.AllowedCidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. The example splits a comma-separated string, so pass multiple blocks as `192.168.0.0/24,8.8.8.64/26`. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > - `Metadata.Name`: Cluster name. > - `Metadata.Labels`: Labels in the `key: value` format. > - `Spec.ControlPlane.Version`: Kubernetes version. The default and recommended version is 1.36. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > - `Spec.ControlPlane.SubnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk). > - `EtcdClusterSize`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). If you do not specify the number, the cluster is created with three etcd stores. This ensures high availability and makes the cluster more reliable; data stored in etcd is accessible even in case of failures. > > You can specify a lower number. However, the enabled high availability doesn't affect the cost of the cluster. > [tab] Python SDK > > Create a cluster: > > ```python > endpoints = None > if : > endpoints = ControlPlaneEndpointsSpec( > public_endpoint=PublicEndpointSpec( > allowed_cidrs="".split(","), > ), > ) > cluster_service = ClusterServiceClient(sdk) > create_operation = await cluster_service.create( > CreateClusterRequest( > metadata=ResourceMetadata( > name="", > labels={"key1": "value1", "key2": "value2"}, > ), > spec=ClusterSpec( > control_plane=ControlPlaneSpec( > version="1.36", > subnet_id="", > endpoints=endpoints, > etcd_cluster_size=, > ), > ), > ), > ) > await create_operation.wait() > ``` > > The code contains the following parameters: > > * ``: Set to `True` to create a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set it to `False`. Then, the cluster gets no public endpoint and users can connect to it only from a virtual machine in the same subnet. > > * `public_endpoint.allowed_cidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. The example splits a comma-separated string, so pass multiple blocks as `192.168.0.0/24,8.8.8.64/26`. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > - `metadata.name`: Cluster name. > - `metadata.labels`: Labels in the `key: value` format. > - `spec.control_plane.version`: Kubernetes version. The default and recommended version is 1.36. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > - `spec.control_plane.subnet_id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk). > - `etcd_cluster_size`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). If you don't specify the number, the cluster is created with three etcd stores. This ensures high availability and makes the cluster more reliable; data stored in etcd is accessible even in case of failures. > > You can specify a lower number. However, the enabled high availability doesn't affect the cost of the cluster. > [tab] JavaScript SDK > > Create a cluster: > > ```ts > let endpoints; > if () { > endpoints = ControlPlaneEndpointsSpec.create({ > publicEndpoint: PublicEndpointSpec.create({ > allowedCidrs: "".split(","), > }), > }); > } > const clusterService = new ClusterService(sdk); > const createOperation = await clusterService.create( > CreateClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > labels: {"key1": "value1", "key2": "value2"}, > }), > spec: ClusterSpec.create({ > controlPlane: ControlPlaneSpec.create({ > version: "1.36", > subnetId: "", > endpoints, > etcdClusterSize: , > }), > }), > }), > ).result; > await createOperation.wait(); > ``` > > The code contains the following parameters: > > * ``: Set to `true` to create a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set it to `false`. Then, the cluster gets no public endpoint and users can connect to it only from a virtual machine in the same subnet. > > * `publicEndpoint.allowedCidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. The example splits a comma-separated string, so pass multiple blocks as `192.168.0.0/24,8.8.8.64/26`. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > - `metadata.name`: Cluster name. > - `metadata.labels`: Labels in the `key: value` format. > - `spec.controlPlane.version`: Kubernetes version. The default and recommended version is 1.36. For supported versions, see [Kubernetes® versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > - `spec.controlPlane.subnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk). > - `etcdClusterSize`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). If you do not specify the number, the cluster is created with three etcd stores. This ensures high availability and makes the cluster more reliable; data stored in etcd is accessible even in case of failures. > > You can specify a lower number. However, the enabled high availability doesn't affect the cost of the cluster. ## How to modify clusters > [tab] CLI > > 1. Get the ID of the cluster via its name: > > ```bash > export K8S_CLUSTER_ID=$(nebius mk8s cluster get-by-name \ > --name --format jsonpath='{.metadata.id}') > ``` > > Alternatively, you can use the listing command: `nebius mk8s cluster list`. > > 2. Update the cluster settings: > > ```bash > nebius mk8s cluster update \ > --id $K8S_CLUSTER_ID \ > --labels \ > --control-plane-endpoints-public-endpoint= \ > --control-plane-endpoints-public-endpoint-allowed-cidrs \ > --control-plane-etcd-cluster-size > ``` > > The command contains the following parameters: > > * `--labels`: Labels in the `key=value` format. > > - `--control-plane-endpoints-public-endpoint`: Enables a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set the parameter to `false`. Then, users can connect to the cluster only from a virtual machine in the same subnet. > > - `--control-plane-endpoints-public-endpoint-allowed-cidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. > > Pass each CIDR block as a separate `--control-plane-endpoints-public-endpoint-allowed-cidrs` parameter. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > * `--control-plane-etcd-cluster-size`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). Three of them ensure high availability of the cluster. > > Only the parameters from the command above can be changed. To perform a full cluster update, add `--full` to the command. This will update all parameters with the default values or the values specified in the `--full` command. > [tab] Terraform > > 1. Modify the manifest with the deployed infrastructure: > > ```hcl > resource "nebius_mk8s_v1_cluster" "" { > name = "" > labels = { > = "" > = "" > ... > = "" > } > control_plane = { > endpoints = { > public_endpoint = {} > } > etcd_cluster_size = > } > } > ``` > > You can change the following parameters: > > * `name`: Cluster name. > * `labels`: Labels in the `key=value` format. > * `control_plane`: Settings of the cluster's [control plane](https://docs.nebius.com/kubernetes/components.md#control-plane-components): > > * `endpoints.public_endpoint`: Its value `{}` enables a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, delete the parameter. Then, users can connect to the cluster only from a virtual machine in the same subnet. > * `etcd_cluster_size`: Number or [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). If you do not specify the number, the cluster is created with three etcd stores. This ensures high availability and makes the cluster more reliable; data stored in etcd is accessible even in case of failures. > > You can specify a lower number. However, the enabled high availability does not affect the cost of the cluster. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the cluster via its name: > > ```go > clusterByName, err := sdk.Services().MK8S().V1(). > Cluster().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > k8sClusterID := clusterByName.GetMetadata().GetId() > if k8sClusterID == "" { > return fmt.Errorf("cluster ID is missing") > } > fmt.Println(k8sClusterID) > ``` > > 2. Update the cluster settings: > > ```go > clusterToUpdate, err := sdk.Services().MK8S().V1(). > Cluster().Get( > ctx, > &mk8s.GetClusterRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if clusterToUpdate.GetMetadata() == nil { > return fmt.Errorf("cluster metadata is missing") > } > clusterToUpdateSpec := clusterToUpdate.GetSpec() > if clusterToUpdateSpec == nil || > clusterToUpdateSpec.GetControlPlane() == nil { > return fmt.Errorf("cluster control plane spec is missing") > } > clusterToUpdate.Metadata.Labels = map[string]string{"key1": "value1", "key2": "value2"} > updateEndpoints := (*mk8s.ControlPlaneEndpointsSpec)(nil) > if { > updateEndpoints = &mk8s.ControlPlaneEndpointsSpec{ > PublicEndpoint: &mk8s.PublicEndpointSpec{ > AllowedCidrs: strings.Split("", ","), > }, > } > } > clusterToUpdateSpec.ControlPlane.Endpoints = updateEndpoints > clusterToUpdateSpec.ControlPlane.EtcdClusterSize = > updateOperation, err := sdk.Services().MK8S().V1(). > Cluster().Update( > ctx, > &mk8s.UpdateClusterRequest{ > Metadata: clusterToUpdate.GetMetadata(), > Spec: clusterToUpdateSpec, > }, > ) > if err != nil { > return err > } > if _, err = updateOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * `Metadata.Labels`: Labels in the `key: value` format. > > - ``: Set to `true` to create a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set it to `false`. Then, the cluster gets no public endpoint and users can connect to it only from a virtual machine in the same subnet. > > - `PublicEndpoint.AllowedCidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. The example splits a comma-separated string, so pass multiple blocks as `192.168.0.0/24,8.8.8.64/26`. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > * `Spec.ControlPlane.EtcdClusterSize`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). Three of them ensure high availability of the cluster. > [tab] Python SDK > > 1. Get the ID of the cluster via its name: > > ```python > lookup_cluster_service = ClusterServiceClient(sdk) > cluster_by_name = await lookup_cluster_service.get_by_name( > GetByNameRequest(name=""), > ) > if cluster_by_name.metadata is None: > raise ValueError("cluster metadata is missing") > k8s_cluster_id = cluster_by_name.metadata.id > if not k8s_cluster_id: > raise ValueError("cluster ID is missing") > print(k8s_cluster_id) > ``` > > 2. Update the cluster settings: > > ```python > update_cluster_service = ClusterServiceClient(sdk) > cluster_to_update = await update_cluster_service.get( > GetClusterRequest(id=""), > ) > if cluster_to_update.metadata is None: > raise ValueError("cluster metadata is missing") > if cluster_to_update.spec is None: > raise ValueError("cluster spec is missing") > if cluster_to_update.spec.control_plane is None: > raise ValueError("cluster control plane spec is missing") > cluster_to_update.metadata.labels = {"key1": "value1", "key2": "value2"} > cluster_to_update.spec.control_plane.endpoints = None > if : > cluster_to_update.spec.control_plane.endpoints = ( > ControlPlaneEndpointsSpec( > public_endpoint=PublicEndpointSpec( > allowed_cidrs="".split(","), > ), > ) > ) > cluster_to_update.spec.control_plane.etcd_cluster_size = ( > > ) > update_operation = await update_cluster_service.update( > UpdateClusterRequest( > metadata=cluster_to_update.metadata, > spec=cluster_to_update.spec, > ), > ) > await update_operation.wait() > ``` > > The code contains the following parameters: > > * `metadata.labels`: Labels in the `key: value` format. > > - ``: Set to `True` to create a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set it to `False`. Then, the cluster gets no public endpoint and users can connect to it only from a virtual machine in the same subnet. > > - `public_endpoint.allowed_cidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. The example splits a comma-separated string, so pass multiple blocks as `192.168.0.0/24,8.8.8.64/26`. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > * `spec.control_plane.etcd_cluster_size`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). Three of them ensure high availability of the cluster. > [tab] JavaScript SDK > > 1. Get the ID of the cluster via its name: > > ```ts > const lookupClusterService = new ClusterService(sdk); > const clusterByName = await lookupClusterService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const k8sClusterId = clusterByName.metadata?.id; > if (!k8sClusterId) { > throw new Error("cluster ID is missing"); > } > console.log(k8sClusterId); > ``` > > 2. Update the cluster settings: > > ```ts > const updateClusterService = new ClusterService(sdk); > const clusterToUpdate = await updateClusterService.get( > GetClusterRequest.create({ > id: "", > }), > ); > if (!clusterToUpdate.metadata) { > throw new Error("cluster metadata is missing"); > } > if (!clusterToUpdate.spec?.controlPlane) { > throw new Error("cluster control plane spec is missing"); > } > clusterToUpdate.metadata.labels = {"key1": "value1", "key2": "value2"}; > clusterToUpdate.spec.controlPlane.endpoints = undefined; > if () { > clusterToUpdate.spec.controlPlane.endpoints = > ControlPlaneEndpointsSpec.create({ > publicEndpoint: PublicEndpointSpec.create({ > allowedCidrs: "".split(","), > }), > }); > } > clusterToUpdate.spec.controlPlane.etcdClusterSize = > ; > const updateOperation = await updateClusterService.update( > UpdateClusterRequest.create({ > metadata: clusterToUpdate.metadata, > spec: clusterToUpdate.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > The code contains the following parameters: > > * `metadata.labels`: Labels in the `key: value` format. > > - ``: Set to `true` to create a public endpoint. As a result, the cluster is available from the internet, and you can connect to it from any machine. > > If you want to limit access to the cluster, set it to `false`. Then, the cluster gets no public endpoint and users can connect to it only from a virtual machine in the same subnet. > > - `publicEndpoint.allowedCidrs` (optional): Allowed CIDR blocks for the public endpoint. Only the IP addresses of these CIDR blocks are allowed to connect to the cluster. > > Specify the CIDR blocks in the IPv4 format with bits for hosts equal to zero. For example, `192.168.0.0/24` or `8.8.8.64/26`. The example splits a comma-separated string, so pass multiple blocks as `192.168.0.0/24,8.8.8.64/26`. > > For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > > * `spec.controlPlane.etcdClusterSize`: Number of [etcd stores](https://docs.nebius.com/kubernetes/components.md#etcd). Three of them ensure high availability of the cluster. ## How to delete clusters > [tab] CLI > > Get the cluster ID as shown in [How to modify clusters](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-cli) and delete the cluster: > > ```bash > nebius mk8s cluster delete --id $K8S_CLUSTER_ID > ``` > [tab] Terraform > > 1. If you manage node groups in the cluster with Terraform, first [delete the node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-delete-node-groups-terraform). > 2. Remove the corresponding `nebius_mk8s_v1_cluster` resource from the configuration file. > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Get the cluster ID as shown in [How to modify clusters](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-go-sdk) and delete the cluster: > > ```go > deleteOperation, err := sdk.Services().MK8S().V1(). > Cluster().Delete( > ctx, > &mk8s.DeleteClusterRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deleteOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > Get the cluster ID as shown in [How to modify clusters](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-python-sdk) and delete the cluster: > > ```python > delete_cluster_service = ClusterServiceClient(sdk) > delete_operation = await delete_cluster_service.delete( > DeleteClusterRequest(id=""), > ) > await delete_operation.wait() > ``` > [tab] JavaScript SDK > > Get the cluster ID as shown in [How to modify clusters](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-javascript-sdk) and delete the cluster: > > ```ts > const deleteClusterService = new ClusterService(sdk); > const deleteOperation = await deleteClusterService.delete( > DeleteClusterRequest.create({ > id: "", > }), > ).result; > await deleteOperation.wait(); > ``` ## Examples Creating a cluster with the Kubernetes version 1.36 and a public endpoint for the control plane: > [tab] CLI > > ```bash > nebius mk8s cluster create \ > --name cluster-example \ > --control-plane-version 1.36 \ > --control-plane-subnet-id \ > $(nebius vpc subnet list --format jsonpath='{.items[0].metadata.id}') \ > --control-plane-endpoints-public-endpoint=true > ``` > [tab] Go SDK > > `SubnetId` reads the `subnetID` variable. Assign the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) to it before you run the code. > > ```go > realCreateOperation, err := sdk.Services().MK8S().V1(). > Cluster().Create( > ctx, > &mk8s.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "cluster-example", > }, > Spec: &mk8s.ClusterSpec{ > ControlPlane: &mk8s.ControlPlaneSpec{ > Version: "1.36", > SubnetId: subnetID, > Endpoints: &mk8s.ControlPlaneEndpointsSpec{ > PublicEndpoint: &mk8s.PublicEndpointSpec{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = realCreateOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > `subnet_id` reads the `subnet_id` variable. Assign the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) to it before you run the code. > > ```python > real_cluster_service = ClusterServiceClient(sdk) > real_create_operation = await real_cluster_service.create( > CreateClusterRequest( > metadata=ResourceMetadata(name="cluster-example"), > spec=ClusterSpec( > control_plane=ControlPlaneSpec( > version="1.36", > subnet_id=subnet_id, > endpoints=ControlPlaneEndpointsSpec( > public_endpoint=PublicEndpointSpec(), > ), > ), > ), > ), > ) > await real_create_operation.wait() > ``` > [tab] JavaScript SDK > > `subnetId` reads the `subnetId` variable. Assign the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) to it before you run the code. > > ```ts > const realClusterService = new ClusterService(sdk); > const realCreateOperation = await realClusterService.create( > CreateClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "cluster-example", > }), > spec: ClusterSpec.create({ > controlPlane: ControlPlaneSpec.create({ > version: "1.36", > subnetId: subnetId, > endpoints: ControlPlaneEndpointsSpec.create({ > publicEndpoint: PublicEndpointSpec.create({}), > }), > }), > }), > }), > ).result; > await realCreateOperation.wait(); > ``` # Creating and modifying Managed Service for Kubernetes® node groups Source: https://docs.nebius.com/kubernetes/node-groups/manage.md Clusters in Managed Service for Kubernetes use Compute virtual machines as nodes to run applications. In this guide, you will learn how to create node groups, add them to clusters, and modify and delete them. In the web console, you can create node groups together with a new cluster during [cluster creation](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters). To learn how to manage clusters outside of their node groups, see [How to create and modify Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/clusters/manage.md). ## Prerequisites > [!TIP] > > You do not need to complete any prerequisites if you create or modify node groups in the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. [Create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-cli) and save its ID to an environment variable: > > ```bash > export K8S_CLUSTER_ID=$(nebius mk8s cluster get-by-name \ > --name --format jsonpath='{.metadata.id}') > ``` > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > 2. [Create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-terraform). > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. [Create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-go-sdk) and save its ID to the `k8sClusterID` variable: > > ```go > clusterByName, err := sdk.Services().MK8S().V1(). > Cluster().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > k8sClusterID := clusterByName.GetMetadata().GetId() > if k8sClusterID == "" { > return fmt.Errorf("cluster ID is missing") > } > fmt.Println(k8sClusterID) > ``` > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. [Create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-python-sdk) and save its ID to the `k8s_cluster_id` variable: > > ```python > lookup_cluster_service = ClusterServiceClient(sdk) > cluster_by_name = await lookup_cluster_service.get_by_name( > GetByNameRequest(name=""), > ) > if cluster_by_name.metadata is None: > raise ValueError("cluster metadata is missing") > k8s_cluster_id = cluster_by_name.metadata.id > if not k8s_cluster_id: > raise ValueError("cluster ID is missing") > print(k8s_cluster_id) > ``` > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. [Create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-javascript-sdk) and save its ID to the `k8sClusterId` variable: > > ```ts > const lookupClusterService = new ClusterService(sdk); > const clusterByName = await lookupClusterService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const k8sClusterId = clusterByName.metadata?.id; > if (!k8sClusterId) { > throw new Error("cluster ID is missing"); > } > console.log(k8sClusterId); > ``` ## How to create node groups Node groups define the characteristics of the virtual machines (VMs) that run your workloads. Each node group includes identical nodes created with the same template. You can create different types of node groups depending on your performance, cost, and availability requirements. For example, you can choose high-performance GPUs for compute-intensive workloads or preemptible VMs with [spot pricing](https://docs.nebius.com/signup-billing/pricing-policy.md) for interruptible tasks. ### Regular node groups > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > > 2. Open the page of the cluster where you want to create a node group. > > 3. Switch to the **Node groups** tab. > > 4. Click  **Create node group**. > > 5. On the page that opens, specify a name for the node group (for example, `mk8s-node-group-test`). > > 6. (Optional) Enable the **Assign public IPv4 addresses** option if you want the nodes to be accessible from the internet. > > 7. Under **Size**, specify the initial **Number of nodes**. If you want to let the node group scale up or down depending on the workload, enable autoscaling. After that, specify the minimum and maximum number of nodes that the group can have. > > 8. Configure the **Computing resources** section: > > 1. Select whether the node group should have GPUs. > > 2. Select a regular VM type. > > VMs without GPUs only support the regular type. > > For information about creating preemptible node groups, see [instructions below](https://docs.nebius.com/kubernetes/node-groups/manage.md#preemptible-node-groups-web-console). > > 3. (Optional) For a regular VM with GPUs, select **Reservation usage**. Specify whether Managed Kubernetes should allocate resources for the node group from [reservations](https://docs.nebius.com/kubernetes/node-groups/reservations.md). > > The **Reservation usage** field is only displayed if you have [capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md). > > > [accordion] More information about reservation usage > > > > * **With reservations**: The resources are allocated from reservations ([capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md)). For example, if a Nebius manager has created a capacity block group for you, Managed Kubernetes allocates GPUs for the node group from this capacity block group. This ensures that resources are always available, even if VMs in the node group are stopped (for example, by you or a [maintenance event](https://docs.nebius.com/kubernetes/maintenance/index.md)). > > > > In the **Reservation** section, you can configure the following options: > > > > * **Any (existing and future)** (default): Compute selects among your matching capacity block groups automatically. > > * **Specific capacity block groups**: Select one or more capacity block groups. Each option shows the capacity block group ID, reservation period, and GPU usage. Make sure the selected groups have enough capacity and do not expire soon. > > * **Switch to PAYG**: Choose whether the VM can start after you create or restart it without active intervals in selected capacity block groups: > > > > * **When reservation is exhausted** (default): The VM can start as a pay-as-you-go VM when no capacity is available in the selected capacity block groups. > > * **Never**: The VM cannot start without available capacity in the selected capacity block groups. > > > > This does not affect the VM when it is running. If an interval in a selected capacity block group expires while the VM is running, the VM always continues as a pay-as-you-go VM, regardless of this setting. > > > > If you have capacity block groups in multiple regions, select a **Region** first. > > > > * **Without reservations**: The resources are allocated from a common pool, and no reservations are used for the node group. > > 4. Select an available [platform and a preset](https://docs.nebius.com/compute/virtual-machines/types.md) (a combination of GPUs, vCPUs and RAM) that fits your workload requirements. > > 5. (Optional) If you create a node group with 8 GPUs (for example, for training models), use a GPU cluster for the node group. InfiniBand™ in the cluster allows you to accelerate tasks that require high-performance computing (HPC) power. A single node group without InfiniBand cannot perform these tasks as quickly. > > To use a GPU cluster, select an existing one or create a new cluster: > > 1. Click  **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](https://docs.nebius.com/compute/clusters/gpu/index.md#infiniband-fabrics). > > 3. Click **Create**. > > > [!WARNING] > > > > If a node group uses a GPU cluster, the GPU cluster must be located in the same project as the node group's parent cluster. > > 6. (Optional) Enable or disable **GPU settings**. They are enabled by default, and they allow Managed Kubernetes to pre-install NVIDIA drivers and the [Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html). You can also select a specific NVIDIA CUDA driver version. > > Disable **GPU settings** only if you need to [install specific driver versions manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups) or use a custom operator. Disabling is not recommended. > > 7. Select an operating system for the nodes (for example, `Ubuntu 24.04 LTS`). > > 9. Under **Node storage**, select the disk type and specify the size in GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.). Supported [disk types](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks) are the following: > > * **SSD**: Standard solid-state drive for general-purpose workloads. > * **SSD NRD**: Network-replicated SSD providing higher reliability through data duplication across the network. > * **SSD IO**: High-performance SSD optimized for I/O-intensive operations with lower latency. > > 10. (Optional) If the selected platform and preset support local SSD disks, enable **Local SSD disks** to add ephemeral local storage to your node group. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > 11. (Optional) If you want to attach a filesystem to your node group, in the **Shared filesystems** section, specify the settings of this filesystem: > > 1. Click  **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 node group automatically, keep the **Auto mount** option enabled. > > 12. (Optional) In the **Username and SSH key** field, add credentials, so you can [connect to the node group](https://docs.nebius.com/compute/virtual-machines/connect.md): > > 1. Generate an [SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md). > > 2. In the **Username and SSH key** field, click . > > 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  **Add credentials**. > > 4. In the window that opens, specify the username of the node group user, a public key of your SSH key pair and the credentials name to recognize the key in the list. > > 5. Click **Add credentials**. > > 13. (Optional) Under **Additional**, select or create a [service account](https://docs.nebius.com/iam/overview.md) that will perform actions on behalf of the nodes. > > 14. Click **Create node group**. > [tab] CLI > > Create a node group: > > ```bash > nebius mk8s node-group create \ > --parent-id $K8S_CLUSTER_ID \ > --name \ > --fixed-node-count \ > --template-resources-platform \ > --template-resources-preset \ > --template-gpu-settings-drivers-preset > ``` > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), don't add the `--template-gpu-settings-drivers-preset` parameter to the command. Instead, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-cli). > [tab] Terraform > > 1. Create a node group configuration file: > > ```hcl > resource "nebius_mk8s_v1_node_group" "" { > name = "" > parent_id = "" > fixed_node_count = > > template = { > resources = { > platform = "" > preset = "" > } > > gpu_settings = { > drivers_preset = "" > } > } > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Create a node group: > > ```go > regularName := ( > "" > ) > regularNodeCount := ( > > ) > regularPlatform := ( > "" > ) > regularPreset := ( > "" > ) > regularDriverPreset := ( > "" > ) > regularGroupOp, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: k8sClusterID, > Name: regularName, > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: regularNodeCount, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: regularPlatform, > Size: &mk8s.ResourcesSpec_Preset{ > Preset: regularPreset, > }, > }, > GpuSettings: &mk8s.GpuSettings{ > DriversPreset: regularDriverPreset, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = regularGroupOp.Wait(ctx); err != nil { > return err > } > ``` > > The code contains the following parameters: > > * `Metadata.Name`: Node group name. > > * `Spec.Size.FixedNodeCount`: Number of nodes per group. > > * `Spec.Template.Resources.Platform`: Platform with GPUs. > > * `Spec.Template.Resources.Size.Preset`: Compatible preset. > > * `Spec.Template.GpuSettings.DriversPreset`: GPU drivers preset. > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit `GpuSettings`. Instead, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-go-sdk). > [tab] Python SDK > > Create a node group: > > ```python > regular_name = ( > "" > ) > regular_node_count = ( > > ) > regular_platform = ( > "" > ) > regular_preset = ( > "" > ) > regular_driver_preset = ( > "" > ) > regular_group_service = NodeGroupServiceClient(sdk) > regular_group_operation = await regular_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=k8s_cluster_id, > name=regular_name, > ), > spec=NodeGroupSpec( > fixed_node_count=regular_node_count, > template=NodeTemplate( > resources=ResourcesSpec( > platform=regular_platform, > preset=regular_preset, > ), > gpu_settings=GpuSettings( > drivers_preset=regular_driver_preset, > ), > ), > ), > ), > ) > await regular_group_operation.wait() > ``` > > The code contains the following parameters: > > * `metadata.name`: Node group name. > > * `spec.fixed_node_count`: Number of nodes per group. > > * `spec.template.resources.platform`: Platform with GPUs. > > * `spec.template.resources.preset`: Compatible preset. > > * `spec.template.gpu_settings.drivers_preset`: GPU drivers preset. > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit `gpu_settings`. Instead, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-python-sdk). > [tab] JavaScript SDK > > Create a node group: > > ```ts > const regularName = ""; > const regularNodeCount = ; > const regularPlatform = ""; > const regularPreset = ""; > const regularDriverPreset = > ""; > const regularGroupService = new NodeGroupService(sdk); > const regularGroupOperation = await regularGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: k8sClusterId, > name: regularName, > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: regularNodeCount, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: regularPlatform, > size: { > $case: "preset", > preset: regularPreset, > }, > }), > gpuSettings: GpuSettings.create({ > driversPreset: regularDriverPreset, > }), > }), > }), > }), > ).result; > await regularGroupOperation.wait(); > ``` > > The code contains the following parameters: > > * `metadata.name`: Node group name. > > * `spec.size.fixedNodeCount`: Number of nodes per group. > > * `spec.template.resources.platform`: Platform with GPUs. > > * `spec.template.resources.size.preset`: Compatible preset. > > * `spec.template.gpuSettings.driversPreset`: GPU drivers preset. > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit `gpuSettings`. Instead, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-javascript-sdk). For descriptions of node group parameters, see [Node group parameters](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). For more details about GPUs in node groups, see [Working with GPUs in the Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/gpu/set-up.md) and [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md). To allocate GPUs and network devices with Dynamic Resource Allocation, see [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md). ### Preemptible node groups Preemptible nodes use virtual machines that can be stopped by Nebius AI Cloud at any time. They can help reduce computing costs for workloads with interruptions, such as batch processing or training ML models. Preemptible node groups are charged at the current [spot price](https://docs.nebius.com/signup-billing/pricing-policy.md). To set the maximum price, use a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md). For more information about how preemptible VMs work, see [Preemptible virtual machines](https://docs.nebius.com/compute/virtual-machines/preemptible.md). > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > > 2. [Create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters-web-console) or choose an existing one. > > 3. On the cluster page, switch to the **Node groups** tab. > > 4. Click  **Create node group**. > > 5. When creating a node group, under **Computing resources**, select: > > * **With GPU** > * **Preemptible** VM type > > 6. In **Max price**, select or create a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md), or choose **Follows spot price**. > > For information about other node group parameters, see [instructions about creating regular node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#regular-node-groups-web-console). > [tab] CLI > > Run the Nebius AI Cloud CLI command [nebius mk8s node-group create](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md) with the `--template-preemptible` parameter. > > Add one of the following [spot pricing](https://docs.nebius.com/signup-billing/pricing-policy.md) parameters. The example command below uses `--template-follows-spot-price`: > > * `--template-spot-pricing-policy-id `: Select a pricing policy that sets the maximum spot price. For information on how to get a pricing policy ID or create a new policy, see [Managing pricing policies](https://docs.nebius.com/signup-billing/manage-pricing-policy.md). > * `--template-follows-spot-price`: Accept the current spot price without setting a maximum price. > > ```bash > nebius mk8s node-group create \ > ... \ > --template-preemptible \ > --template-follows-spot-price > ``` > [tab] Terraform > > Create a node group configuration file and set the `.template.preemptible` block to enable preemptibility. Set one of the spot pricing settings: > > * `spot_pricing_policy`: Select a pricing policy that sets the maximum price. > * `follows_spot_price`: Accept the current spot price without setting a maximum. > > ```hcl > resource "nebius_mk8s_v1_node_group" "example" { > name = "preemptible-ng" > ... > > template = { > preemptible = {} > follows_spot_price = {} > ... > } > } > ``` > [tab] Go SDK > > Create a node group with `Spec.Template.Preemptible` set: > > ```go > preemptibleGroupOp, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: k8sClusterID, > Name: "node-group-1", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 1, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "1gpu-16vcpu-200gb", > }, > }, > Preemptible: &mk8s.PreemptibleSpec{}, > PricingModel: &mk8s.NodeTemplate_FollowsSpotPrice{ > FollowsSpotPrice: &mk8s.FollowsSpotPriceSpec{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = preemptibleGroupOp.Wait(ctx); err != nil { > return err > } > ``` > > `FollowsSpotPrice` accepts the current spot price without setting a maximum price. To set a maximum price, use `SpotPricingPolicy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [tab] Python SDK > > Create a node group with `spec.template.preemptible` set: > > ```python > preemptible_group_service = NodeGroupServiceClient(sdk) > preemptible_group_operation = await preemptible_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=k8s_cluster_id, > name="node-group-1", > ), > spec=NodeGroupSpec( > fixed_node_count=1, > template=NodeTemplate( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="1gpu-16vcpu-200gb", > ), > preemptible=PreemptibleSpec(), > follows_spot_price=FollowsSpotPriceSpec(), > ), > ), > ), > ) > await preemptible_group_operation.wait() > ``` > > `follows_spot_price` accepts the current spot price without setting a maximum price. To set a maximum price, use `spot_pricing_policy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. > [tab] JavaScript SDK > > Create a node group with `spec.template.preemptible` set: > > ```ts > const preemptibleGroupService = new NodeGroupService(sdk); > const preemptibleGroupOperation = > await preemptibleGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: k8sClusterId, > name: "node-group-1", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 1, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "1gpu-16vcpu-200gb", > }, > }), > preemptible: PreemptibleSpec.create({}), > pricingModel: { > $case: "followsSpotPrice", > followsSpotPrice: FollowsSpotPriceSpec.create({}), > }, > }), > }), > }), > ).result; > await preemptibleGroupOperation.wait(); > ``` > > `followsSpotPrice` accepts the current spot price without setting a maximum price. To set a maximum price, use `spotPricingPolicy` with the ID of a [pricing policy](https://docs.nebius.com/signup-billing/manage-pricing-policy.md) instead. ## How to modify node groups Modifying the node group template triggers a [rolling update](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). Managed Kubernetes replaces each node with another one, with a new configuration. To check the list of the template parameters, see all `--template-*` parameters in [CLI reference](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md) or the nested schema for `template` in [Terraform reference](https://docs.nebius.com/terraform-provider/reference/resources/mk8s_v1_node_group.md#nested-schema-for-template). If you modify other parameters, Managed Kubernetes does not replace the nodes, they remain unchanged. During a node group update, Managed Kubernetes uses the default values of the deployment strategy [parameters](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). By default, one node at a time can be unavailable during the update, and no additional compute quota is required. You can change the deployment strategy when you modify a node group. > [tab] Web console > > To modify a node group: > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > > 2. Open the page of the required cluster and then go to the **Node groups** tab. > > 3. Open the page of the node group that you wish to change. > > 4. Switch to the **Settings** tab and then modify the required parameters. > > Parameters available for editing: > > * **Name**: Name of the node group. > > * **Size**: > > * **Number of nodes**: Target and fixed number of nodes (if autoscaling is disabled). The maximum number is 100. > * **Enable autoscaling**: Allows you to set the range of nodes within which the [cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) adds or removes nodes as needed. > > * **Computing resources**: Select whether the node group should have GPUs, and then specify the hardware configuration: > > * **VM type**: > > * **Regular**: Standard VMs for high-availability production workloads. > * **Preemptible**: VMs for interruptible workloads that may be stopped by the platform at any time. Charges depend on the current spot price. > > * **Available platform** and **Preset**: Combination of GPUs, vCPUs and RAM that fits your workload requirements. For more information, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * **GPU cluster**: GPU cluster with InfiniBand. Allows you to accelerate tasks that require HPC power. > > Available only if the node group contains 8 GPUs. > > * **GPU settings**: If enabled, the system pre-installs NVIDIA drivers and the [Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html). You can also select a specific NVIDIA CUDA driver version. > > Disable **GPU settings** only if you need to [install specific driver versions manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups) or use a custom operator. > > * **Drivers**: CUDA driver version based on enabled **GPU settings**. > > * **Operating system**: OS for the nodes, for example, `Ubuntu 24.04 LTS`. > > * **Node storage**: > > * **Disk type**: [Type of the boot disk](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). > * **Size**: Size of the boot disk in GiB. > > 5. Click **Save changes**. > > The status of the node group changes to **Updating** while the new configuration is being applied. > [tab] CLI > > 1. Get the node group ID and save it to an environment variable: > > ```bash > export K8S_NODE_GROUP_ID=$(nebius mk8s node-group get-by-name \ > --parent-id $K8S_CLUSTER_ID \ > --name --format jsonpath='{.metadata.id}') > ``` > > 2. Update the node group: > > ```bash > nebius mk8s node-group update \ > --id $K8S_NODE_GROUP_ID \ > (parameters) > ``` > > Only the parameters specified in the CLI command can be changed. You can do a full update instead by adding `--full` to the command. This will update all parameters with the values specified in the command or the default values. > > Add `--auto-approve` to approve node recreation automatically if it is required by the update. Otherwise, the CLI waits for confirmation before proceeding. > [tab] Terraform > > 1. In the node group configuration file, update the [parameters](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters-terraform) of the `nebius_mk8s_v1_node_group` resource. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the node group ID and save it to the `nodeGroupID` variable: > > ```go > nodeGroupByName, err := sdk.Services().MK8S().V1(). > NodeGroup().GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: k8sClusterID, > Name: "", > }, > ) > if err != nil { > return err > } > nodeGroupID := nodeGroupByName.GetMetadata().GetId() > if nodeGroupID == "" { > return errors.New("node group ID is missing") > } > ``` > > 2. Update the node group. In the example, the node group gets a new `Metadata.Name`: > > ```go > groupForRename, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{Id: nodeGroupID}, > ) > if err != nil { > return err > } > groupForRename.GetMetadata().Name = "updated-name" > renameGroupOp, err := sdk.Services().MK8S().V1().NodeGroup(). > Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: groupForRename.GetMetadata(), > Spec: groupForRename.GetSpec(), > }, > ) > if err != nil { > return err > } > if _, err = renameGroupOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the node group ID and save it to the `node_group_id` variable: > > ```python > node_group_lookup_service = NodeGroupServiceClient(sdk) > node_group_by_name = await node_group_lookup_service.get_by_name( > GetByNameRequest( > parent_id=k8s_cluster_id, > name="", > ), > ) > node_group_id = node_group_by_name.metadata.id > if not node_group_id: > raise ValueError("node group ID is missing") > ``` > > 2. Update the node group. In the example, the node group gets a new `metadata.name`: > > ```python > rename_group_service = NodeGroupServiceClient(sdk) > group_for_rename = await rename_group_service.get( > GetNodeGroupRequest(id=node_group_id), > ) > group_for_rename.metadata.name = "updated-name" > rename_group_operation = await rename_group_service.update( > UpdateNodeGroupRequest( > metadata=group_for_rename.metadata, > spec=group_for_rename.spec, > ), > ) > await rename_group_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the node group ID and save it to the `nodeGroupId` variable: > > ```ts > const nodeGroupLookupService = new NodeGroupService(sdk); > const nodeGroupByName = await nodeGroupLookupService.getByName( > GetByNameRequest.create({ > parentId: k8sClusterId, > name: "", > }), > ); > let nodeGroupId = nodeGroupByName.metadata?.id; > if (!nodeGroupId) { > throw new Error("node group ID is missing"); > } > ``` > > 2. Update the node group. In the example, the node group gets a new `metadata.name`: > > ```ts > const renameGroupService = new NodeGroupService(sdk); > const groupForRename = await renameGroupService.get( > GetNodeGroupRequest.create({ > id: nodeGroupId, > }), > ); > if (!groupForRename.metadata) { > throw new Error("node group metadata is missing"); > } > groupForRename.metadata.name = "updated-name"; > const renameGroupOperation = await renameGroupService.update( > UpdateNodeGroupRequest.create({ > metadata: groupForRename.metadata, > spec: groupForRename.spec, > }), > ).result; > await renameGroupOperation.wait(); > ``` For descriptions of node group parameters, see [Node group parameters](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). ## Deployment strategy and quotas Managed Kubernetes performs a *rolling update* to each node in the group when you modify the node group template. To check the list of the template parameters, see all `--template-*` parameters in [CLI reference](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md) or the nested schema for `template` in [Terraform reference](https://docs.nebius.com/terraform-provider/reference/resources/mk8s_v1_node_group.md#nested-schema-for-template). With the default values of the deployment strategy [parameters](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters), Managed Kubernetes updates one node at a time in the following order: 1. Cordons the existing node (marks it as unschedulable). 2. Drains the existing node (evicts all Pods from it). 3. Deletes the existing node. 4. Creates a replacement node. This default behavior does not require additional compute quota during an update. Managed Kubernetes uses the node group's *deployment strategy* to determine how, in what order and to how many nodes at a time it performs the listed steps. You can configure the deployment strategy using the corresponding [parameters](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). If you prefer Managed Kubernetes to create replacement nodes before removing the existing ones, for example to minimize workload disruption, configure a deployment strategy that allows the node group to temporarily exceed its target size during an update. In this case, make sure that your [quotas on underlying Compute resources](https://docs.nebius.com/compute/resources/quotas-limits.md) allow for the additional nodes that can be created during a rolling update. If there is no quota available for any of the required resources, the update fails. You can check your remaining quotas on the [Administration → Limits → Quotas](https://console.nebius.com/quota) page of the web console. > For example, each node uses 8 GPUs, 128 vCPUs, 1600 GiB RAM and a public IP address. If your deployment strategy allows up to two additional nodes during the update, you need quotas for the following additional resources: > > * 16 GPUs (2 × 8) > * 256 vCPUs (2 × 128) > * 3200 GiB RAM (2 × 1600) > * 2 public IP addresses When you or the [autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) scales a node group up or down, Managed Kubernetes does not recreate any nodes. ## Node group parameters > [tab] CLI > > The `nebius mk8s node-group create` and `nebius mk8s node-group update` commands support the following parameters. > > * **Metadata** > > * `--name`: Node group name. Must be unique within the tenant. Cannot be changed after creation. > * **Kubernetes version on nodes** > > * `--version`: Kubernetes version in `.` format. Recommended version is 1.36. For more information, see [Kubernetes versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * **Node group size** > > * `--fixed-node-count`: Number of nodes per group. The maximum is 100. > * `--autoscaling-min-node-count`, `--autoscaling-max-node-count`: Allow you to set the range of nodes within which the [cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) adds or removes nodes as needed. > * **Node template** > > All nodes in a group are identical and are created based on a *node template*. A node template is similar to a virtual machine specification in Compute. > > The node template has the following parameters: > > * `--template-taints`: Array of Kubernetes [taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) (rules that repel Pods from nodes) for all nodes in the group. > > * `--template-resources-platform`: ID of the Compute VM platform for the nodes. See [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `--template-resources-preset`: Compatible preset (number of GPUs and vCPUs, RAM size), see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `--template-gpu-settings-drivers-preset`: GPU drivers preset, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-cli). > > * `--template-gpu-settings-dra` (optional): Enables Dynamic Resource Allocation for the node group. See [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#how-to-enable-dra-on-a-node-group-cli). > > * `--template-gpu-cluster-id`: GPU cluster ID. Specify this parameter to interconnect GPU nodes using InfiniBand™. The selected platform and preset must be compatible with GPU clusters. See [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand](https://docs.nebius.com/kubernetes/gpu/clusters.md). > > > [!WARNING] > > > > If a node group uses a GPU cluster, the GPU cluster must be located in the same project as the node group's parent cluster. > > * `--template-service-account-id`: Service account ID. You can add a service account, for example, to [pull images from Container Registry](https://docs.nebius.com/kubernetes/workloads/images-container-registry.md). > > * `--template-network-interfaces`: Network interface configuration (for example, subnet ID, see [How to use a non-default subnet for Managed Service for Kubernetes® clusters and node groups](https://docs.nebius.com/kubernetes/networking/non-default-subnet.md)). > > * `--template-filesystems`: Filesystem for nodes, see [How to attach volumes to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms-cli). > > > [!WARNING] > > > > The filesystem that you are adding to a node group must be located in the same project as the node group's parent cluster. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). > > * `--template-local-disks-passthrough-group-requested` (optional): Requests [local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) when set to `true`. You can configure how the local SSD disks are added to your node group with one of the following parameters: > > * `--template-local-disks-config-kubelet-ephemeral`: Set to `true` to use the requested local SSD disks as the node's [local ephemeral storage](https://kubernetes.io/docs/concepts/storage/ephemeral-storage/). Managed Kubernetes prepares, formats and mounts the resulting storage for node ephemeral data. This is the default configuration mode. > > * `--template-local-disks-config-none`: Set to `true` to provision the requested local SSD disks with no preparation. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `--template-reservation-policy-policy`: Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/kubernetes/node-groups/reservations.md) and run your node group based on them. As a result, the node group resources are reserved and always available. > > * `--template-reservation-policy-reservation-ids`: IDs of specific reservations. These are capacity block groups that a Nebius manager has created. > > For information about how to configure `--template-reservation-policy-policy` and `--template-reservation-policy-reservation-ids`, see [How to add reservations to node groups](https://docs.nebius.com/kubernetes/node-groups/reservations.md#how-to-add-reservations-to-node-groups-cli). > * **Deployment strategy** > > The *deployment strategy* of a node group defines how it is updated when necessary — for example, when you modify the group's node template or Kubernetes version, or when nodes fail and need to be replaced. For more details, see [Deployment strategy and quotas](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). > > The following parameters specify the deployment strategy: > > * `--strategy-max-unavailable-percent`, `--strategy-max-unavailable-count`: Maximum number of nodes in a group that can be unavailable at any time during an update, set as a percentage of the group's target size or a number of nodes. When a percentage is used, the number of nodes is calculated by rounding down. > > > For example, if the value of `--strategy-max-unavailable-percent` is 40 and the group's target size is 3, at most ⌊3 × 40%⌋ = ⌊1.2⌋ = 1 node can be unavailable at any time during the update. > > The default value is `--strategy-max-unavailable-count 1`. Cannot be set to 0 if `--strategy-max-surge-count` or `--strategy-max-surge-percent` is 0. > > * `--strategy-max-surge-percent`, `--strategy-max-surge-count`: Maximum number of nodes in a group that can exceed the group's target size at any time during an update, set as a percentage of the target size or as a number of nodes. > > > For example, if the value of `--strategy-max-surge-count` is 2 and the group's target size is 3, then the group can only have 3 + 2 = 5 nodes at any time during the update. > > The default value is `--strategy-max-surge-count 0`. Cannot be set to 0 if `--strategy-max-unavailable-count` or `--strategy-max-unavailable-percent` is 0. > > * `--strategy-drain-timeout`: Maximum amount of time it can take to drain a node during the update. If the timeout is set, a node in the updated group is deleted when it reaches the timeout, even if its draining is not complete. > > > [!WARNING] > > > > The default timeout is 10 minutes. If draining isn't completed within this time frame, Managed Kubernetes applies the force drain and deletes the node. > [tab] Terraform > > The `nebius_mk8s_v1_node_group` resource supports the following parameters: > > * **Metadata** > > * `parent_id`: Cluster ID. > * `name`: Node group name. Must be unique within the tenant. Cannot be changed after creation. > * **Kubernetes version on nodes** > > * `version`: Kubernetes version in `.` format. Recommended version is 1.36. For more information, see [Kubernetes versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * **Node group size** > > * `fixed_node_count`: Number of nodes per group. The maximum is 100. Cannot be set together with `autoscaling`. > * `autoscaling.min_node_count`, `autoscaling.max_node_count`: Allow you to set the range of nodes within which the [cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) adds or removes nodes as needed. Cannot be set together with `fixed_node_count`. > * **Node template** > > All nodes in a group are identical and are created based on a *node template*. A node template is similar to a virtual machine specification in Compute. > > The node template is configured in the `template` block and supports the following parameters: > > * `template.taints`: Array of Kubernetes [taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) (rules that repel Pods from nodes) for all nodes in the group. > > * `template.resources.platform`: ID of the Compute VM platform for the nodes. See [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `template.resources.preset`: Compatible preset (number of GPUs and vCPUs, RAM size), see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `template.gpu_settings.drivers_preset`: GPU drivers preset. For more information, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components). > > * `template.gpu_settings.dra` (optional): Enables Dynamic Resource Allocation for the node group. See [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#how-to-enable-dra-on-a-node-group-terraform). > > * `template.gpu_cluster.id`: GPU cluster ID. Specify this parameter to interconnect GPU nodes using InfiniBand™. The selected platform and preset must be compatible with GPU clusters. See [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand](https://docs.nebius.com/kubernetes/gpu/clusters.md). > > > [!WARNING] > > > > If a node group uses a GPU cluster, the GPU cluster must be located in the same project as the node group's parent cluster. > > * `template.service_account_id`: Service account ID. You can add a service account, for example, to [pull images from Container Registry](https://docs.nebius.com/kubernetes/workloads/images-container-registry.md). > > * `template.network_interfaces`: Network interface configuration (for example, subnet ID, see [How to use a non-default subnet for Managed Service for Kubernetes® clusters and node groups](https://docs.nebius.com/kubernetes/networking/non-default-subnet.md)). > > * `template.filesystems`: Filesystem for nodes, see [How to attach volumes to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms). > > > [!WARNING] > > > > The filesystem that you are adding to a node group must be located in the same project as the node group's parent cluster. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). > > * `template.local_disks.passthrough_group.requested`: Requests [local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) when set to `true`. You can configure how the local SSD disks are added to your node group with one of the following parameters: > > * `template.local_disks.config.kubelet_ephemeral`: Set to `true` to use the requested local SSD disks as the node's [local ephemeral storage](https://kubernetes.io/docs/concepts/storage/ephemeral-storage/). Managed Kubernetes prepares, formats and mounts the resulting storage for node ephemeral data. This is the default configuration mode. > > * `template.local_disks.config.none`: Set to `true` to provision the requested local SSD disks with no configuration. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `template.reservation_policy.policy`: Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/kubernetes/node-groups/reservations.md) and run your node group based on them. As a result, the node group resources are reserved and always available. > > * `template.reservation_policy.reservation_ids`: IDs of specific reservations. These are capacity block groups that a Nebius manager has created. > > For information about how to configure `template.reservation_policy.policy` and `template.reservation_policy.reservation_ids`, see [How to add reservations to node groups](https://docs.nebius.com/kubernetes/node-groups/reservations.md#how-to-add-reservations-to-node-groups-terraform). > * **Deployment strategy** > > The *deployment strategy* of a node group defines how it is updated when necessary — for example, when you modify the group's node template or Kubernetes version, or when nodes fail and need to be replaced. For more details, see [Deployment strategy and quotas](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). > > The deployment strategy is configured in the `strategy` block: > > * `strategy.max_unavailable.percent`, `strategy.max_unavailable.count`: Maximum number of nodes in a group that can be unavailable at any time during an update, set as a percentage of the group's target size or a number of nodes. When a percentage is used, the number of nodes is calculated by rounding down. > > > For example, if `strategy.max_unavailable.percent = 40` and the group's target size is 3, at most ⌊3 × 40%⌋ = ⌊1.2⌋ = 1 node can be unavailable at any time during the update. > > The default value is 1. Cannot be set to 0 if `strategy.max_surge.count` or `strategy.max_surge.percent` is set to 0. > > * `strategy.max_surge.percent`, `strategy.max_surge.count`: Maximum number of nodes in a group that can exceed the group's target size at any time during an update, set as a percentage of the target size or as a number of nodes. > > > For example, if `strategy.max_surge.count = 2` and the group's target size is 3, then the group can have up to 3 + 2 = 5 nodes at any time during the update. > > The default value is `strategy.max_surge.count = 0`. Cannot be set to 0 if `strategy.max_unavailable.count` or `strategy.max_unavailable.percent` is set to 0. > > * `strategy.drain_timeout`: Maximum amount of time it can take to drain a node during the update. If the timeout is set, a node in the updated group is deleted when it reaches the timeout, even if its draining is not complete. > > > [!WARNING] > > > > The default timeout is 10 minutes. If draining isn't completed within this time frame, Managed Kubernetes applies the force drain and deletes the node. > [tab] Go SDK > > The `mk8s.CreateNodeGroupRequest` and `mk8s.UpdateNodeGroupRequest` messages support the following parameters. > > Parameters that the API defines as `oneof` fields are set through a wrapper type. For example, `Spec.Size` with a fixed node count is `Size: &mk8s.NodeGroupSpec_FixedNodeCount{FixedNodeCount: 3}`, and `Spec.Template.Resources.Size` with a preset is `Size: &mk8s.ResourcesSpec_Preset{Preset: ""}`. The paths below are given in their flattened form; the code samples on this page show the wrappers in place. > > * **Metadata** > > * `Metadata.ParentId`: Cluster ID. > * `Metadata.Name`: Node group name. Must be unique within the tenant. Cannot be changed after creation. > * **Kubernetes version on nodes** > > * `Spec.Version`: Kubernetes version in `.` format. Recommended version is 1.36. For more information, see [Kubernetes versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * **Node group size** > > * `Spec.Size.FixedNodeCount`: Number of nodes per group. The maximum is 100. Cannot be set together with `Spec.Size.Autoscaling`. > * `Spec.Size.Autoscaling.MinNodeCount`, `Spec.Size.Autoscaling.MaxNodeCount`: Allow you to set the range of nodes within which the [cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) adds or removes nodes as needed. Cannot be set together with `Spec.Size.FixedNodeCount`. > * **Node template** > > All nodes in a group are identical and are created based on a *node template*. A node template is similar to a virtual machine specification in Compute. > > The node template is configured in `Spec.Template` and supports the following parameters: > > * `Spec.Template.Taints`: Array of Kubernetes [taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) (rules that repel Pods from nodes) for all nodes in the group. > > * `Spec.Template.Resources.Platform`: Platform with GPUs, see [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md). > > * `Spec.Template.Resources.Size.Preset`: Compatible preset (number of GPUs and vCPUs, RAM size), see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `Spec.Template.GpuSettings.DriversPreset`: GPU drivers preset, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-go-sdk). > > * `Spec.Template.GpuSettings.Dra` (optional): Enables Dynamic Resource Allocation for the node group. See [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#how-to-enable-dra-on-a-node-group-go-sdk). > > * `Spec.Template.GpuCluster.Id`: GPU cluster ID. > > * `Spec.Template.ServiceAccountId`: Service account ID. You can add a service account, for example, to [pull images from Container Registry](https://docs.nebius.com/kubernetes/workloads/images-container-registry.md). > > * `Spec.Template.NetworkInterfaces`: Network interface configuration (for example, subnet ID, see [How to use a non-default subnet for Managed Service for Kubernetes® clusters and node groups](https://docs.nebius.com/kubernetes/networking/non-default-subnet.md)). > > * `Spec.Template.Filesystems`: Filesystem for nodes, see [How to attach volumes to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms-go-sdk). > > > [!WARNING] > > > > The filesystem that you are adding to a node group must be located in the same project as the node group's parent cluster. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). > > * `Spec.Template.LocalDisks.PassthroughGroup.Requested`: Requests [local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) when set to `true`. You can configure how the local SSD disks are added to your node group with one of the following parameters: > > * `Spec.Template.LocalDisks.Config.KubeletEphemeral`: Set to `true` to use the requested local SSD disks as the node's [local ephemeral storage](https://kubernetes.io/docs/concepts/storage/ephemeral-storage/). Managed Kubernetes prepares, formats and mounts the resulting storage for node ephemeral data. This is the default configuration mode. > > * `Spec.Template.LocalDisks.Config.None`: Set to `true` to provision the requested local SSD disks with no configuration. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `Spec.Template.ReservationPolicy.Policy`: Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/kubernetes/node-groups/reservations.md) and run your node group based on them. As a result, the node group resources are reserved and always available. > > * `Spec.Template.ReservationPolicy.ReservationIds`: IDs of specific reservations. These are capacity block groups that a Nebius manager has created. > > For information about how to configure `Spec.Template.ReservationPolicy.Policy` and `Spec.Template.ReservationPolicy.ReservationIds`, see [How to add reservations to node groups](https://docs.nebius.com/kubernetes/node-groups/reservations.md#how-to-add-reservations-to-node-groups-go-sdk). > * **Deployment strategy** > > The *deployment strategy* of a node group defines how it is updated when necessary — for example, when you modify the group's node template or Kubernetes version, or when nodes fail and need to be replaced. For more details, see [Deployment strategy and quotas](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). > > The deployment strategy is configured in `Spec.Strategy`: > > * `Spec.Strategy.MaxUnavailable.Percent`, `Spec.Strategy.MaxUnavailable.Count`: Maximum number of nodes in a group that can be unavailable at any time during an update, set as a percentage of the group's target size or a number of nodes. When a percentage is used, the number of nodes is calculated by rounding down. > > > For example, if `Spec.Strategy.MaxUnavailable.Percent` is 40 and the group's target size is 3, at most ⌊3 × 40%⌋ = ⌊1.2⌋ = 1 node can be unavailable at any time during the update. > > The default value is 1. Cannot be set to 0 if `Spec.Strategy.MaxSurge.Count` or `Spec.Strategy.MaxSurge.Percent` is set to 0. > > * `Spec.Strategy.MaxSurge.Percent`, `Spec.Strategy.MaxSurge.Count`: Maximum number of nodes in a group that can exceed the group's target size at any time during an update, set as a percentage of the target size or as a number of nodes. > > > For example, if `Spec.Strategy.MaxSurge.Count` is 2 and the group's target size is 3, then the group can have up to 3 + 2 = 5 nodes at any time during the update. > > The default value is 0. Cannot be set to 0 if `Spec.Strategy.MaxUnavailable.Count` or `Spec.Strategy.MaxUnavailable.Percent` is set to 0. > > * `Spec.Strategy.DrainTimeout`: Maximum amount of time it can take to drain a node during the update. If the timeout is set, a node in the updated group is deleted when it reaches the timeout, even if its draining is not complete. > > > [!WARNING] > > > > The default timeout is 10 minutes. If draining isn't completed within this time frame, Managed Kubernetes applies the force drain and deletes the node. > [tab] Python SDK > > The `CreateNodeGroupRequest` and `UpdateNodeGroupRequest` classes support the following parameters. > > * **Metadata** > > * `metadata.parent_id`: Cluster ID. > * `metadata.name`: Node group name. Must be unique within the tenant. Cannot be changed after creation. > * **Kubernetes version on nodes** > > * `spec.version`: Kubernetes version in `.` format. Recommended version is 1.36. For more information, see [Kubernetes versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * **Node group size** > > * `spec.fixed_node_count`: Number of nodes per group. The maximum is 100. Cannot be set together with `spec.autoscaling`. > * `spec.autoscaling.min_node_count`, `spec.autoscaling.max_node_count`: Allow you to set the range of nodes within which the [cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) adds or removes nodes as needed. Cannot be set together with `spec.fixed_node_count`. > * **Node template** > > All nodes in a group are identical and are created based on a *node template*. A node template is similar to a virtual machine specification in Compute. > > The node template is configured in `spec.template` and supports the following parameters: > > * `spec.template.taints`: Array of Kubernetes [taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) (rules that repel Pods from nodes) for all nodes in the group. > > * `spec.template.resources.platform`: Platform with GPUs, see [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md). > > * `spec.template.resources.preset`: Compatible preset (number of GPUs and vCPUs, RAM size), see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `spec.template.gpu_settings.drivers_preset`: GPU drivers preset, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-python-sdk). > > * `spec.template.gpu_settings.dra` (optional): Enables Dynamic Resource Allocation for the node group. See [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#how-to-enable-dra-on-a-node-group-python-sdk). > > * `spec.template.gpu_cluster.id`: GPU cluster ID. > > * `spec.template.service_account_id`: Service account ID. You can add a service account, for example, to [pull images from Container Registry](https://docs.nebius.com/kubernetes/workloads/images-container-registry.md). > > * `spec.template.network_interfaces`: Network interface configuration (for example, subnet ID, see [How to use a non-default subnet for Managed Service for Kubernetes® clusters and node groups](https://docs.nebius.com/kubernetes/networking/non-default-subnet.md)). > > * `spec.template.filesystems`: Filesystem for nodes, see [How to attach volumes to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms-python-sdk). > > > [!WARNING] > > > > The filesystem that you are adding to a node group must be located in the same project as the node group's parent cluster. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). > > * `spec.template.local_disks.passthrough_group.requested`: Requests [local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) when set to `true`. You can configure how the local SSD disks are added to your node group with one of the following parameters: > > * `spec.template.local_disks.config.kubelet_ephemeral`: Set to `true` to use the requested local SSD disks as the node's [local ephemeral storage](https://kubernetes.io/docs/concepts/storage/ephemeral-storage/). Managed Kubernetes prepares, formats and mounts the resulting storage for node ephemeral data. This is the default configuration mode. > > * `spec.template.local_disks.config.none`: Set to `true` to provision the requested local SSD disks with no configuration. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `spec.template.reservation_policy.policy`: Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/kubernetes/node-groups/reservations.md) and run your node group based on them. As a result, the node group resources are reserved and always available. > > * `spec.template.reservation_policy.reservation_ids`: IDs of specific reservations. These are capacity block groups that a Nebius manager has created. > > For information about how to configure `spec.template.reservation_policy.policy` and `spec.template.reservation_policy.reservation_ids`, see [How to add reservations to node groups](https://docs.nebius.com/kubernetes/node-groups/reservations.md#how-to-add-reservations-to-node-groups-python-sdk). > * **Deployment strategy** > > The *deployment strategy* of a node group defines how it is updated when necessary — for example, when you modify the group's node template or Kubernetes version, or when nodes fail and need to be replaced. For more details, see [Deployment strategy and quotas](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). > > The deployment strategy is configured in `spec.strategy`: > > * `spec.strategy.max_unavailable.percent`, `spec.strategy.max_unavailable.count`: Maximum number of nodes in a group that can be unavailable at any time during an update, set as a percentage of the group's target size or a number of nodes. When a percentage is used, the number of nodes is calculated by rounding down. > > > For example, if `spec.strategy.max_unavailable.percent` is 40 and the group's target size is 3, at most ⌊3 × 40%⌋ = ⌊1.2⌋ = 1 node can be unavailable at any time during the update. > > The default value is 1. Cannot be set to 0 if `spec.strategy.max_surge.count` or `spec.strategy.max_surge.percent` is set to 0. > > * `spec.strategy.max_surge.percent`, `spec.strategy.max_surge.count`: Maximum number of nodes in a group that can exceed the group's target size at any time during an update, set as a percentage of the target size or as a number of nodes. > > > For example, if `spec.strategy.max_surge.count` is 2 and the group's target size is 3, then the group can have up to 3 + 2 = 5 nodes at any time during the update. > > The default value is 0. Cannot be set to 0 if `spec.strategy.max_unavailable.count` or `spec.strategy.max_unavailable.percent` is set to 0. > > * `spec.strategy.drain_timeout`: Maximum amount of time it can take to drain a node during the update. If the timeout is set, a node in the updated group is deleted when it reaches the timeout, even if its draining is not complete. > > > [!WARNING] > > > > The default timeout is 10 minutes. If draining isn't completed within this time frame, Managed Kubernetes applies the force drain and deletes the node. > [tab] JavaScript SDK > > The `CreateNodeGroupRequest` and `UpdateNodeGroupRequest` messages support the following parameters. > > Parameters that the API defines as `oneof` fields are set through a `$case` object. For example, `spec.size` with a fixed node count is `size: { $case: "fixedNodeCount", fixedNodeCount: 3 }`, and `spec.template.resources.size` with a preset is `size: { $case: "preset", preset: "" }`. The paths below are given in their flattened form; the code samples on this page show the `$case` objects in place. > > * **Metadata** > > * `metadata.parentId`: Cluster ID. > * `metadata.name`: Node group name. Must be unique within the tenant. Cannot be changed after creation. > * **Kubernetes version on nodes** > > * `spec.version`: Kubernetes version in `.` format. Recommended version is 1.36. For more information, see [Kubernetes versions in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/versions.md). > * **Node group size** > > * `spec.size.fixedNodeCount`: Number of nodes per group. The maximum is 100. Cannot be set together with `spec.size.autoscaling`. > * `spec.size.autoscaling.minNodeCount`, `spec.size.autoscaling.maxNodeCount`: Allow you to set the range of nodes within which the [cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) adds or removes nodes as needed. Cannot be set together with `spec.size.fixedNodeCount`. > * **Node template** > > All nodes in a group are identical and are created based on a *node template*. A node template is similar to a virtual machine specification in Compute. > > The node template is configured in `spec.template` and supports the following parameters: > > * `spec.template.taints`: Array of Kubernetes [taints](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) (rules that repel Pods from nodes) for all nodes in the group. > > * `spec.template.resources.platform`: Platform with GPUs, see [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md). > > * `spec.template.resources.size.preset`: Compatible preset (number of GPUs and vCPUs, RAM size), see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md). > > * `spec.template.gpuSettings.driversPreset`: GPU drivers preset, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-javascript-sdk). > > * `spec.template.gpuSettings.dra` (optional): Enables dynamic resource allocation for the node group. See [Dynamic resource allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#how-to-enable-dra-on-a-node-group-javascript-sdk). > > * `spec.template.gpuCluster.id`: GPU cluster ID. > > * `spec.template.serviceAccountId`: Service account ID. You can add a service account, for example, to [pull images from Container Registry](https://docs.nebius.com/kubernetes/workloads/images-container-registry.md). > > * `spec.template.networkInterfaces`: Network interface configuration (for example, subnet ID, see [How to use a non-default subnet for Managed Service for Kubernetes® clusters and node groups](https://docs.nebius.com/kubernetes/networking/non-default-subnet.md)). > > * `spec.template.filesystems`: Filesystem for nodes, see [How to attach volumes to VMs](https://docs.nebius.com/compute/storage/use.md#how-to-attach-volumes-to-vms-javascript-sdk). > > > [!WARNING] > > > > The filesystem that you are adding to a node group must be located in the same project as the node group's parent cluster. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). > > * `spec.template.localDisks.passthroughGroup.requested`: Requests [local SSD disks](https://docs.nebius.com/compute/storage/types.md#local-ssd-disks) when set to `true`. You can configure how the local SSD disks are added to your node group with one of the following parameters: > > * `spec.template.localDisks.config.kubeletEphemeral`: Set to `true` to use the requested local SSD disks as the node's [local ephemeral storage](https://kubernetes.io/docs/concepts/storage/ephemeral-storage/). Managed Kubernetes prepares, formats and mounts the resulting storage for node ephemeral data. This is the default configuration mode. > > * `spec.template.localDisks.config.none`: Set to `true` to provision the requested local SSD disks with no configuration. > > > [!NOTE] > > > > Local SSD disks are available only for supported platforms and presets. For details, see [Availability](https://docs.nebius.com/compute/storage/local-disks.md#availability). > > * `spec.template.reservationPolicy.policy`: Policy for reservation usage. You can use [reservations of capacity resources](https://docs.nebius.com/kubernetes/node-groups/reservations.md) and run your node group based on them. As a result, the node group resources are reserved and always available. > > * `spec.template.reservationPolicy.reservationIds`: IDs of specific reservations. These are capacity block groups that a Nebius manager has created. > > For information about how to configure `spec.template.reservationPolicy.policy` and `spec.template.reservationPolicy.reservationIds`, see [How to add reservations to node groups](https://docs.nebius.com/kubernetes/node-groups/reservations.md#how-to-add-reservations-to-node-groups-javascript-sdk). > * **Deployment strategy** > > The *deployment strategy* of a node group defines how it is updated when necessary — for example, when you modify the group's node template or Kubernetes version, or when nodes fail and need to be replaced. For more details, see [Deployment strategy and quotas](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). > > The deployment strategy is configured in `spec.strategy`: > > * `spec.strategy.maxUnavailable.percent`, `spec.strategy.maxUnavailable.count`: Maximum number of nodes in a group that can be unavailable at any time during an update, set as a percentage of the group's target size or a number of nodes. When a percentage is used, the number of nodes is calculated by rounding down. > > > For example, if `spec.strategy.maxUnavailable.percent` is 40 and the group's target size is 3, at most ⌊3 × 40%⌋ = ⌊1.2⌋ = 1 node can be unavailable at any time during the update. > > The default value is 1. Cannot be set to 0 if `spec.strategy.maxSurge.count` or `spec.strategy.maxSurge.percent` is set to 0. > > * `spec.strategy.maxSurge.percent`, `spec.strategy.maxSurge.count`: Maximum number of nodes in a group that can exceed the group's target size at any time during an update, set as a percentage of the target size or as a number of nodes. > > > For example, if `spec.strategy.maxSurge.count` is 2 and the group's target size is 3, then the group can have up to 3 + 2 = 5 nodes at any time during the update. > > The default value is 0. Cannot be set to 0 if `spec.strategy.maxUnavailable.count` or `spec.strategy.maxUnavailable.percent` is set to 0. > > * `spec.strategy.drainTimeout`: Maximum amount of time it can take to drain a node during the update. If the timeout is set, a node in the updated group is deleted when it reaches the timeout, even if its draining is not complete. > > > [!WARNING] > > > > The default timeout is 10 minutes. If draining isn't completed within this time frame, Managed Kubernetes applies the force drain and deletes the node. ## How to delete node groups > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > 2. Open the cluster page and then go to the **Node groups** tab. > 3. Open the page of the node group that you want to remove. > 4. Switch to the **Settings** tab. > 5. Click **Delete node group**. > 6. Confirm the deletion. > [tab] CLI > > To delete a node group, get its ID as shown in [How to modify node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups-cli) and run the following command: > > ```bash > nebius mk8s node-group delete --id $K8S_NODE_GROUP_ID > ``` > [tab] Terraform > > 1. Remove the corresponding `nebius_mk8s_v1_node_group` resource from the node group configuration file. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > To delete a node group, get its ID as shown in [How to modify node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups-go-sdk) and delete the group by this ID: > > ```go > deleteFileGroupOp, err := sdk.Services().MK8S().V1(). > NodeGroup().Delete( > ctx, > &mk8s.DeleteNodeGroupRequest{Id: nodeGroupID}, > ) > if err != nil { > return err > } > if _, err = deleteFileGroupOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > To delete a node group, get its ID as shown in [How to modify node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups-python-sdk) and delete the group by this ID: > > ```python > delete_file_group_service = NodeGroupServiceClient(sdk) > delete_file_group_operation = await delete_file_group_service.delete( > DeleteNodeGroupRequest(id=node_group_id), > ) > await delete_file_group_operation.wait() > ``` > [tab] JavaScript SDK > > To delete a node group, get its ID as shown in [How to modify node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups-javascript-sdk) and delete the group by this ID: > > ```ts > const deleteFileGroupService = new NodeGroupService(sdk); > const deleteFileGroupOperation = await deleteFileGroupService.delete( > DeleteNodeGroupRequest.create({ > id: nodeGroupId, > }), > ).result; > await deleteFileGroupOperation.wait(); > ``` ## Examples > [tab] CLI > > * Creating a node group with two nodes, each with 8 NVIDIA H100 GPUs, 128 vCPUs, 1600 GiB of RAM, a 100 GiB Network SSD disk and the Kubernetes version 1.36: > > ```bash > export SUBNET_ID=$(nebius vpc subnet list \ > --format jsonpath='{.items[0].metadata.id}') > nebius mk8s node-group create \ > --parent-id $K8S_CLUSTER_ID \ > --name node-group-example \ > --version 1.36 \ > --fixed-node-count 2 \ > --template-resources-platform gpu-h100-sxm \ > --template-resources-preset 8gpu-128vcpu-1600gb \ > --template-gpu-settings-drivers-preset cuda13.0 \ > --template-boot-disk-type NETWORK_SSD \ > --template-boot-disk-size-gibibytes 100 \ > --template-network-interfaces "[{\"subnet_id\": \"$SUBNET_ID\"}]" > ``` > > * Modifying the node group from the previous example (ID `$K8S_NODE_GROUP_ID`) to add a node and enable public IP addresses for all nodes: > > ```bash > nebius mk8s node-group update \ > --id $K8S_NODE_GROUP_ID \ > --auto-approve \ > --fixed-node-count 3 \ > --template-network-interfaces "[{\"subnet_id\": \"$SUBNET_ID\", \"public_ip_address\": {}}]" > ``` > [tab] Terraform > > Creating a node group with two nodes, each with 8 NVIDIA H100 GPUs, 128 vCPUs, 1600 GiB of RAM, a 100 GiB Network SSD disk and the Kubernetes version 1.36: > > ```hcl > resource "nebius_mk8s_v1_node_group" "node-group-example" { > name = "node-group-example" > parent_id = $K8S_CLUSTER_ID > version = "1.36" > fixed_node_count = 2 > > template = { > resources = { > platform = "gpu-h100-sxm" > preset = "8gpu-128vcpu-1600gb" > } > > gpu_settings = { > drivers_preset = "cuda12.8" > } > > boot_disk = { > type = "NETWORK_SSD" > size_gibibytes = 100 > } > } > } > ``` > [tab] Go SDK > > * Creating a node group with two nodes, each with 8 NVIDIA H100 GPUs, 128 vCPUs, 1600 GiB of RAM, a 100 GiB Network SSD disk and the Kubernetes version 1.36: > > ```go > subnetGroupOp, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: k8sClusterID, > Name: "node-group-example", > }, > Spec: &mk8s.NodeGroupSpec{ > Version: "1.36", > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "8gpu-128vcpu-1600gb", > }, > }, > GpuSettings: &mk8s.GpuSettings{ > DriversPreset: "cuda13.0", > }, > BootDisk: &mk8s.DiskSpec{ > Size: &mk8s.DiskSpec_SizeGibibytes{ > SizeGibibytes: 100, > }, > Type: mk8s.DiskSpec_NETWORK_SSD, > }, > NetworkInterfaces: > []*mk8s.NetworkInterfaceTemplate{ > {SubnetId: subnetID}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = subnetGroupOp.Wait(ctx); err != nil { > return err > } > ``` > > `SubnetId` reads the `subnetID` variable. Assign the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) to it before you run the code. > > * Modifying the node group from the previous example (ID `nodeGroupID`) to add a node and enable public IP addresses for all nodes: > > ```go > groupForNetwork, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{Id: nodeGroupID}, > ) > if err != nil { > return err > } > groupNetworkSpec := groupForNetwork.GetSpec() > if groupNetworkSpec == nil || groupNetworkSpec.GetTemplate() == nil { > return errors.New("node group template is missing") > } > groupNetworkSpec.Size = &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 3, > } > groupNetworkSpec.GetTemplate().NetworkInterfaces = > []*mk8s.NetworkInterfaceTemplate{ > { > SubnetId: subnetID, > PublicIpAddress: &mk8s.PublicIPAddress{}, > }, > } > updateNetworkOp, err := sdk.Services().MK8S().V1().NodeGroup(). > Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: groupForNetwork.GetMetadata(), > Spec: groupNetworkSpec, > }, > ) > if err != nil { > return err > } > if _, err = updateNetworkOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > * Creating a node group with two nodes, each with 8 NVIDIA H100 GPUs, 128 vCPUs, 1600 GiB of RAM, a 100 GiB Network SSD disk and the Kubernetes version 1.36: > > ```python > subnet_group_service = NodeGroupServiceClient(sdk) > subnet_group_operation = await subnet_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=k8s_cluster_id, > name="node-group-example", > ), > spec=NodeGroupSpec( > version="1.36", > fixed_node_count=2, > template=NodeTemplate( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="8gpu-128vcpu-1600gb", > ), > gpu_settings=GpuSettings(drivers_preset="cuda13.0"), > boot_disk=DiskSpec( > size_gibibytes=100, > type=DiskSpec__DiskType.NETWORK_SSD, > ), > network_interfaces=[ > NetworkInterfaceTemplate(subnet_id=subnet_id), > ], > ), > ), > ), > ) > await subnet_group_operation.wait() > ``` > > `subnet_id` reads the `subnet_id` variable. Assign the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) to it before you run the code. > > * Modifying the node group from the previous example (ID `node_group_id`) to add a node and enable public IP addresses for all nodes: > > ```python > network_group_service = NodeGroupServiceClient(sdk) > group_for_network = await network_group_service.get( > GetNodeGroupRequest(id=node_group_id), > ) > if ( > group_for_network.spec is None > or group_for_network.spec.template is None > ): > raise ValueError("node group template is missing") > group_for_network.spec.fixed_node_count = 3 > group_for_network.spec.template.network_interfaces = [ > NetworkInterfaceTemplate( > subnet_id=subnet_id, > public_ip_address=PublicIPAddress(), > ), > ] > update_network_operation = await network_group_service.update( > UpdateNodeGroupRequest( > metadata=group_for_network.metadata, > spec=group_for_network.spec, > ), > ) > await update_network_operation.wait() > ``` > [tab] JavaScript SDK > > * Creating a node group with two nodes, each with 8 NVIDIA H100 GPUs, 128 vCPUs, 1600 GiB of RAM, a 100 GiB Network SSD disk and the Kubernetes version 1.36: > > ```ts > const subnetGroupService = new NodeGroupService(sdk); > const subnetGroupOperation = await subnetGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: k8sClusterId, > name: "node-group-example", > }), > spec: NodeGroupSpec.create({ > version: "1.36", > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "8gpu-128vcpu-1600gb", > }, > }), > gpuSettings: GpuSettings.create({ > driversPreset: "cuda13.0", > }), > bootDisk: DiskSpec.create({ > size: { > $case: "sizeGibibytes", > sizeGibibytes: 100, > }, > type: DiskSpec_DiskType.NETWORK_SSD, > }), > networkInterfaces: [ > NetworkInterfaceTemplate.create({ > subnetId: subnetId, > }), > ], > }), > }), > }), > ).result; > await subnetGroupOperation.wait(); > ``` > > `subnetId` reads the `subnetId` variable. Assign the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) to it before you run the code. > > * Modifying the node group from the previous example (ID `nodeGroupId`) to add a node and enable public IP addresses for all nodes: > > ```ts > const networkGroupService = new NodeGroupService(sdk); > const groupForNetwork = await networkGroupService.get( > GetNodeGroupRequest.create({ > id: nodeGroupId, > }), > ); > if (!groupForNetwork.spec?.template) { > throw new Error("node group template is missing"); > } > groupForNetwork.spec.size = { > $case: "fixedNodeCount", > fixedNodeCount: 3, > }; > groupForNetwork.spec.template.networkInterfaces = [ > NetworkInterfaceTemplate.create({ > subnetId: subnetId, > publicIpAddress: PublicIPAddress.create({}), > }), > ]; > const updateNetworkOperation = await networkGroupService.update( > UpdateNodeGroupRequest.create({ > metadata: groupForNetwork.metadata, > spec: groupForNetwork.spec, > }), > ).result; > await updateNetworkOperation.wait(); > ``` *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # kubeReserved values on worker nodes in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/node-groups/kube-reserved.md In Managed Service for Kubernetes, the kubelet sets `kubeReserved` values on worker nodes to reserve resources for Kubernetes system components. This article describes the default values and how the `memory` reservation is calculated. ## Default values By default, worker nodes use the following `kubeReserved` values: * `cpu`: `100m` * `ephemeral-storage`: `1Gi` * `memory`: `512Mi` However, for worker nodes with GPUs, Managed Kubernetes calculates the `memory` reservation value from the size of RAM you select for the node. This helps account for a known Kubernetes issue where the kubelet may not observe `MemoryPressure` right away. For more information, see [Node-pressure Eviction](https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#known-issues) in the official Kubernetes documentation. The calculation uses the following tiered approach: * `255Mi` for nodes with less than 1 GiB of RAM * `25%` of the first 4 GiB * `20%` of the next 4 GiB (up to 8 GiB) * `10%` of the next 8 GiB (up to 16 GiB) * `6%` of the next 112 GiB (up to 128 GiB) * `2%` of RAM above 128 GiB * Plus `100Mi` on every node to handle Pod eviction ## Examples The following table shows the resulting `memory` value in `kubeReserved` for the selected RAM size in your GPU nodes: | Node RAM | `kubeReserved.memory` | | - | - | | 8 GiB | `1944Mi` | | 16 GiB | `2763Mi` | | 128 GiB | `9644Mi` | | 256 GiB | `12266Mi` | ## See also * [Node groups](https://docs.nebius.com/kubernetes/components.md#node-group) * [Creating and modifying node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md) # Capacity reservations for Managed Service for Kubernetes® node groups Source: https://docs.nebius.com/kubernetes/node-groups/reservations.md To make sure that GPU capacity is always available for your nodes (virtual machines, VMs), you can reserve GPUs. A *reservation* represents a [capacity block group](https://docs.nebius.com/overview/limits/capacity-block-groups.md), and it reserves a specific number of GPUs that are allocated to your infrastructure. GPUs from a reservation remain available, even if a VM is stopped. Without reservations, GPU capacity is taken from a shared pool and returned when a VM is stopped (for example, by you or a [maintenance event](https://docs.nebius.com/kubernetes/maintenance/index.md)). To start using reservations, send a request to your Nebius manager. In this request, specify how many GPUs you would like to reserve and for what period. If you are not in contact with a Nebius manager, you can ask [technical support](https://console.nebius.com/support/create-ticket) to connect you with one. After reservations are ready, you can add them to your existing node groups or create new ones with reservations. You can also check your capacity block groups on the **Limits** page and get detailed information about them. For more information, see [List of capacity block groups](https://docs.nebius.com/overview/limits/capacity-block-groups.md#list-of-capacity-block-groups). > [!NOTE] > > GPUs allocated from reservations do not count towards [quotas on the number of GPUs](https://docs.nebius.com/compute/resources/quotas-limits.md#gpu-virtual-machines). ## How to add reservations to node groups Node groups of a regular type with GPUs support reservations. [Preemptible node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#preemptible-node-groups) and node groups without GPUs do not support reservations. > [tab] Web console > > If you want to [create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#regular-node-groups-web-console), in the creation form, under **Computing resources**, select **With GPU** and a regular VM type. After that, specify the **Reservation usage** settings. > > If you want to modify an existing node group, go to its **Settings** tab on the node group page. Next, update the **Reservation usage** settings. > > The **Reservation usage** settings are only displayed if you have capacity block groups. > > Available **Reservation usage** options: > > * **With reservations**: Resources are allocated from reservations. > > In the **Reservation** section, you can configure the following options: > > * **Any (existing and future)** (default): Compute selects among your matching capacity block groups automatically. > * **Specific capacity block groups**: Select one or more capacity block groups. Each option shows the capacity block group ID, reservation period, and GPU usage. Make sure the selected groups have enough capacity and do not expire soon. > * **Switch to PAYG**: Choose whether the VM can start after you create or restart it without active intervals in selected capacity block groups: > > * **When reservation is exhausted** (default): The VM can start as a pay-as-you-go VM when no capacity is available in the selected capacity block groups. > * **Never**: The VM cannot start without available capacity in the selected capacity block groups. > > This does not affect the VM when it is running. If an interval in a selected capacity block group expires while the VM is running, the VM always continues as a pay-as-you-go VM, regardless of this setting. > > If you have capacity block groups in multiple regions, select a **Region** first. > > * **Without reservations**: Resources are allocated from the common pool, and no reservations are used for the node group. > [tab] CLI > > To configure reservations, use the `--template-reservation-policy-*` parameters when creating or updating a node group: > > * Create a node group: > > ```bash > nebius mk8s node-group create \ > ... \ > --template-reservation-policy-policy \ > --template-reservation-policy-reservation-ids > ``` > > * Update a node group: > > ```bash > nebius mk8s node-group update \ > --auto-approve \ > ... \ > --template-reservation-policy-policy \ > --template-reservation-policy-reservation-ids > ``` > > Description of the parameters: > > * `--template-reservation-policy-policy`: Policy for reservation usage. Supports the following values: > > * `auto`: Node group resources are allocated from reservations. If no reservations are currently available, the node group runs without them. In this case, resources for the node group are provided from the common pool. > > > [!NOTE] > > > > The `auto` value is default. If you don't have any reservations and you don't set the `--template-reservation-policy-policy` parameter, the `auto` value applies and the node group runs without reservations. > > * `forbid`: Node group resources are provided from the common pool, and no reservations are used. > > * `strict`: Node group resources are exclusively allocated from reservations. The node group doesn't run without the reservations. > * `--template-reservation-policy-reservation-ids` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation-ids` | **Behavior** | > | - | - | - | > | `auto` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, resources for all nodes in the node group are provided from the common pool, not from a reservation.If a reservation doesn't have enough capacity for the whole node group, it uses all the resources available in this reservation and also takes resources from the common pool. In other words, resources for some nodes are provided from the reservation, and resources for the rest of the nodes are provided from the common pool. | > | `auto` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), the same logic of the `auto` policy applies. | > | `forbid` | Not specified | Node group resources are provided from the common pool. No reservations are used. | > | `forbid` | Specified | Not supported. Applying this combination results in a validation error. | > | `strict` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, a request for creating or updating a node group fails. | > | `strict` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit, a request for creating or updating a node group fails. | > [tab] Terraform > > To configure reservations in the node group, use the `reservation_policy` parameter of the node template: > > ```hcl > resource "nebius_mk8s_v1_node_group" "my_node_group" { > ... > template = { > ... > reservation_policy = { > policy = "" > reservation_ids = "" > } > } > ... > } > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the following values: > > * `AUTO`: Node group resources are allocated from reservations. If no reservations are currently available, the node group runs without them. In this case, resources for the node group are provided from the common pool. > > > [!NOTE] > > > > The `AUTO` value is default. If you don't have any reservations and you don't set the `policy` parameter, the `AUTO` value applies and the node group runs without reservations. > > * `FORBID`: Node group resources are provided from the common pool, and no reservations are used. > > * `STRICT`: Node group resources are exclusively allocated from reservations. The node group doesn't run without the reservations. > * `reservation_ids`: IDs of specific reservations (capacity block groups). You can use this parameter with the `AUTO` and `STRICT` reservation usages: > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation_ids` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, resources for all nodes in the node group are provided from the common pool, not from a reservation.If a reservation doesn't have enough capacity for the whole node group, it uses all the resources available in this reservation and also takes resources from the common pool. In other words, resources for some nodes are provided from the reservation, and resources for the rest of the nodes are provided from the common pool. | > | `AUTO` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), the same logic of the `AUTO` policy applies. | > | `FORBID` | Not specified | Node group resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. Applying this combination results in a validation error. | > | `STRICT` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, a request for creating or updating a node group fails. | > | `STRICT` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit, a request for creating or updating a node group fails. | > [tab] Go SDK > > Use `ReservationPolicy` in `NodeTemplate` when creating or updating a node group: > > * Create a node group: > > ```go > createReservationPolicy := &mk8s.ReservationPolicy{ > Policy: mk8s.ReservationPolicy_STRICT, > ReservationIds: []string{ > "", > }, > } > createGroupOp, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "", > }, > }, > ReservationPolicy: createReservationPolicy, > }, > }, > }, > ) > if err != nil { > return fmt.Errorf("create node group: %w", err) > } > if _, err = createGroupOp.Wait(ctx); err != nil { > return fmt.Errorf("wait for node group creation: %w", err) > } > ``` > > * Update a node group: > > ```go > updateReservationPolicy := &mk8s.ReservationPolicy{ > Policy: mk8s.ReservationPolicy_STRICT, > ReservationIds: []string{ > "", > }, > } > groupForPolicy, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("get node group: %w", err) > } > spec := groupForPolicy.GetSpec() > if spec == nil { > return fmt.Errorf("node group spec is missing") > } > template := spec.GetTemplate() > if template == nil { > return fmt.Errorf("node group template is missing") > } > template.ReservationPolicy = updateReservationPolicy > updatePolicyOp, err := sdk.Services().MK8S().V1().NodeGroup(). > Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: groupForPolicy.GetMetadata(), > Spec: groupForPolicy.GetSpec(), > }, > ) > if err != nil { > return fmt.Errorf( > "update node group reservation policy: %w", err, > ) > } > if _, err = updatePolicyOp.Wait(ctx); err != nil { > return fmt.Errorf("wait for node group update: %w", err) > } > ``` > > Description of the parameters: > > * `Policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `ReservationIds` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `Policy` | `ReservationIds` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, resources for all nodes in the node group are provided from the common pool, not from a reservation.If a reservation doesn't have enough capacity for the whole node group, it uses all the resources available in this reservation and also takes resources from the common pool. In other words, resources for some nodes are provided from the reservation, and resources for the rest of the nodes are provided from the common pool. | > | `AUTO` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), the same logic of the `AUTO` policy applies. | > | `FORBID` | Not specified | Node group resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. Applying this combination results in a validation error. | > | `STRICT` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, a request for creating or updating a node group fails. | > | `STRICT` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit, a request for creating or updating a node group fails. | > [tab] Python SDK > > Use `reservation_policy` in `NodeTemplate` when creating or updating a node group: > > * Create a node group: > > ```python > create_reservation_policy = ReservationPolicy( > policy=ReservationPolicy.Policy.STRICT, > reservation_ids=[""], > ) > create_group_service = NodeGroupServiceClient(sdk) > create_group_operation = await create_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=NodeGroupSpec( > fixed_node_count=2, > template=NodeTemplate( > resources=ResourcesSpec( > platform="", > preset="", > ), > reservation_policy=create_reservation_policy, > ), > ), > ), > ) > await create_group_operation.wait() > ``` > > * Update a node group: > > ```python > update_reservation_policy = ReservationPolicy( > policy=ReservationPolicy.Policy.STRICT, > reservation_ids=[""], > ) > policy_group_service = NodeGroupServiceClient(sdk) > group_for_policy = await policy_group_service.get( > GetNodeGroupRequest(id=""), > ) > group_for_policy.spec.template.reservation_policy = ( > update_reservation_policy > ) > policy_operation = await policy_group_service.update( > UpdateNodeGroupRequest( > metadata=group_for_policy.metadata, > spec=group_for_policy.spec, > ), > ) > await policy_operation.wait() > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `reservation_ids` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservation_ids` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, resources for all nodes in the node group are provided from the common pool, not from a reservation.If a reservation doesn't have enough capacity for the whole node group, it uses all the resources available in this reservation and also takes resources from the common pool. In other words, resources for some nodes are provided from the reservation, and resources for the rest of the nodes are provided from the common pool. | > | `AUTO` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), the same logic of the `AUTO` policy applies. | > | `FORBID` | Not specified | Node group resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. Applying this combination results in a validation error. | > | `STRICT` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, a request for creating or updating a node group fails. | > | `STRICT` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit, a request for creating or updating a node group fails. | > [tab] JavaScript SDK > > Use `reservationPolicy` in `NodeTemplate` when creating or updating a node group: > > * Create a node group: > > ```ts > const createReservationPolicy = ReservationPolicy.create({ > policy: ReservationPolicy_Policy.STRICT, > reservationIds: [""], > }); > const createGroupService = new NodeGroupService(sdk); > const createGroupOperation = await createGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > reservationPolicy: createReservationPolicy, > }), > }), > }), > ).result; > await createGroupOperation.wait(); > ``` > > * Update a node group: > > ```ts > const updateReservationPolicy = ReservationPolicy.create({ > policy: ReservationPolicy_Policy.STRICT, > reservationIds: [""], > }); > const policyGroupService = new NodeGroupService(sdk); > const groupForPolicy = await policyGroupService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!groupForPolicy.spec?.template) { > throw new Error("node group template is missing"); > } > groupForPolicy.spec.template.reservationPolicy = > updateReservationPolicy; > const policyOperation = await policyGroupService.update( > UpdateNodeGroupRequest.create({ > metadata: groupForPolicy.metadata, > spec: groupForPolicy.spec, > }), > ).result; > await policyOperation.wait(); > ``` > > Description of the parameters: > > * `policy`: Policy for reservation usage. Supports the `AUTO`, `FORBID` and `STRICT` values. > * `reservationIds` (optional): IDs of specific reservations (capacity block groups). Use this parameter only if you need specific reservations. > > Specify the IDs in the order in which reservations should apply. For instance, resources should be allocated from the first specified reservation. When it is exhausted or expired, the service uses resources from the second specified reservation, and so on. > > Make sure to select reservations that have enough capacity and that do not expire in several days. > > To find out how different combinations of parameter values impact the result, see the table below: > > | `policy` | `reservationIds` | **Behavior** | > | - | - | - | > | `AUTO` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, resources for all nodes in the node group are provided from the common pool, not from a reservation.If a reservation doesn't have enough capacity for the whole node group, it uses all the resources available in this reservation and also takes resources from the common pool. In other words, resources for some nodes are provided from the reservation, and resources for the rest of the nodes are provided from the common pool. | > | `AUTO` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit (for example, they are not currently active or there are not enough GPUs), the same logic of the `AUTO` policy applies. | > | `FORBID` | Not specified | Node group resources are provided from the common pool. No reservations are used. | > | `FORBID` | Specified | Not supported. Applying this combination results in a validation error. | > | `STRICT` | Not specified | Managed Kubernetes tries to launch a node group in any available and suitable reservation. If none is found, a request for creating or updating a node group fails. | > | `STRICT` | Specified | Managed Kubernetes tries to launch a node group in one of the specified reservations. If none of them fit, a request for creating or updating a node group fails. | ## What's next To find information about reservations, check the pages of your VMs (nodes). The VM page and the list of VMs show what reservation policy you have configured and what reservations currently apply. For more information, see [How to find information about reservations for an already configured VM](https://docs.nebius.com/compute/virtual-machines/reservations.md#how-to-find-information-about-reservations-for-an-already-configured-vm). For details about how billing works when you use reservations, see [Billing for reservations](https://docs.nebius.com/compute/virtual-machines/reservations.md#billing-for-reservations). ## See also * [Capacity block groups in Nebius AI Cloud](https://docs.nebius.com/overview/limits/capacity-block-groups.md) * [Capacity reservations for Compute virtual machines](https://docs.nebius.com/compute/virtual-machines/reservations.md) # Maintenance in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/maintenance/index.md The goal of the Managed Service for Kubernetes maintenance is to terminate a node as gracefully as possible. When a node termination is required, Nebius AI Cloud issues a maintenance event. Maintenance events are triggered when software or hardware fails on the physical machines that host your nodes, or when Nebius AI Cloud runs planned maintenance. Software and hardware failures account for the vast majority of maintenance events. Managed Kubernetes listens to maintenance events that underlying services launch. In particular, as every Kubernetes node represents a Compute virtual machine, Managed Kubernetes tracks [Compute maintenance events](https://docs.nebius.com/compute/virtual-machines/maintenance.md). ## How maintenance occurs 1. Nebius AI Cloud issues a maintenance event. When the event is issued, Managed Kubernetes assigns the `NebiusMaintenanceScheduled` [Kubernetes condition](https://kubernetes.io/docs/reference/node/node-status/#condition). You can [check the list of conditions](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-check-that-a-maintenance-event-is-issued) to make sure that the service has issued the event. 2. The Managed Kubernetes service detects an event on a node. The service groups nodes into batches within a given node group. If a lot of maintenance events are expected in a Managed Kubernetes cluster, batches allow you to avoid stopping all nodes at once. The batch size equals either `1` or the value of the [maximum unavailable deployment strategy parameter](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters) if that value is greater than `1`. You can check the node group specifications: > [tab] CLI > > ```bash > nebius mk8s node-group get --id > ``` > [tab] Go SDK > > ```go > nodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(nodeGroup) > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > print(node_group) > ``` > [tab] JavaScript SDK > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroup = await nodeGroupService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > console.log(nodeGroup); > ``` 3. To stop scheduling new Pods, Managed Kubernetes cordons the node. 4. The service waits for running GPU Pods and [labeled CPU Pods](https://docs.nebius.com/kubernetes/maintenance/index.md#postponing-node-drain) to finish. If any of these Pods are still running one hour before the SLA deadline, the service stops waiting. The *SLA deadline* is the latest time the maintenance event should take place. You can check the SLA deadline [together with Kubernetes conditions](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-check-that-a-maintenance-event-is-issued). 5. To remove existing Pods, Managed Kubernetes drains the node. The drain takes up to one hour. 6. Nebius AI Cloud stops the Compute VM (that is, the node). 7. Nebius AI Cloud starts the VM. 8. Managed Kubernetes uncordons the node and enables scheduling new Pods. 9. Managed Kubernetes removes the `NebiusMaintenanceScheduled` condition from the node. After that, the node is considered to be healthy. Workloads can run on this node again. ## Manual launch of maintenance The service runs maintenance automatically. However, you can launch it manually as well if a maintenance event is issued for your node. For more information, see [How to launch maintenance manually in Managed Kubernetes](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-launch-maintenance-manually-in-managed-kubernetes). ## Postponing node drain For GPU Pods, Managed Kubernetes waits until the Pods finish or until one hour before the SLA deadline, whichever happens first. Then, the service starts draining the node. For CPU Pods, Managed Kubernetes doesn't wait for the Pods to finish. If you want Managed Kubernetes to wait for your CPU Pods, assign the `nebius.com/defer-maintenance-node-drain: "true"` Kubernetes label to the CPU Pods. A continuously running Pod, such as a Pod managed by a DaemonSet, can't postpone the drain past the SLA deadline. For more information, see [How to postpone node drain for CPU Pods](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-postpone-node-drain-for-cpu-pods). # Managing maintenance in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/maintenance/manage.md [Maintenance in Managed Service for Kubernetes](https://docs.nebius.com/kubernetes/maintenance/index.md) is scheduled automatically when Nebius AI Cloud issues a maintenance event. However, you also have an option to [launch maintenance manually](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-launch-maintenance-manually-in-managed-kubernetes). You can only do that if a maintenance event is issued for a given node. You can [check the event](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-check-that-a-maintenance-event-is-issued) upfront, before you proceed with the manual maintenance launch. ## How to check that a maintenance event is issued 1. [Connect](https://docs.nebius.com/kubernetes/connect.md) to your Managed Kubernetes cluster. 2. Get the node ID: ```bash kubectl get nodes -o name ``` Output: ```text node/computeinstance-*** node/computeinstance-*** ... ``` The node ID is `computeinstance-***`. 3. Check that a maintenance event is issued and the time that it is scheduled for: ```bash kubectl describe node | grep -A 10 "Conditions:" ``` If the event is issued, the command shows the `NebiusMaintenanceScheduled` [Kubernetes condition](https://kubernetes.io/docs/reference/node/node-status/#condition). For example: ```text Conditions: Type Status LastHeartbeatTime LastTransitionTime Reason Message ---- ------ ----------------- ------------------ ------ ------- NebiusMaintenanceScheduled True Wed, 08 Aug 2025 14:28:31 +0200 Wed, 08 Aug 2025 14:28:31 +0200 MaintenanceScheduled Node scheduled for urgent maintenance, SLA deadline is 2025-08-13T12:26:00Z ... ``` In the `Message` column, the command shows the SLA deadline: the latest time the maintenance event should take place. ## How to launch maintenance manually in Managed Kubernetes 1. [Connect](https://docs.nebius.com/kubernetes/connect.md) to your Managed Kubernetes cluster. 2. [Make sure](https://docs.nebius.com/kubernetes/maintenance/manage.md#how-to-check-that-a-maintenance-event-is-issued) that a maintenance event is issued. 3. Change the maintenance event time: ```bash kubectl label node \ nebius.com/perform-maintenance= \ --overwrite ``` If you want to start the node drain and the maintenance as soon as possible, set the `true` value for the `nebius.com/perform-maintenance` Kubernetes label. Alternatively, you can set a specific time for the maintenance. For a specific time, make sure that the following conditions are met: * The time should not be in the past. If you set a time in the past, the `true` value applies instead, and the node drain starts as soon as possible. * The time should be at least five minutes earlier than the SLA deadline. Otherwise, the time is ignored, and the `true` value applies. Managed Kubernetes supports the following two formats for the time value: * Unix time in seconds, for example, `1262304000`. This format implies the UTC timezone by default. * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) modified for Kubernetes labels: * Use a full stop `.` as a separator, instead of a colon `:`. * Use the `_hh.mm` format to specify a UTC+N timezone (for example, `_02.00` for UTC+2). * Use the `-hh.mm` format to specify a UTC-N timezone (for example, `-03.00` for UTC-3). You may opt not to specify a timezone in the value. In this case, Managed Kubernetes uses the UTC timezone by default. Examples of RFC 3339 values: | **Time in a given timezone** | **Value** | **Time in UTC** | | - | - | - | | June 12, 2025, 8:05 UTC-2 | `2025-06-12T08.05.00-02.00` | June 12, 2025, 10:05 UTC, `2025-06-12T10.05.00` | | June 12, 2025, 8:05 UTC+2 | `2025-06-12T08.05.00_02.00` | June 12, 2025, 6:05 UTC, `2025-06-12T06.05.00` | ## How to postpone node drain for CPU Pods For CPU Pods, Managed Kubernetes doesn't wait for the Pods to finish before draining the node. If you want Managed Kubernetes to wait for your CPU Pods, assign the `nebius.com/defer-maintenance-node-drain: "true"` Kubernetes label to the Pods. For more information about how postponing node drain works, see [Postponing node drain](https://docs.nebius.com/kubernetes/maintenance/index.md#postponing-node-drain). To postpone the node drain for CPU Pods: 1. [Connect](https://docs.nebius.com/kubernetes/connect.md) to your Managed Kubernetes cluster. 2. Add the Kubernetes label to the Pods: * To add the label to new Pods when you're creating them, include the label in the configuration: ```yaml template: metadata: labels: app: nebius.com/defer-maintenance-node-drain: "true" ``` * To apply the label to existing Pods, run: ```bash kubectl label pods -l app= \ nebius.com/defer-maintenance-node-drain=true ``` `app=` is used to identify Pods. If they use a different identifying label, use that label in the selector. 3. Check that the label is assigned to the Pods: ```bash kubectl get pods -l app= \ -L nebius.com/defer-maintenance-node-drain ``` This command lists the Pods with `app=` and displays `true` for the `nebius.com/defer-maintenance-node-drain` Kubernetes label in an additional column. For example: ```text NAME READY STATUS RESTARTS AGE DEFER-MAINTENANCE-NODE-DRAIN test-pod 1/1 Running 0 2m17s true ``` If the label was not added successfully, the last column is empty. # Health checks and automatic recovery of Managed Service for Kubernetes® nodes Source: https://docs.nebius.com/kubernetes/maintenance/health-checks.md Managed Service for Kubernetes runs *[Node Problem Detector](https://kubernetes.io/docs/tasks/debug/debug-cluster/monitor-node-health/)* (NPD) to monitor health checks. NPD is an open-source Kubernetes daemon that checks a node's health, detects problems on a node, and reports them as [Kubernetes conditions](https://kubernetes.io/docs/reference/node/node-status/#condition) or [events](https://kubernetes.io/docs/reference/kubernetes-api/cluster-resources/event-v1/). Managed Kubernetes runs NPD on each node in the cluster as a systemd service by default. NPD collects information about CPU usage, disk usage, and network status. Based on health checks, Managed Kubernetes automatically recovers nodes in a cluster. The service applies health checks in the following cases: * A Network SSD Non-replicated (Network SSD NRD) boot disk experiences [input/output (I/O) issues](https://docs.nebius.com/kubernetes/maintenance/health-checks.md#i%2Fo-issues-of-a-network-ssd-nrd-boot-disk) and does not work correctly. * A node is reporting a [false or unknown status](https://docs.nebius.com/kubernetes/maintenance/health-checks.md#false-or-unknown-status-of-a-node). * A node is experiencing [problems with GPUs](https://docs.nebius.com/kubernetes/maintenance/health-checks.md#issues-with-gpus-on-a-node). For information about the availability of health checks, see [How to enable or disable health checks in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/maintenance/enable-disable-health-checks.md). ## I/O issues of a Network SSD NRD boot disk If a Network SSD NRD boot disk on a node is unavailable for reading data from the disk or writing to it, the boot disk reports I/O errors. If the errors persist for 30 seconds or more, Managed Kubernetes sets the Kubernetes condition `NebiusBootDiskIOError = True` for the node. To fix the I/O issues, the service runs an automatic recovery: it deletes the node and then creates a new one with a different name and healthy boot disk. ## False or unknown status of a node Managed Kubernetes runs health checks and sets the `Ready` Kubernetes condition to check a node's status. If the condition remains in the `False` status for more than five minutes, or if the condition remains in the `Unknown` status for more than 15 minutes, the service runs an automatic recovery. It deletes the node and then creates a healthy one with a different name. ## Issues with GPUs on a node Managed Kubernetes runs several health checks for components of a GPU-based cluster. For example, the service checks GPUs, [InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md) and NVLink by using the `nvidia-smi`, `dcgmi` and `dmesg` tools. Also, the service checks if a GPU node experiences [Xid errors](https://docs.nvidia.com/deploy/xid-errors/introduction.html) or problems with the [error correction code memory](https://en.wikipedia.org/wiki/ECC_memory). Each GPU health check runs every five minutes. If all GPU health checks have passed, the `NebiusGPUError` Kubernetes condition is set to the `False` status. If the condition is set to the `True` status, Managed Kubernetes automatically recovers the node: 1. To stop scheduling new Pods, Managed Kubernetes cordons the node. 2. The service waits until all workloads that consume GPUs are finished or stopped, and until these GPUs are released. 3. To remove existing Pods, Managed Kubernetes drains the node. The drain takes up to one hour. 4. Nebius AI Cloud stops the node (the Compute virtual machine which the node is based on). 5. Nebius AI Cloud starts the node. 6. Managed Kubernetes uncordons the node and enables scheduling new Pods. As a result, Managed Kubernetes migrates the node to a different, healthy virtual machine. Sometimes, a GPU-related issue is solved before Managed Kubernetes starts to drain the node. In this case, the service does not drain the node but uncordons it instead. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # How to enable or disable health checks in a Managed Service for Kubernetes® cluster Source: https://docs.nebius.com/kubernetes/maintenance/enable-disable-health-checks.md ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to enable health checks [Health checks](https://docs.nebius.com/kubernetes/maintenance/health-checks.md) are enabled by default in Managed Service for Kubernetes clusters created on December 1, 2025, or later. If you created your cluster before this date and you want to enable the health checks, [contact technical support](https://console.nebius.com/support/create-ticket). Alternatively, [create a cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters) and [move your workloads](https://docs.nebius.com/kubernetes/node-groups/moving-workload.md) there. ## How to disable health checks Disabling a health check means adding an auto-repair condition with the trigger turned off to the node group. The condition type and status depend on the issue type to which the health check is applied. ### How to stop processing I/O issues of a Network SSD NRD boot disk If you want to prevent Managed Kubernetes from deleting a node when a Network SSD Non-replicated boot disk reports [input/output (I/O) issues](https://docs.nebius.com/kubernetes/maintenance/health-checks.md#i%2Fo-issues-of-a-network-ssd-nrd-boot-disk), disable a health check for the `NebiusBootDiskIOError` condition: > [tab] CLI > > ```bash > nebius mk8s node-group update --id \ > --auto-repair-conditions '[{"type":"NebiusBootDiskIOError","status":"TRUE","disabled":true}]' > ``` > [tab] Go SDK > > ```go > ioIssuesNodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > ioIssuesSpec := ioIssuesNodeGroup.GetSpec() > if ioIssuesSpec == nil { > return errors.New("node group spec is missing") > } > ioIssuesSpec.AutoRepair = &mk8s.NodeGroupAutoRepairSpec{ > Conditions: []*mk8s.NodeAutoRepairCondition{ > { > Type: "NebiusBootDiskIOError", > Status: mk8s.ConditionStatus_TRUE, > Trigger: &mk8s.NodeAutoRepairCondition_Disabled{ > Disabled: true, > }, > }, > }, > } > ioIssuesOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: ioIssuesNodeGroup.GetMetadata(), > Spec: ioIssuesSpec, > }, > ) > if err != nil { > return err > } > if _, err = ioIssuesOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None: > raise ValueError("node group spec is missing") > node_group.spec.auto_repair = NodeGroupAutoRepairSpec( > conditions=[ > NodeAutoRepairCondition( > type="NebiusBootDiskIOError", > status=ConditionStatus.TRUE, > disabled=True, > ), > ], > ) > operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const ioIssuesService = new NodeGroupService(sdk); > const ioIssuesNodeGroup = await ioIssuesService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!ioIssuesNodeGroup.spec) { > throw new Error("node group spec is missing"); > } > ioIssuesNodeGroup.spec.autoRepair = NodeGroupAutoRepairSpec.create({ > conditions: [ > NodeAutoRepairCondition.create({ > type: "NebiusBootDiskIOError", > status: ConditionStatus.TRUE, > trigger: { > $case: "disabled", > disabled: true, > }, > }), > ], > }); > const ioIssuesOperation = await ioIssuesService.update( > UpdateNodeGroupRequest.create({ > metadata: ioIssuesNodeGroup.metadata, > spec: ioIssuesNodeGroup.spec, > }), > ).result; > await ioIssuesOperation.wait(); > ``` ### False or unknown status of a node If you want to prevent Managed Kubernetes from deleting a node when it reports a [false or unknown status](https://docs.nebius.com/kubernetes/maintenance/health-checks.md#false-or-unknown-status-of-a-node), disable a health check: 1. Disable the health check for the `Unknown` status of the node: > [tab] CLI > > ```bash > nebius mk8s node-group update --id \ > --auto-repair-conditions '[{"type":"Ready","status":"UNKNOWN","disabled":true}]' > ``` > [tab] Go SDK > > ```go > unknownStatusNodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > unknownStatusSpec := unknownStatusNodeGroup.GetSpec() > if unknownStatusSpec == nil { > return errors.New("node group spec is missing") > } > unknownStatusSpec.AutoRepair = &mk8s.NodeGroupAutoRepairSpec{ > Conditions: []*mk8s.NodeAutoRepairCondition{ > { > Type: "Ready", > Status: mk8s.ConditionStatus_UNKNOWN, > Trigger: &mk8s.NodeAutoRepairCondition_Disabled{ > Disabled: true, > }, > }, > }, > } > unknownStatusOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: unknownStatusNodeGroup.GetMetadata(), > Spec: unknownStatusSpec, > }, > ) > if err != nil { > return err > } > if _, err = unknownStatusOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None: > raise ValueError("node group spec is missing") > node_group.spec.auto_repair = NodeGroupAutoRepairSpec( > conditions=[ > NodeAutoRepairCondition( > type="Ready", > status=ConditionStatus.UNKNOWN, > disabled=True, > ), > ], > ) > operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const unknownStatusService = new NodeGroupService(sdk); > const unknownStatusNodeGroup = await unknownStatusService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!unknownStatusNodeGroup.spec) { > throw new Error("node group spec is missing"); > } > unknownStatusNodeGroup.spec.autoRepair = > NodeGroupAutoRepairSpec.create({ > conditions: [ > NodeAutoRepairCondition.create({ > type: "Ready", > status: ConditionStatus.UNKNOWN, > trigger: { > $case: "disabled", > disabled: true, > }, > }), > ], > }); > const unknownStatusOperation = await unknownStatusService.update( > UpdateNodeGroupRequest.create({ > metadata: unknownStatusNodeGroup.metadata, > spec: unknownStatusNodeGroup.spec, > }), > ).result; > await unknownStatusOperation.wait(); > ``` 2. Disable the health check for the `False` status of the node: > [tab] CLI > > ```bash > nebius mk8s node-group update --id \ > --auto-repair-conditions '[{"type":"Ready","status":"FALSE","disabled":true}]' > ``` > [tab] Go SDK > > ```go > falseStatusNodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > falseStatusSpec := falseStatusNodeGroup.GetSpec() > if falseStatusSpec == nil { > return errors.New("node group spec is missing") > } > falseStatusSpec.AutoRepair = &mk8s.NodeGroupAutoRepairSpec{ > Conditions: []*mk8s.NodeAutoRepairCondition{ > { > Type: "Ready", > Status: mk8s.ConditionStatus_FALSE, > Trigger: &mk8s.NodeAutoRepairCondition_Disabled{ > Disabled: true, > }, > }, > }, > } > falseStatusOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: falseStatusNodeGroup.GetMetadata(), > Spec: falseStatusSpec, > }, > ) > if err != nil { > return err > } > if _, err = falseStatusOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None: > raise ValueError("node group spec is missing") > node_group.spec.auto_repair = NodeGroupAutoRepairSpec( > conditions=[ > NodeAutoRepairCondition( > type="Ready", > status=ConditionStatus.FALSE, > disabled=True, > ), > ], > ) > operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const falseStatusService = new NodeGroupService(sdk); > const falseStatusNodeGroup = await falseStatusService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!falseStatusNodeGroup.spec) { > throw new Error("node group spec is missing"); > } > falseStatusNodeGroup.spec.autoRepair = > NodeGroupAutoRepairSpec.create({ > conditions: [ > NodeAutoRepairCondition.create({ > type: "Ready", > status: ConditionStatus.FALSE, > trigger: { > $case: "disabled", > disabled: true, > }, > }), > ], > }); > const falseStatusOperation = await falseStatusService.update( > UpdateNodeGroupRequest.create({ > metadata: falseStatusNodeGroup.metadata, > spec: falseStatusNodeGroup.spec, > }), > ).result; > await falseStatusOperation.wait(); > ``` ### How to stop processing issues with GPUs on a node If you want to prevent Managed Kubernetes from cordoning, draining and stopping a node when the service detects [issues with GPUs](https://docs.nebius.com/kubernetes/maintenance/health-checks.md#issues-with-gpus-on-a-node) on it, disable a health check for the `NebiusGPUError` condition: > [tab] CLI > > ```bash > nebius mk8s node-group update --id \ > --auto-repair-conditions '[{"type":"NebiusGPUError","status":"TRUE","disabled":true}]' > ``` > [tab] Go SDK > > ```go > gpuIssuesNodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > gpuIssuesSpec := gpuIssuesNodeGroup.GetSpec() > if gpuIssuesSpec == nil { > return errors.New("node group spec is missing") > } > gpuIssuesSpec.AutoRepair = &mk8s.NodeGroupAutoRepairSpec{ > Conditions: []*mk8s.NodeAutoRepairCondition{ > { > Type: "NebiusGPUError", > Status: mk8s.ConditionStatus_TRUE, > Trigger: &mk8s.NodeAutoRepairCondition_Disabled{ > Disabled: true, > }, > }, > }, > } > gpuIssuesOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: gpuIssuesNodeGroup.GetMetadata(), > Spec: gpuIssuesSpec, > }, > ) > if err != nil { > return err > } > if _, err = gpuIssuesOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None: > raise ValueError("node group spec is missing") > node_group.spec.auto_repair = NodeGroupAutoRepairSpec( > conditions=[ > NodeAutoRepairCondition( > type="NebiusGPUError", > status=ConditionStatus.TRUE, > disabled=True, > ), > ], > ) > operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const gpuIssuesService = new NodeGroupService(sdk); > const gpuIssuesNodeGroup = await gpuIssuesService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!gpuIssuesNodeGroup.spec) { > throw new Error("node group spec is missing"); > } > gpuIssuesNodeGroup.spec.autoRepair = NodeGroupAutoRepairSpec.create({ > conditions: [ > NodeAutoRepairCondition.create({ > type: "NebiusGPUError", > status: ConditionStatus.TRUE, > trigger: { > $case: "disabled", > disabled: true, > }, > }), > ], > }); > const gpuIssuesOperation = await gpuIssuesService.update( > UpdateNodeGroupRequest.create({ > metadata: gpuIssuesNodeGroup.metadata, > spec: gpuIssuesNodeGroup.spec, > }), > ).result; > await gpuIssuesOperation.wait(); > ``` # How to connect to Managed Service for Kubernetes® clusters using kubectl Source: https://docs.nebius.com/kubernetes/connect.md Use the public endpoint to connect to the cluster from the internet and the private endpoint to connect from a Compute virtual machine. The kubeconfig file uses your Nebius AI Cloud credentials. To let users sign in with an external identity provider instead, see [Authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md). > [tab] From the internet > > 1. Generate a kubeconfig file: > > ```bash > nebius mk8s cluster get-credentials \ > --id --external > ``` > > 2. Use kubectl: > > ```bash > kubectl cluster-info > ``` > > > [!TIP] > > > > You can limit access to the public endpoint and only allow certain IP addresses to connect to the cluster. For more information, see [Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md). > [tab] From a Compute VM > > > [!WARNING] > > > > **Requirements to connect to a VM with private IP address** > > > > To connect to a Managed Service for Kubernetes cluster from a Compute VM by using a [private IP address](https://docs.nebius.com/compute/virtual-machines/network.md#private-ip) or from another cluster by using a private load balancer, both must be in the same [network](https://docs.nebius.com/vpc/overview.md#network) and [region](https://docs.nebius.com/overview/regions.md). They can use different subnets, [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing), and [routing tables](https://docs.nebius.com/vpc/overview.md#routing-table). > > 1. Generate a kubeconfig file: > > ```bash > nebius mk8s cluster get-credentials \ > --id --internal > ``` > > 2. Use kubectl: > > ```bash > kubectl cluster-info > ``` # Network requirements for Managed Service for Kubernetes® clusters Source: https://docs.nebius.com/kubernetes/networking/requirements.md A Managed Service for Kubernetes cluster requires several blocks of IP addresses for its components. Before creating a cluster, make sure that you meet the IP address requirements: * The required allocations fit into your free [quotas](https://docs.nebius.com/vpc/resources/quotas-limits.md). * The [subnet](https://docs.nebius.com/vpc/overview.md#subnet) you select during cluster creation has enough free CIDR blocks. > [!NOTE] > > If you use a default subnet, it already meets the CIDR block requirement. If you plan to [use a non-default subnet](https://docs.nebius.com/kubernetes/networking/non-default-subnet.md), check that the subnet has the necessary IP address allocations available. If Managed Kubernetes is unable to allocate the IP addresses, cluster creation fails. ## Private IP address allocations For the [control plane](https://docs.nebius.com/kubernetes/components.md#control-plane-components): * 5 `/32` allocations: * 1 for the internal load balancer. * 4 for the control plane instances in case of high availability (3 for `etcd` instances and 1 more to enable control plane updates). If control plane high availability is disabled, 3 `/32` allocations are enough. * 1 allocation for Kubernetes services. By default, a `/16` CIDR block is allocated, but you can set the `spec.kube_network.service_cidrs` parameter during cluster creation to specify a custom CIDR block, in range from `/12` to `/28`. For [node groups](https://docs.nebius.com/kubernetes/components.md#node-group), per node: * 1 `/24` allocation for Pods assigned to a node. * 1 `/32` allocation for the internal IP address of a node. With the default [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters), a rolling update does not require quota for additional nodes. If you configure a surge-based deployment strategy, make sure that you have enough available quota for the additional nodes that can be created during the update. > [!WARNING] > > If you set a specific subnet for a node group or for the control plane, make sure that the required CIDR blocks are available within that subnet. ## Public IP address allocations The public IP address of the cluster is allocated automatically from the Managed Kubernetes project and does not use up your quota. If you have enabled public IP addresses for nodes in a node group (with the `spec.template.network_interfaces.public_ip_address` parameter), you need 1 `/32` public IP allocation for each node. To assign public IP addresses from a fixed set, [create a subnet with a dedicated public IP address pool and configure the node group to use it](https://docs.nebius.com/kubernetes/networking/defined-ips.md). Individual node IP addresses may change, but they are selected from the subnet's pool. # Access restriction for a public endpoint of a Managed Service for Kubernetes® cluster Source: https://docs.nebius.com/kubernetes/networking/limit-access-to-public-endpoint.md If a Managed Service for Kubernetes cluster has a public endpoint, one can access it from any IP address on the internet. You can limit this access and only allow certain IP addresses to reach the cluster. To do so, specify allowed CIDR blocks in the cluster configuration. When you enable a public endpoint for a Managed Kubernetes cluster, Nebius AI Cloud allocates a public IP address and provisions a load balancer to the cluster. This load balancer routes traffic to the [control plane instances](https://docs.nebius.com/kubernetes/components.md#control-plane-components). With access restriction set for a public endpoint, the allowlist of IP addresses takes effect at the network interface level of those instances based on [security groups](https://docs.nebius.com/vpc/security-groups/overview.md). The access restriction doesn't affect the private endpoint and internal traffic. The private endpoint remains open as before. ## Prerequisites Set up the interface that you are going to use: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to set an allowlist to access a Managed Kubernetes cluster Set allowed CIDR blocks when you create or update a cluster. The CIDR blocks must follow the IPv4 format. Bits for hosts must be equal to zero. Examples of valid CIDR blocks: * `192.168.0.0/24` where the last eight bits are allocated to hosts and equal to zero. * `8.8.8.64/26` where the last six bits are allocated to hosts and equal to zero (64 in the decimal system is 01000000 in the binary system). > [tab] CLI > > Pass each CIDR block as a separate `--control-plane-endpoints-public-endpoint-allowed-cidrs` parameter. To set an allowlist of CIDR blocks, do one of the following: > > * Create a cluster with limited access to the public endpoint: > > ```bash > nebius mk8s cluster create \ > --control-plane-endpoints-public-endpoint=true \ > --control-plane-endpoints-public-endpoint-allowed-cidrs "203.0.113.0/24" \ > --control-plane-endpoints-public-endpoint-allowed-cidrs "198.51.100.128/25" \ > ... > ``` > > * Update a cluster and restrict access to the public endpoint: > > ```bash > nebius mk8s cluster update \ > --control-plane-endpoints-public-endpoint-allowed-cidrs "203.0.113.0/24" \ > --control-plane-endpoints-public-endpoint-allowed-cidrs "198.51.100.128/25" > ``` > > The `update` command overwrites the list of CIDR blocks. If you added any CIDR blocks earlier and you want to preserve them, specify these CIDR blocks in the `update` command. > [tab] Terraform > > List the CIDR blocks in the `allowed_cidrs` parameter of the cluster's public endpoint: > > ```hcl > resource "nebius_mk8s_v1_cluster" "my_cluster" { > ... > control_plane = { > ... > endpoints = { > public_endpoint = { > allowed_cidrs = ["203.0.113.0/24", "198.51.100.128/25"] > } > } > } > } > ``` > > Applying the configuration overwrites the list of CIDR blocks. If you added any CIDR blocks earlier and you want to preserve them, keep these CIDR blocks in the configuration. > [tab] Go SDK > > Set `AllowedCidrs` in `PublicEndpointSpec` when you create or update a cluster: > > ```go > clusterToRestrict, err := sdk.Services().MK8S().V1(). > Cluster().Get( > ctx, > &mk8s.GetClusterRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > restrictSpec := clusterToRestrict.GetSpec() > if restrictSpec == nil || > restrictSpec.GetControlPlane() == nil { > return fmt.Errorf("cluster control plane spec is missing") > } > restrictSpec.ControlPlane.Endpoints = > &mk8s.ControlPlaneEndpointsSpec{ > PublicEndpoint: &mk8s.PublicEndpointSpec{ > AllowedCidrs: []string{ > "203.0.113.0/24", > "198.51.100.128/25", > }, > }, > } > restrictOperation, err := sdk.Services().MK8S().V1(). > Cluster().Update( > ctx, > &mk8s.UpdateClusterRequest{ > Metadata: clusterToRestrict.GetMetadata(), > Spec: restrictSpec, > }, > ) > if err != nil { > return err > } > if _, err = restrictOperation.Wait(ctx); err != nil { > return err > } > ``` > > The update overwrites the list of CIDR blocks. If you added any CIDR blocks earlier and you want to preserve them, include these CIDR blocks in `AllowedCidrs`. > [tab] Python SDK > > Set `allowed_cidrs` in `PublicEndpointSpec` when you create or update a cluster: > > ```python > restrict_cluster_service = ClusterServiceClient(sdk) > cluster_to_restrict = await restrict_cluster_service.get( > GetClusterRequest(id=""), > ) > if cluster_to_restrict.spec is None: > raise ValueError("cluster spec is missing") > if cluster_to_restrict.spec.control_plane is None: > raise ValueError("cluster control plane spec is missing") > cluster_to_restrict.spec.control_plane.endpoints = ( > ControlPlaneEndpointsSpec( > public_endpoint=PublicEndpointSpec( > allowed_cidrs=[ > "203.0.113.0/24", > "198.51.100.128/25", > ], > ), > ) > ) > restrict_operation = await restrict_cluster_service.update( > UpdateClusterRequest( > metadata=cluster_to_restrict.metadata, > spec=cluster_to_restrict.spec, > ), > ) > await restrict_operation.wait() > ``` > > The update overwrites the list of CIDR blocks. If you added any CIDR blocks earlier and you want to preserve them, include these CIDR blocks in `allowed_cidrs`. > [tab] JavaScript SDK > > Set `allowedCidrs` in `PublicEndpointSpec` when you create or update a cluster: > > ```ts > const restrictClusterService = new ClusterService(sdk); > const clusterToRestrict = await restrictClusterService.get( > GetClusterRequest.create({ > id: "", > }), > ); > if (!clusterToRestrict.spec?.controlPlane) { > throw new Error("cluster control plane spec is missing"); > } > clusterToRestrict.spec.controlPlane.endpoints = > ControlPlaneEndpointsSpec.create({ > publicEndpoint: PublicEndpointSpec.create({ > allowedCidrs: ["203.0.113.0/24", "198.51.100.128/25"], > }), > }); > const restrictOperation = await restrictClusterService.update( > UpdateClusterRequest.create({ > metadata: clusterToRestrict.metadata, > spec: clusterToRestrict.spec, > }), > ).result; > await restrictOperation.wait(); > ``` > > The update overwrites the list of CIDR blocks. If you added any CIDR blocks earlier and you want to preserve them, include these CIDR blocks in `allowedCidrs`. For more information about other parameters, see [How to create and modify Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/clusters/manage.md). # Security groups in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/networking/security-groups.md Managed Service for Kubernetes integrates with Virtual Networks security groups to control traffic to and from your cluster's nodes. For a general overview of network security groups and how to create them, see [Security groups overview](https://docs.nebius.com/vpc/security-groups). ## System security groups Nebius automatically creates and manages a *system security group* per cluster for your worker nodes. This security group guarantees that core Kubernetes connectivity, such as connectivity between the API server and kubelets, works correctly regardless of any additional security groups that you configure on your node groups. The system security group is visible in your project, but it's marked as managed. You can't edit it or attach it to your own resources. ## User-defined security groups You can [attach](https://docs.nebius.com/kubernetes/networking/manage-security-groups.md) your own security groups to node groups. When you do, each node in that group has both your security groups and the system security group attached. The system security group is always present and can't be overridden or removed. If you don't specify any security groups when creating a node group, the network's default security group is attached alongside the system security group. This means you can use your own security groups to restrict or allow additional traffic, such as traffic between node groups or to external services, without risking disruption to cluster operations. ## Default security groups Every virtual machine (VM) or node group in Nebius AI Cloud is always added to at least one security group: the network's *default security group*. This applies automatically and can't be removed. It ensures that VMs always have a baseline set of rules even before any cluster-level or user-defined groups are applied. ## See also * [How to attach security groups to a node group](https://docs.nebius.com/kubernetes/networking/manage-security-groups.md) # How to attach security groups to a node group in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/networking/manage-security-groups.md Attach network security groups to Managed Kubernetes node groups to control traffic to and from your cluster's nodes. ## Prerequisites Before attaching security groups to a node group, you need to create them. See [Managing security groups](https://docs.nebius.com/vpc/security-groups/manage.md) for instructions on creating groups and defining rules. > [!WARNING] > > If you use your own security groups to restrict egress traffic, make sure that the cluster can still access the resources it needs. For example, blocking outbound internet access can break functionality that depends on it, such as pulling images from external registries. Set up the interface that you are going to use: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to attach security groups to a node group > [tab] Web console > > To attach a security group to a node group: > > 1. In the [web console](https://console.nebius.com), go to  **Compute** → **Kubernetes**. > 2. Open the page of the cluster with the node group where you want to attach a security group. > 3. Switch to the **Node groups** tab and open the page of the required node group. > 4. On the node group page, switch to the **Security groups** tab and click **Attach security groups**. > 5. In the window that opens, select one or multiple security groups and click **Attach security groups**. > [tab] CLI > > To attach security groups when creating a node group, use the `--template-network-interfaces` parameter: > > ```bash > nebius mk8s node-group create \ > --parent-id \ > --name \ > --fixed-node-count 1 \ > --template-resources-platform \ > --template-resources-preset \ > --template-network-interfaces "[{\"subnet_id\": \"\", \"security_groups\": [{\"id\": \"\"}, {\"id\": \"\"}]}]" > ``` > > To get the security group ID, run `nebius vpc security-group list`. > [tab] Go SDK > > Use `SecurityGroups` in `Spec.Template.NetworkInterfaces` to assign security groups when creating a node group: > > ```go > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 1, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "", > }, > }, > NetworkInterfaces: > []*mk8s.NetworkInterfaceTemplate{ > { > SubnetId: "", > SecurityGroups: []*mk8s.SecurityGroup{ > {Id: ""}, > {Id: ""}, > }, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > Use `security_groups` in `spec.template.network_interfaces` to assign security groups when creating a node group: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=NodeGroupSpec( > fixed_node_count=1, > template=NodeTemplate( > resources=ResourcesSpec( > platform="", > preset="", > ), > network_interfaces=[ > NetworkInterfaceTemplate( > subnet_id="", > security_groups=[ > SecurityGroup(id=""), > SecurityGroup(id=""), > ], > ), > ], > ), > ), > ), > ) > await node_group_operation.wait() > ``` > [tab] JavaScript SDK > > Use `securityGroups` in `spec.template.networkInterfaces` to assign security groups when creating a node group: > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 1, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > networkInterfaces: [ > NetworkInterfaceTemplate.create({ > subnetId: "", > securityGroups: [ > SecurityGroup.create({ id: "" }), > SecurityGroup.create({ id: "" }), > ], > }), > ], > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` ## How to update security groups on an existing node group > [tab] Web console > > To change or delete the attached security group from a node group: > > 1. In the [web console](https://console.nebius.com), go to  **Compute** → **Kubernetes**. > 2. Open the page of the cluster with the node group where you want to change a security group. > 3. Switch to the **Node groups** tab and open the page of the required node group. > 4. On the node group page, switch to the **Security groups** tab. > > * To attach a different security group: > > 1. Click **Attach security groups**. > 2. In the window that opens, select one or multiple security groups, and click **Attach security groups**. > * To detach a security group: > > 1. Click next to the security group you want to detach and select **Detach**. > 2. In the window that opens, enter the name of the security group and click **Detach security group**. > [tab] CLI > > Run the following command: > > ```bash > nebius mk8s node-group update \ > --template-network-interfaces "[{\"subnet_id\": \"\", \"security_groups\": [{\"id\": \"\"}, {\"id\": \"\"}]}]" \ > > ``` > > To get the security group ID, run `nebius vpc security-group list`. > [tab] Go SDK > > ```go > nodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > nodeGroupSpec := nodeGroup.GetSpec() > if nodeGroupSpec == nil || nodeGroupSpec.GetTemplate() == nil { > return errors.New("node group template is missing") > } > nodeGroupSpec.GetTemplate().NetworkInterfaces = > []*mk8s.NetworkInterfaceTemplate{ > { > SubnetId: "", > SecurityGroups: []*mk8s.SecurityGroup{ > {Id: ""}, > {Id: ""}, > }, > }, > } > nodeGroupOperation, err = sdk.Services().MK8S().V1(). > NodeGroup().Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: nodeGroup.GetMetadata(), > Spec: nodeGroupSpec, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None or node_group.spec.template is None: > raise ValueError("node group template is missing") > node_group.spec.template.network_interfaces = [ > NetworkInterfaceTemplate( > subnet_id="", > security_groups=[ > SecurityGroup(id=""), > SecurityGroup(id=""), > ], > ), > ] > node_group_operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await node_group_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const nodeGroupUpdateService = new NodeGroupService(sdk); > const nodeGroup = await nodeGroupUpdateService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!nodeGroup.spec?.template) { > throw new Error("node group template is missing"); > } > nodeGroup.spec.template.networkInterfaces = [ > NetworkInterfaceTemplate.create({ > subnetId: "", > securityGroups: [ > SecurityGroup.create({ id: "" }), > SecurityGroup.create({ id: "" }), > ], > }), > ]; > const nodeGroupUpdateOperation = await nodeGroupUpdateService.update( > UpdateNodeGroupRequest.create({ > metadata: nodeGroup.metadata, > spec: nodeGroup.spec, > }), > ).result; > await nodeGroupUpdateOperation.wait(); > ``` The update replaces the whole network interface list, so include every subnet and security group that the node group must keep. # Exposing services with load balancers Source: https://docs.nebius.com/kubernetes/clusters/load-balancer.md You can expose a [Kubernetes service](https://kubernetes.io/docs/concepts/services-networking/service/) in your Managed Service for Kubernetes cluster using a *load balancer*. The load balancer receives traffic on a public or private IP address, depending on how you [set it up](https://docs.nebius.com/kubernetes/clusters/load-balancer.md#how-to-set-up-a-load-balancer), and distributes the traffic between the service's Pods automatically. > [!WARNING] > > **Requirements to connect to a VM with private IP address** > > To connect to a Managed Service for Kubernetes cluster from a Compute VM by using a [private IP address](https://docs.nebius.com/compute/virtual-machines/network.md#private-ip) or from another cluster by using a private load balancer, both must be in the same [network](https://docs.nebius.com/vpc/overview.md#network) and [region](https://docs.nebius.com/overview/regions.md). They can use different subnets, [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing), and [routing tables](https://docs.nebius.com/vpc/overview.md#routing-table). ## Prerequisites Before you start setting up a load balancer, you need to [create a Managed Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters) and [connect to it](https://docs.nebius.com/kubernetes/connect.md) using kubectl. ## Load balancers types By default, load balancers are created with public IP addresses. To expose your service on a private IP address instead, add `nebius.com/load-balancer-type: internal` to the annotations of the service. > [!NOTE] > > To retain an IP address that was automatically allocated to a load balancer and reuse it after deleting or recreating the service, follow the [How to convert a dynamically assigned public IP address to a reusable allocation](https://docs.nebius.com/kubernetes/networking/dynamic-to-static.md) guide. If you have created an IP address allocation ([example for public IP addresses](https://docs.nebius.com/compute/virtual-machines/network.md#public-ip-addresses)) and want to use it to allocate an IP address to a load balancer, add its ID to the service annotation `nebius.com/load-balancer-allocation-id`. The allocation type (public or private) must match the load balancer type. The load balancer listener is created in the control plane subnet of the cluster. The allocation that you specify in `nebius.com/load-balancer-allocation-id` must belong to this subnet. The table below explains how these two annotations work together: | Type is `internal` | Allocation ID is set | Result | | - | - | - | | Yes | Yes | Load balancer gets a **private** IP address from the **provided** allocation | | Yes | No | Load balancer gets a **private** IP address from a **new** allocation | | No | Yes | Load balancer gets a **public** IP address from the **provided** allocation | | No | No | Load balancer gets a **public** IP address from a **new** allocation | To allocate a public IP address from a specific IP pool, add the pool ID to the `nebius.com/load-balancer-pool-id` service annotation. When this annotation is set, the IP address is allocated from the specified pool instead of the default user subnet pool. For more information about IP pools, see the [Virtual Networks overview](https://docs.nebius.com/vpc/overview.md#pool). ```yaml annotations: nebius.com/load-balancer-pool-id: "" ``` ## Limitations * Managed Service for Kubernetes doesn't support load balancer services that set `externalTrafficPolicy` to `Local`. * Load balancers don't support PROXY protocol v1 or v2. There is no service annotation to enable it. ## How to set up a load balancer > [tab] With a private IP address > > 1. Create the manifest to set up the internal load balancer service with a private IP address (we will refer to it later as `service.yaml`): > > ```yaml > apiVersion: v1 > kind: Service > metadata: > name: nginx > annotations: > nebius.com/load-balancer-type: "internal" > spec: > selector: > app: nginx > ports: > - protocol: TCP > port: 80 > targetPort: 80 > type: LoadBalancer > ``` > > 2. Create the manifest for nginx deployment (we will refer to it later as `deployment.yaml`): > > ```yaml > apiVersion: apps/v1 > kind: Deployment > metadata: > name: nginx-deployment > spec: > replicas: 1 > selector: > matchLabels: > app: nginx > template: > metadata: > labels: > app: nginx > spec: > containers: > - name: nginx > image: nginx:latest > ports: > - containerPort: 80 > ``` > > 3. Apply the configurations: > > ```bash > kubectl apply -f deployment.yaml > kubectl apply -f service.yaml > ``` > > 4. Check the service and the allocated IP address: > > ```bash > kubectl get svc nginx > ``` > > You will receive an output like the one below: > > ```bash > NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE > nginx LoadBalancer 10.158.250.188 192.168.0.112 80:30512/TCP 4s > ``` > [tab] With a public IP address > > 1. Create the manifest to set up the internal load balancer service with a public IP address (we will refer to it later as `service.yaml`): > > ```yaml > apiVersion: v1 > kind: Service > metadata: > name: nginx > spec: > selector: > app: nginx > ports: > - protocol: TCP > port: 80 > targetPort: 80 > type: LoadBalancer > ``` > > 2. Create the manifest for nginx deployment (we will refer to it later as `deployment.yaml`): > > ```yaml > apiVersion: apps/v1 > kind: Deployment > metadata: > name: nginx-deployment > spec: > replicas: 1 > selector: > matchLabels: > app: nginx > template: > metadata: > labels: > app: nginx > spec: > containers: > - name: nginx > image: nginx:latest > ports: > - containerPort: 80 > ``` > > 3. Apply the configurations: > > ```bash > kubectl apply -f deployment.yaml > kubectl apply -f service.yaml > ``` > > 4. Check the service and the allocated IP address: > > ```bash > kubectl get svc nginx > ``` > > You will see an output like the one below: > > ```bash > NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE > nginx LoadBalancer 10.158.105.48 195.242.8.219 80:30816/TCP 13s > ``` > > 5. Use the `EXTERNAL-IP` from the previous command output to connect to the service from outside of the Kubernetes cluster: > > ```bash > curl -i > ``` > > You will see an output like the one below: > > ```bash > HTTP/1.1 200 OK > Server: nginx/1.27.1 > ``` ## How to restrict access to a load balancer To allow traffic only from selected sources, use either a [security group](https://docs.nebius.com/vpc/security-groups/overview.md) in Virtual Networks or the `loadBalancerSourceRanges` parameter in the Service specification. If you use both of them, the security group rules are applied first and take precedence. Traffic that is denied by the security group never reaches [Cilium](https://docs.nebius.com/kubernetes/networking/add-ons.md), which manages networking in the cluster and is installed by default. Traffic that is allowed by the security group is then checked against `loadBalancerSourceRanges`. However, to avoid conflicting allowlists, specify them in either the security group rules or in `loadBalancerSourceRanges`. ### Using a security group The security group rules are enforced at the network interface level of nodes before Cilium processes the traffic. To restrict access to a load balancer by using a security group: 1. [Create a security group](https://docs.nebius.com/vpc/security-groups/manage.md#creating-security-groups). The security group must belong to the same network as the cluster. 2. [Add security rules](https://docs.nebius.com/vpc/security-groups/manage.md#adding-security-rules-to-security-groups). These should be stateful ingress `ALLOW` rules for every protocol and port exposed by the Service. In each rule, specify the source CIDR blocks that should have access. 3. Add the `nebius.com/load-balancer-security-group-id` annotation to the Service manifest: ```yaml highlight={5-6} apiVersion: v1 kind: Service metadata: name: nginx annotations: nebius.com/load-balancer-security-group-id: "" spec: selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80 type: LoadBalancer ``` You can assign only one security group to a load balancer. > [!WARNING] > > Adding, changing, or removing the security group annotation recreates the load balancer and can briefly interrupt traffic. 4. Apply the updated manifest: ```bash kubectl apply -f service.yaml ``` ### Adding the loadBalancerSourceRanges parameter The `loadBalancerSourceRanges` parameter in the Service `spec` object defines the CIDR blocks that can access the load balancer. Cilium then applies this restriction. To restrict access to a load balancer by using the `loadBalancerSourceRanges` parameter: 1. Add the allowed CIDR blocks to this parameter: ```yaml highlight={6-8} apiVersion: v1 kind: Service metadata: name: nginx spec: loadBalancerSourceRanges: - "198.51.100.0/24" - "203.0.113.10/32" selector: app: nginx ports: - protocol: TCP port: 80 targetPort: 80 type: LoadBalancer ``` 2. Apply the updated manifest: ```bash kubectl apply -f service.yaml ``` # How to use a non-default subnet for Managed Service for Kubernetes® clusters and node groups Source: https://docs.nebius.com/kubernetes/networking/non-default-subnet.md By default, when you create a Managed Service for Kubernetes cluster, its control plane uses the [default subnet of the default network](https://docs.nebius.com/vpc/overview.md#default-virtual-networks-resources) in your project. Node groups inherit the control plane's subnet. You might want to use custom subnets that you created, for example, to ensure [resource isolation](https://docs.nebius.com/vpc/networking/isolation.md), [allocate custom private IP addresses](https://docs.nebius.com/vpc/addressing/custom-private-addresses.md) to nodes or [disable public IP addresses](https://docs.nebius.com/vpc/addressing/disable-public-addresses.md) for them. > [!NOTE] > > To ensure connectivity, the control plane subnet and the node group subnet must belong to the same [network](https://docs.nebius.com/vpc/overview.md#network). Their [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing), however, can be different. ## A non-default network for clusters To use a custom subnet for a cluster, [get its ID](https://docs.nebius.com/vpc/networking/resources.md) and pass it when [creating the cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters): > [tab] CLI > > Pass the subnet ID to the `--control-plane-subnet-id` parameter: > > ```bash > nebius mk8s cluster create \ > ... \ > --control-plane-subnet-id > ``` > [tab] Go SDK > > Pass the subnet ID to `Spec.ControlPlane.SubnetId`: > > ```go > clusterOperation, err := sdk.Services().MK8S().V1(). > Cluster().Create( > ctx, > &mk8s.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "mk8s-cluster-name", > }, > Spec: &mk8s.ClusterSpec{ > ControlPlane: &mk8s.ControlPlaneSpec{ > Version: "1.36", > SubnetId: "", > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = clusterOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > Pass the subnet ID to `spec.control_plane.subnet_id`: > > ```python > cluster_service = ClusterServiceClient(sdk) > cluster_operation = await cluster_service.create( > CreateClusterRequest( > metadata=ResourceMetadata(name="mk8s-cluster-name"), > spec=ClusterSpec( > control_plane=ControlPlaneSpec( > version="1.36", > subnet_id="", > ), > ), > ), > ) > await cluster_operation.wait() > ``` > [tab] JavaScript SDK > > Pass the subnet ID to `spec.controlPlane.subnetId`: > > ```ts > const clusterService = new ClusterService(sdk); > const clusterOperation = await clusterService.create( > CreateClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "mk8s-cluster-name", > }), > spec: ClusterSpec.create({ > controlPlane: ControlPlaneSpec.create({ > version: "1.36", > subnetId: "", > }), > }), > }), > ).result; > await clusterOperation.wait(); > ``` ## A non-default network for node groups To use a custom subnet for a node group, [get its ID](https://docs.nebius.com/vpc/networking/resources.md) and pass it when [creating the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > [tab] CLI > > Add the subnet ID to the node group creation command by using the `--template-network-interfaces` parameter: > > ```bash > nebius mk8s node-group create \ > ... \ > --template-network-interfaces '[{"public_ip_address": {}, "subnet_id": ""}]' > ``` > > Alternatively, pass the subnet ID to the `spec.template.network_interfaces.subnet_id` parameter of the [node group configuration](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters-cli). > [tab] Go SDK > > Pass the subnet ID to `SubnetId` in `Spec.Template.NetworkInterfaces`: > > ```go > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: "node-group-1", > }, > Spec: &mk8s.NodeGroupSpec{ > Version: "1.36", > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 1, > }, > Template: &mk8s.NodeTemplate{ > BootDisk: &mk8s.DiskSpec{ > Size: &mk8s.DiskSpec_SizeGibibytes{ > SizeGibibytes: 64, > }, > Type: mk8s.DiskSpec_NETWORK_SSD, > }, > Resources: &mk8s.ResourcesSpec{ > Platform: "cpu-d3", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > }, > NetworkInterfaces: > []*mk8s.NetworkInterfaceTemplate{ > { > PublicIpAddress: &mk8s.PublicIPAddress{}, > SubnetId: subnetID, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > `SubnetId` reads the `subnetID` variable, and `ParentId` reads the `mk8sClusterID` variable. Assign the subnet ID and the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-go-sdk) to them before you run the code. > [tab] Python SDK > > Pass the subnet ID to `subnet_id` in `spec.template.network_interfaces`: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name="node-group-1", > ), > spec=NodeGroupSpec( > version="1.36", > fixed_node_count=1, > template=NodeTemplate( > boot_disk=DiskSpec( > size_gibibytes=64, > type=DiskSpec__DiskType.NETWORK_SSD, > ), > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > network_interfaces=[ > NetworkInterfaceTemplate( > public_ip_address=PublicIPAddress(), > subnet_id=subnet_id, > ), > ], > ), > ), > ), > ) > await node_group_operation.wait() > ``` > > `subnet_id` reads the `subnet_id` variable, and `parent_id` reads the `mk8s_cluster_id` variable. Assign the subnet ID and the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-python-sdk) to them before you run the code. > [tab] JavaScript SDK > > Pass the subnet ID to `subnetId` in `spec.template.networkInterfaces`: > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: "node-group-1", > }), > spec: NodeGroupSpec.create({ > version: "1.36", > size: { > $case: "fixedNodeCount", > fixedNodeCount: 1, > }, > template: NodeTemplate.create({ > bootDisk: DiskSpec.create({ > size: { > $case: "sizeGibibytes", > sizeGibibytes: 64, > }, > type: DiskSpec_DiskType.NETWORK_SSD, > }), > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > networkInterfaces: [ > NetworkInterfaceTemplate.create({ > publicIpAddress: PublicIPAddress.create({}), > subnetId: subnetId, > }), > ], > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` > > `subnetId` reads the `subnetId` variable, and `parentId` reads the `mk8sClusterId` variable. Assign the subnet ID and the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-javascript-sdk) to them before you run the code. For more details, see [How to create node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups). # How to create a fixed set of public IP addresses for a node group Source: https://docs.nebius.com/kubernetes/networking/defined-ips.md When you enable public IP addresses for nodes in a node group, the IP addresses are dynamically assigned from the general pool of public IP addresses managed by Nebius AI Cloud. The assigned addresses may change when nodes are recreated or updated. If you need a fixed set of public IP addresses—for example, to configure firewall rules, define an allowlist, register DNS records or integrate external systems—create a subnet with a dedicated public IP address range. While individual node IP addresses may still change, they will always be selected from the range defined in this subnet. ## Prerequisites 1. Set up the interface that you are going to use: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 3. Make sure that you have enough quota on IP addresses to support your node group [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). You can check the quota on the [Administration → Limits → Quotas](https://console.nebius.com/quota) page of the web console. By default, no additional public IP addresses are required during an update. If you configure a surge-based strategy, reserve enough extra public IP addresses for the additional nodes that can be created during the update. Otherwise, updates or upgrades can stop when trying to create a new node. ## How to create a fixed set of IP addresses To create a fixed set of public IP addresses for a node group, create a subnet with a dedicated public IP address pool and configure the node group to use this subnet: 1. Create a subnet with public IP address CIDRs: > [tab] CLI > > ```bash > nebius vpc subnet create \ > --name \ > --network-id \ > --ipv4-public-pools-use-network-pools=false \ > --ipv4-public-pools-pools='[ > { > "cidrs": [ > {"cidr": "/32"}, > {"cidr": "/32"}, > {"cidr": "/32"} > ] > }]' > ``` > > Specify the following parameters: > > * `name`: Name of the subnet with a dedicated set of IP addresses. > * `network-id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli). > * `ipv4-public-pools-pools.cidrs`: One or more IPv4 [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks). The number of these blocks defines how many public IP addresses the subnet has. The nodes in the node group receive these addresses randomly. In the example, three CIDR blocks are defined, each with one public IP address. > > In the output, copy the `metadata.id` value — this is the subnet ID. > [tab] Go SDK > > ```go > subnetOperation, err := sdk.Services().VPC().V1(). > Subnet().Create( > ctx, > &vpc.CreateSubnetRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &vpc.SubnetSpec{ > NetworkId: "", > Ipv4PublicPools: &vpc.IPv4PublicSubnetPools{ > UseNetworkPools: false, > Pools: []*vpc.SubnetPool{ > { > Cidrs: []*vpc.SubnetCidr{ > {Cidr: "/32"}, > {Cidr: "/32"}, > {Cidr: "/32"}, > }, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = subnetOperation.Wait(ctx); err != nil { > return err > } > ``` > > Specify the following parameters: > > * `Metadata.Name`: Name of the subnet with a dedicated set of IP addresses. > * `Spec.NetworkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk). > * `Spec.Ipv4PublicPools.Pools.Cidrs`: One or more IPv4 [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks). The number of these blocks defines how many public IP addresses the subnet has. The nodes in the node group receive these addresses randomly. In the example, three CIDR blocks are defined, each with one public IP address. > > To get the subnet ID, call `subnetOperation.ResourceID()`. > [tab] Python SDK > > ```python > subnet_service = SubnetServiceClient(sdk) > subnet_operation = await subnet_service.create( > CreateSubnetRequest( > metadata=ResourceMetadata(name=""), > spec=SubnetSpec( > network_id="", > ipv4_public_pools=IPv4PublicSubnetPools( > use_network_pools=False, > pools=[ > SubnetPool( > cidrs=[ > SubnetCidr(cidr="/32"), > SubnetCidr(cidr="/32"), > SubnetCidr(cidr="/32"), > ], > ), > ], > ), > ), > ), > ) > await subnet_operation.wait() > ``` > > Specify the following parameters: > > * `metadata.name`: Name of the subnet with a dedicated set of IP addresses. > * `spec.network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk). > * `spec.ipv4_public_pools.pools.cidrs`: One or more IPv4 [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks). The number of these blocks defines how many public IP addresses the subnet has. The nodes in the node group receive these addresses randomly. In the example, three CIDR blocks are defined, each with one public IP address. > > To get the subnet ID, read `subnet_operation.resource_id`. > [tab] JavaScript SDK > > ```ts > const subnetService = new SubnetService(sdk); > const subnetOperation = await subnetService.create( > CreateSubnetRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: SubnetSpec.create({ > networkId: "", > ipv4PublicPools: IPv4PublicSubnetPools.create({ > useNetworkPools: false, > pools: [ > SubnetPool.create({ > cidrs: [ > SubnetCidr.create({ cidr: "/32" }), > SubnetCidr.create({ cidr: "/32" }), > SubnetCidr.create({ cidr: "/32" }), > ], > }), > ], > }), > }), > }), > ).result; > await subnetOperation.wait(); > ``` > > Specify the following parameters: > > * `metadata.name`: Name of the subnet with a dedicated set of IP addresses. > * `spec.networkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk). > * `spec.ipv4PublicPools.pools.cidrs`: One or more IPv4 [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks). The number of these blocks defines how many public IP addresses the subnet has. The nodes in the node group receive these addresses randomly. In the example, three CIDR blocks are defined, each with one public IP address. > > To get the subnet ID, call `subnetOperation.resourceId()`. 2. [Create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) that uses the new subnet and assigns public IP addresses to the nodes: > [tab] CLI > > Specify the new subnet ID in the `--template-network-interfaces` parameter: > > ```bash > nebius mk8s node-group create \ > ... \ > --template-network-interfaces "[{\"public_ip_address\": {}, \"subnet_id\": \"\"}]" > ``` > [tab] Go SDK > > Specify the new subnet ID in `SubnetId` and add `PublicIpAddress` in `Spec.Template.NetworkInterfaces`: > > ```go > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: "defined-ips-test", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 1, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "cpu-d3", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > }, > NetworkInterfaces: > []*mk8s.NetworkInterfaceTemplate{ > { > PublicIpAddress: &mk8s.PublicIPAddress{}, > SubnetId: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > `ParentId` reads the `mk8sClusterID` variable. Assign the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-go-sdk) to it before you run the code. > [tab] Python SDK > > Specify the new subnet ID in `subnet_id` and add `public_ip_address` in `spec.template.network_interfaces`: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name="defined-ips-test", > ), > spec=NodeGroupSpec( > fixed_node_count=1, > template=NodeTemplate( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > network_interfaces=[ > NetworkInterfaceTemplate( > public_ip_address=PublicIPAddress(), > subnet_id="", > ), > ], > ), > ), > ), > ) > await node_group_operation.wait() > ``` > > `parent_id` reads the `mk8s_cluster_id` variable. Assign the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-python-sdk) to it before you run the code. > [tab] JavaScript SDK > > Specify the new subnet ID in `subnetId` and add `publicIpAddress` in `spec.template.networkInterfaces`: > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: "defined-ips-test", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 1, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > networkInterfaces: [ > NetworkInterfaceTemplate.create({ > publicIpAddress: PublicIPAddress.create({}), > subnetId: "", > }), > ], > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` > > `parentId` reads the `mk8sClusterId` variable. Assign the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters-javascript-sdk) to it before you run the code. This configuration assigns random public IP addresses from the CIDR blocks defined in the subnet. Now, the nodes in the node group get public IP addresses from the dedicated set. This enables you to predefine a fixed range of IP addresses for use in an allowlist or for DNS mapping, even if individual IP addresses are reassigned across nodes. # How to convert a dynamically assigned public IP address to a reusable allocation Source: https://docs.nebius.com/kubernetes/networking/dynamic-to-static.md When you [expose a Kubernetes® service](https://docs.nebius.com/kubernetes/clusters/load-balancer.md) in your Managed Service for Kubernetes cluster by using a load balancer, the system automatically creates an allocation with a reserved public IP address and the `nebius.com/managed-by: mk8s` label. However, if the service is deleted, this allocation is also removed by default. To retain the allocated public IP address and reuse it in future, convert the system-managed allocation into a persistent one and manually link it to your service by using an annotation. ## Prerequisites 1. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. Install [jq](https://jqlang.github.io/jq/) to extract IDs and tokens from the JSON data returned by the Nebius AI Cloud CLI: ```bash Ubuntu sudo apt-get install jq ``` ```bash macOS brew install jq ``` 3. [Create a Managed Service for Kubernetes cluster](https://docs.nebius.com/kubernetes/quickstart.md#create-a-cluster-and-a-node-group) if you have not done it before. 4. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [connect to the cluster](https://docs.nebius.com/kubernetes/quickstart.md#connect-to-the-cluster). ## How to convert a dynamic IP address 1. Get the public IP address of your load balancer: ```bash kubectl get svc nginx ``` Copy the IP address from the `EXTERNAL-IP` column. 2. Get the ID of the allocation associated with the IP address: ```bash nebius vpc allocation list --format json | jq -r ' .items[] | select( .status.details.allocated_cidr == "/32" and .metadata.labels["nebius.com/managed-by"] == "mk8s" ) | .metadata.id' ``` Specify the IP address that you copied in the previous step. Alternatively, list all allocations by using the [nebius vpc allocation list](https://docs.nebius.com/cli/reference/vpc/allocation/list.md) command. In the output, look for a block that contains the matching IP address under `status.details.allocated_cidr` and a `labels` field containing `nebius.com/managed-by: mk8s`. Copy the allocation ID. It has the `vpcallocation-***` format. 3. To detach the allocation from automatic deletion, remove system-managed labels of this allocation: 1. Open the editor to edit the allocation: ```bash nebius vpc allocation edit ``` Specify the ID that you copied in the previous step. For details on using the `edit` command, see [How to edit resources via the Nebius AI Cloud CLI](https://docs.nebius.com/cli/edit.md). 2. In the editor, delete all labels from the `labels` list: ```yaml ... labels: {} ... ``` 3. Save the changes and close the editor. Now, the allocation is user-managed, so it will remain even if the associated service is deleted. 4. Update your Kubernetes load balancer manifest (for example, [service.yaml](https://docs.nebius.com/kubernetes/clusters/load-balancer.md#how-to-set-up-a-load-balancer)) with the following annotation: ```yaml metadata: annotations: nebius.com/load-balancer-allocation-id: ``` 5. Apply the updated manifest: ```bash kubectl apply -f service.yaml ``` Now, the public IP allocation is preserved and can be reused if you re-create the service or replace it with another one. For more information, see [Load balancers types](https://docs.nebius.com/kubernetes/clusters/load-balancer.md#load-balancers-types). # Networking add-ons in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/networking/add-ons.md Managed Service for Kubernetes clusters have the following networking add-ons installed by default: * [CoreDNS](https://coredns.io/) is a cluster DNS server. * [Cilium](https://www.cilium.io/) is a networking solution that provides security and observability. The add-ons are configured and maintained by Managed Service for Kubernetes, to ensure consistent cluster operation. The configuration of these add-ons is not exposed via API and there are only limited options to customize them: * For CoreDNS, [use a custom ConfigMap](https://docs.nebius.com/kubernetes/networking/add-ons.md#coredns). * For Cilium, [edit the default ConfigMap](https://docs.nebius.com/kubernetes/networking/add-ons.md#cilium). Do not use `helm upgrade` to customize, as the changes it makes may be rolled back immediately. ## CoreDNS **CoreDNS** is a flexible DNS server for Kubernetes clusters. It replaces kube-dns to handle service discovery and name resolution within the cluster. To view the current CoreDNS configuration, run the following command: ```bash kubectl get configmap -n kube-system coredns -o yaml ``` Do not use `kubectl edit configmap` to make changes to this configuration, because the Managed Service for Kubernetes overwrites the default ConfigMap. Instead, use a custom ConfigMap: 1. Create a custom ConfigMap `coredns-custom.yaml`. It should contain the keys with the `.override` and `.server` extensions. * `.override` keys allow you to add plugins to the default [Server Block](https://coredns.io/manual/configuration/#server-blocks) of CoreDNS. You cannot override the parameters already specified in the default ConfigMap. * `.server` keys allow you to specify additional Server Blocks for CoreDNS. An example of a custom ConfigMap: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: coredns-custom namespace: kube-system data: log.override: | log custom.server: | example.io:8053 { forward . 8.8.8.8 } ``` This ConfigMap: * Adds the `log` plug-in to start logging at the system level. * Creates a new Server Block for the `example.io` domain. All requests directed to `example.io` at port 8053 should be forwarded to another DNS server at `8.8.8.8`. See the CoreDNS documentation for more information on the [Corefile parameters](https://coredns.io/2017/07/23/corefile-explained/) and the list of [available plug-ins](https://coredns.io/plugins/). 1. Apply the custom configuration: ```bash kubectl apply -f coredns-custom.yaml ``` ## Cilium **Cilium** ensures that only specific services and traffic can access certain [Pods](https://docs.nebius.com/kubernetes/components.md#pod). For example: * Some [Pods](https://docs.nebius.com/kubernetes/components.md#pod) might contain sensitive data, and Cilium enforces rules that only certain internal services or authorized users are allowed to access it. * If a [node](https://docs.nebius.com/kubernetes/components.md#node) requires restricted access, Cilium ensures that only internal services with proper credentials or traffic with specific labels are allowed. Also, Cilium provides observability into traffic between [Pods](https://docs.nebius.com/kubernetes/components.md#pod) and [nodes](https://docs.nebius.com/kubernetes/components.md#node), to optimize network paths and enforce network security policies. To make changes to Cilium configuration, run the following command: ```bash kubectl edit configmap -n kube-system cilium-config ``` > [accordion] See more information on ConfigMap parameters > > For more information about available ConfigMap parameters, see the Cilium documentation that matches your cluster's Cilium version: > > 1. Get the Cilium version used in your cluster: > ```bash > helm status -n kube-system cilium > ``` > > 2. In the command output, copy the link to the version documentation (remove `/gettinghelp` if present). > > 3. Open the following page for your version: > > ```bash > /network/kubernetes/configuration/#configmap-options > ``` > > For example, see [https://docs.cilium.io/en/v1.16/network/kubernetes/configuration/#configmap-options](https://docs.cilium.io/en/v1.16/network/kubernetes/configuration/#configmap-options) for Cilium version v1.16. ### Integration with Istio To make [Istio](https://istio.io/latest/) work with a Cilium-enabled Managed Kubernetes cluster, do the following: 1. [Install Istio](https://istio.io/latest/docs/setup/install/). 2. In the Cilium ConfigMap, set the `bpf-lb-sock-hostns-only` parameter to `true`: ```bash kubectl -n kube-system patch configmap cilium-config \ --type merge \ -p='{"data":{"bpf-lb-sock-hostns-only":"true"}}' kubectl -n kube-system rollout restart ds/cilium ``` 3. Wait until all Cilium Pods are restarted. > [accordion] See more information on Istio integration > > For more information on Istio integration, see the Cilium documentation that matches your cluster's Cilium version: > > 1. Get the Cilium version used in your cluster: > > ```bash > helm status -n kube-system cilium > ``` > > 2. In the command output, copy the link to the version documentation (remove `/gettinghelp` if present). > > 3. Open the following page for your version: > > ```bash > /network/servicemesh/istio/ > ``` > > For example, see [https://docs.cilium.io/en/v1.16/network/servicemesh/istio/](https://docs.cilium.io/en/v1.16/network/servicemesh/istio/) for Cilium version v1.16. ### Host firewall If your Managed Kubernetes cluster was created on or after April 17, 2025, [Cilium's host firewall](https://docs.cilium.io/en/latest/security/host-firewall/) is already enabled on the cluster. You can check the creation dates of your clusters in the [web console](https://console.nebius.com/mk8s). If your cluster is older, you need to enable the host firewall manually: 1. [Connect to the cluster](https://docs.nebius.com/kubernetes/connect.md). 2. Run the script that enables the host firewall: > [accordion] enable\_cilium\_host\_firewall.sh > > ```bash > #!/usr/bin/env bash > > set -euo pipefail > > # This script ensures that Cilium Host Firewall feature is enabled if all nodes run with the "set-name" feature. > > kubectl_args=("$@") > > cluster_name=$(kubectl "${kubectl_args[@]}" config current-context) > > current_value=$( > kubectl "${kubectl_args[@]}" get configmap cilium-config \ > -n kube-system \ > -o jsonpath='{.data.enableHostFirewall}' \ > 2>/dev/null || echo "" > ) > > if [[ "$current_value" == "true" ]]; then > echo "Cilium Host Firewall feature is already enabled in cluster \"$cluster_name\". Nothing to do." > exit 0 > fi > > echo "Verifying that every node has \"set-name\": \"eth0\" in network-data" > for node_ref in $(kubectl "${kubectl_args[@]}" get nodes -o name); do > echo "Inspecting $node_ref" > node_name="${node_ref#node/}" > output=$( > kubectl "${kubectl_args[@]}" debug "$node_ref" \ > --profile=general \ > --image=busybox \ > -i -- \ > chroot /host sh -c \ > 'if grep -q "\"set-name\": \"eth0\"" /var/lib/cloud/instance/network-config.json 2>/dev/null; then > echo OK > else > echo BAD > fi' 2>&1 \ > | grep -Eo 'OK|BAD' > ) > > echo "Cleaning up debug pod" > kubectl "${kubectl_args[@]}" delete $(kubectl "${kubectl_args[@]}" get pod -o name | grep node-debugger-"$node_name") 2>/dev/null > > if [[ "$output" != "OK" ]]; then > echo "ERROR: $node_ref does not have \"set-name\": \"eth0\" in network-data." > echo "Ensure that all node groups are upgraded with the following command:" > echo " nebius mk8s node-group upgrade --latest-infra-version" > exit 1 > fi > done > > echo -e "\nAll nodes verified. Enabling Cilium Host Firewall" > kubectl "${kubectl_args[@]}" patch configmap cilium-config -n kube-system \ > --type=merge \ > --patch $'data:\n enable-host-firewall: "true"' > > echo "Patched cilium-config ConfigMap; new enable-host-firewall value:" > kubectl "${kubectl_args[@]}" get configmap cilium-config -n kube-system \ > -o yaml \ > | sed -n 's/^[[:space:]]*enable-host-firewall:.*/&/p' > > echo "Restarting Cilium DaemonSet to pick up the new config" > kubectl "${kubectl_args[@]}" -n kube-system rollout restart daemonset cilium > > echo -e "\nDone" > ``` ## How the add-ons affect autoscaling node groups Both CoreDNS and Cilium can run on one node, but it's optimal to run on two. If your cluster has at least one node group with [autoscaling](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md), this node group may scale up just to ensure that there are two nodes to run CoreDNS and Cilium, even if there is no workload. > [!TIP] > > If you have GPU node groups in your cluster, also create a CPU node group with at least two nodes (or with autoscaling). In this case, when there are no tasks to perform, CoreDNS and Cilium can run on CPU nodes, so that the GPU node group can scale down and save you the costs. # Setting up NodeLocal DNSCache with Cilium network policy controller in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/networking/nodelocal-dns-cache.md To improve the DNS performance in a Managed Service for Kubernetes cluster, you can use the [NodeLocal DNSCache](https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/) feature. With this feature, a DNS caching agent runs on each cluster node to resolve DNS requests locally on the same nodes as the Pods. In this tutorial, you will learn to configure a NodeLocal DNSCache for the [Cilium network policy controller](https://docs.cilium.io/en/stable/) by using [local redirect policy](https://docs.cilium.io/en/stable/network/kubernetes/local-redirect-policy/). ## Costs Nebius AI Cloud charges you only for running a Managed Kubernetes cluster. For more details, see the [Managed Kubernetes pricing](https://docs.nebius.com/kubernetes/resources/pricing.md). ## Prerequisites * [Create a Managed Service for Kubernetes cluster](https://docs.nebius.com/kubernetes/quickstart.md#create-a-cluster-and-a-node-group) if you have not done it before. * [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [connect to the cluster](https://docs.nebius.com/kubernetes/quickstart.md#connect-to-the-cluster). ## Steps ### Prepare manifests for NodeLocal DNSCache and local redirect policy 1. Retrieve the service IP address for `coredns`: ```bash kubectl get svc coredns -n kube-system -o jsonpath={.spec.clusterIP} ``` 2. Create a manifest file named `node-local-dns.yaml`. In the `DaemonSet` specification (`spec.template.spec.containers.args`), replace the coredns\_IP\_address with the IP address of the `coredns` service you obtained in the previous step. > [accordion] node-local-dns.yaml > > ```yaml > --- > apiVersion: v1 > kind: ServiceAccount > metadata: > name: node-local-dns > namespace: kube-system > --- > apiVersion: v1 > kind: Service > metadata: > name: node-local-dns-upstream > namespace: kube-system > labels: > k8s-app: node-local-dns-upstream > kubernetes.io/name: "NodeLocalDnsUpstream" > kubernetes.io/cluster-service: "true" > spec: > ports: > - name: dns > port: 53 > protocol: UDP > targetPort: 53 > - name: dns-tcp > port: 53 > protocol: TCP > targetPort: 53 > selector: > k8s-app: coredns > --- > apiVersion: v1 > kind: ConfigMap > metadata: > name: node-local-dns > namespace: kube-system > data: > Corefile: | > cluster.local:53 { > errors > cache { > success 9984 30 > denial 9984 5 > } > reload > loop > bind 0.0.0.0 > forward . __PILLAR__CLUSTER__DNS__ { > prefer_udp > } > prometheus :9253 > health > } > in-addr.arpa:53 { > errors > cache 30 > reload > loop > bind 0.0.0.0 > forward . __PILLAR__CLUSTER__DNS__ { > prefer_udp > } > prometheus :9253 > } > ip6.arpa:53 { > errors > cache 30 > reload > loop > bind 0.0.0.0 > forward . __PILLAR__CLUSTER__DNS__ { > prefer_udp > } > prometheus :9253 > } > .:53 { > errors > cache 30 > reload > loop > bind 0.0.0.0 > forward . __PILLAR__CLUSTER__DNS__ { > prefer_udp > } > prometheus :9253 > } > --- > apiVersion: apps/v1 > kind: DaemonSet > metadata: > name: node-local-dns > namespace: kube-system > labels: > k8s-app: node-local-dns > spec: > updateStrategy: > rollingUpdate: > maxUnavailable: 10% > selector: > matchLabels: > k8s-app: node-local-dns > template: > metadata: > labels: > k8s-app: node-local-dns > annotations: > prometheus.io/port: "9253" > prometheus.io/scrape: "true" > spec: > priorityClassName: system-node-critical > serviceAccountName: node-local-dns > dnsPolicy: Default # Don't use cluster DNS. > tolerations: > - key: "CriticalAddonsOnly" > operator: "Exists" > - effect: "NoExecute" > operator: "Exists" > - effect: "NoSchedule" > operator: "Exists" > containers: > - name: node-cache > image: registry.k8s.io/dns/k8s-dns-node-cache:1.24.0 > resources: > requests: > cpu: 25m > memory: 5Mi > args: [ "-localip", "coredns_IP_address", > "-conf", "/etc/Corefile", > "-upstreamsvc", "node-local-dns-upstream", > "-skipteardown=true", > "-setupinterface=false", > "-setupiptables=false" ] > securityContext: > privileged: true > ports: > - containerPort: 53 > name: udp-53 > protocol: UDP > - containerPort: 53 > name: tcp-53 > protocol: TCP > - containerPort: 9253 > name: metrics > protocol: TCP > livenessProbe: > httpGet: > path: /health > port: 8080 > initialDelaySeconds: 60 > timeoutSeconds: 5 > volumeMounts: > - mountPath: /run/xtables.lock > name: xtables-lock > readOnly: false > - name: config-volume > mountPath: /etc/coredns > - name: kube-dns-config > mountPath: /etc/kube-dns > volumes: > - name: xtables-lock > hostPath: > path: /run/xtables.lock > type: FileOrCreate > - name: kube-dns-config > configMap: > name: kube-dns > optional: true > - name: config-volume > configMap: > name: node-local-dns > items: > - key: Corefile > path: Corefile.base > ``` This manifest declares a DaemonSet for NodeLocal DNSCache and a service account, Service, and ConfigMap needed for its operation. 3. Create a manifest file named `node-local-dns-lrp.yaml`. > [accordion] node-local-dns-lrp.yaml > > ```yaml > --- > apiVersion: "cilium.io/v2" > kind: CiliumLocalRedirectPolicy > metadata: > name: "node-local-dns" > namespace: kube-system > spec: > redirectFrontend: > serviceMatcher: > serviceName: coredns > namespace: kube-system > toPorts: > - port: "53" > name: udp-53 > protocol: UDP > - port: "53" > name: tcp-53 > protocol: TCP > redirectBackend: > localEndpointSelector: > matchLabels: > k8s-app: node-local-dns > toPorts: > - port: "53" > name: udp-53 > protocol: UDP > - port: "53" > name: tcp-53 > protocol: TCP > ``` This manifest declares a local redirect policy that directs DNS requests at the `node-local-dns` DaemonSet for resolution. ### Apply the manifests and create resources 1. Create resources for NodeLocal DNSCache: ```bash kubectl apply -f node-local-dns.yaml ``` 2. Create the local redirect policy: ```bash kubectl apply -f node-local-dns-lrp.yaml ``` ### Test NodeLocal DNSCache #### Create a test environment 1. Create a manifest file named `dnsutils.yaml`. > [accordion] dnsutils.yaml > > ```yaml > --- > apiVersion: v1 > kind: Pod > metadata: > name: dnsutils > namespace: default > spec: > containers: > - name: dnsutils > image: registry.k8s.io/e2e-test-images/agnhost:2.9 > imagePullPolicy: IfNotPresent > restartPolicy: Always > ``` 2. Launch the `dnsutils` Pod: ```bash kubectl apply -f dnsutils.yaml ``` 3. Find out which node is running the `dnsutils` Pod: ```bash kubectl get pod dnsutils -o wide ``` The result looks like the following: ```bash NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES dnsutils 1/1 Running 0 16s 10.57.100.14 computeinstance-xxxxxxxxx ``` Once the Pod status is `Running`, get the ID of the node from the `NODE` column. 4. Use the ID of the node to find out the IP address of the Pod that runs NodeLocal DNSCache on this node: ```bash export POD_IP_ADDRESS=$(kubectl get pod -o wide -n kube-system | grep 'node-local.*' | awk '{print $6}') ``` #### Run tests 1. Get the values of the metrics for DNS requests before testing: ```bash kubectl exec -ti dnsutils -- curl http://$POD_IP_ADDRESS:9253/metrics | grep coredns_dns_requests_total ``` The result looks like the following: ```bash # HELP coredns_dns_requests_total Counter of DNS requests made per zone, protocol and family. # TYPE coredns_dns_requests_total counter coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="cluster.local."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="in-addr.arpa."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="ip6.arpa."} 1 ``` 2. Run several DNS requests: ```bash kubectl exec -ti dnsutils -- nslookup kubernetes && kubectl exec -ti dnsutils -- nslookup kubernetes.default && kubectl exec -ti dnsutils -- nslookup nebius.com ``` 3. Now check the metrics again: ```bash kubectl exec -ti dnsutils -- curl http://$POD_IP_ADDRESS:9253/metrics | grep coredns_dns_requests_total ``` The values of the metrics should increase, for example: ```bash # HELP coredns_dns_requests_total Counter of DNS requests made per zone, protocol and family. # TYPE coredns_dns_requests_total counter coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="A",view="",zone="."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="A",view="",zone="cluster.local."} 6 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="AAAA",view="",zone="."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="AAAA",view="",zone="cluster.local."} 2 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="cluster.local."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="in-addr.arpa."} 1 coredns_dns_requests_total{family="1",proto="udp",server="dns://0.0.0.0:53",type="other",view="",zone="ip6.arpa."} 1 ``` If the tests don't show the expected metrics increase, there may be an error in your configuration. #### Troubleshoot issues and inspect logs * Check that the local redirect policy is enabled in the Cilium configuration: ```bash kubectl get configmap cilium-config -n kube-system -o yaml | grep redirect ``` The expected result is: ```bash enable-local-redirect-policy: "true" ``` * Check that the `node-local-dns` local redirect policy declared [earlier](https://docs.nebius.com/kubernetes/networking/nodelocal-dns-cache.md#prepare-manifests-for-nodelocal-dnscache-and-local-redirect-policy) is properly applied: ```bash kubectl get ciliumlocalredirectpolicies -A ``` The expected result is something like the following: ```bash NAMESPACE NAME AGE kube-system node-local-dns 3h18m ``` * Check the local redirect policy rules on any of the Cilium Pods: * Get the list of Cilium Pods: ```bash kubectl -n kube-system get pod | grep '^cilium-[^o]' ``` * Get the local redirect policy rules on one of these Pods: ```bash kubectl exec -it -n kube-system -- cilium-dbg lrp list ``` The expected result is something like the following: ```bash LRP namespace LRP name FrontendType Matching Service kube-system nodelocaldns clusterIP + named ports kube-system/coredns | coredns_IP_address:53/UDP -> 10.57.43.185:53(kube-system/node-local-dns-2cdjt), | coredns_IP_address:53/TCP -> 10.57.43.185:53(kube-system/node-local-dns-2cdjt), ``` * Check the contents of the `resolv.conf` file in the `dnsutils` Pod: ```bash kubectl exec -ti dnsutils -- cat /etc/resolv.conf ``` The expected result is something like the following: ```bash search default.svc.cluster.local svc.cluster.local cluster.local nameserver coredns_IP_address options ndots:5 ``` * Check DNS logs. To enable logs for Pods running DNS services, create a custom ConfigMap `coredns-custom.yaml` that contains a `log.override` key: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: coredns-custom namespace: kube-system data: log.override: | log ``` Apply the custom ConfigMap: ```bash kubectl apply -f coredns-custom.yaml ``` To enable logs for the `node-local-dns` service, edit the ConfigMap: ```bash kubectl -n kube-system edit configmap node-local-dns ``` Add the `log` config parameter within the `Corefile` section: ```bash .:53 { log errors ``` Now you can get the logs of the Pods running DNS services: ```bash kubectl logs --namespace=kube-system -l k8s-app=coredns -f kubectl logs --namespace=kube-system -l k8s-app=node-local-dns -f ``` #### Delete testing resources Delete the `dnsutils` Pod: ```bash kubectl delete -f dnsutils.yaml ``` ## How to disable NodeLocal DNSCache If you no longer want to use NodeLocal DNSCache in your cluster, you can disable it: 1. Delete the local redirect policy: ```bash kubectl delete -f node-local-dns-lrp.yaml ``` 2. Delete the resources you created for NodeLocal DNSCache: ```bash kubectl delete -f node-local-dns.yaml ``` ## How to delete the created resources\\ The Managed Kubernetes cluster you used in this tutorial is chargeable. If you do not need it, [delete this resource](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-delete-clusters), so Nebius AI Cloud does not charge for it. # Authentication with external OIDC providers in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/authentication/oidc-providers.md By default, users access the Kubernetes API of a Managed Service for Kubernetes cluster with their Nebius AI Cloud credentials. You can also let users sign in with an external OpenID Connect (OIDC) identity provider (IdP), such as Okta, Microsoft Entra ID, or Keycloak. Users authorized via IdP tokens don't need Nebius AI Cloud accounts to work with the cluster: you manage their permissions with Kubernetes role-based access control (RBAC). Authentication with Nebius AI Cloud credentials keeps working after you add an OIDC provider. If your cluster administrator gave you a kubeconfig file for signing in with an IdP, see [How to sign in to the cluster](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-sign-in-to-the-cluster). > [!NOTE] > > This article covers tokens issued for the cluster by an **external IdP**. To let external systems verify tokens that the cluster issues to its workloads, see [Using an OIDC public endpoint in Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/networking/oidc-public-endpoint.md). ## How OIDC authentication works You set up OIDC authentication in three places: * **In the IdP**, you register a client application for the cluster and assign users and groups to it. The IdP signs users in and issues ID tokens to them. * **In the cluster configuration in Nebius AI Cloud**, you add the IdP as an OIDC provider. The provider configuration tells the cluster which tokens to trust and how to turn them into Kubernetes users and groups. * **In the cluster itself**, you grant permissions to these users and groups with Kubernetes RBAC. The IdP and Nebius AI Cloud Identity and Access Management (IAM) don't grant any permissions in the cluster. When a user works with the cluster: 1. The user signs in to the IdP and gets an ID token, for example, with the kubelogin plug-in for kubectl. 2. The client, for example, kubectl, sends the token to the Kubernetes API server of the cluster. 3. The API server verifies the token. It gets the public keys of the IdP over HTTPS and checks the token's signature, issuer, and audience. Then it checks the token against the validation rules of the provider. 4. The API server maps the token to a Kubernetes username and groups according to the claim mappings of the provider. 5. Kubernetes RBAC decides what the user can do. A new user has no permissions until you grant them. The issuer URL of the IdP must be publicly accessible over HTTPS. ## Claims An ID token contains a set of *claims*: name-value pairs that the IdP states about the user and the token. For example, the payload of an ID token can look like this: ```json { "iss": "https://idp.example.com", "aud": "kubernetes", "sub": "00u1a2b3c4", "exp": 1767225600, "email": "alice@example.com", "email_verified": true, "groups": ["k8s-engineering"], "team": "platform" } ``` * `iss`: issuer, the IdP that issued the token. * `aud`: audience, the client application that the token is issued for. Most IdPs set it to the client ID of the application. * `sub`: unique ID of the user in the IdP. * `exp`: time when the token expires. * `email`, `email_verified`, `groups`, and `team`: user description. The specific claims contained in the token and their names depend on the identity provider (IdP) and its settings. The cluster uses claims to check the token and to get a Kubernetes username and groups from it. ## Provider configuration You pass provider configurations to the cluster when you add or update OIDC providers. For instructions, see [How to add an OIDC provider](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-add-an-oidc-provider). A minimal provider configuration contains the provider name, the issuer of tokens, and the claim mappings: ```json { "name": "my-idp", "issuer": { "url": "https://idp.example.com", "audiences": ["kubernetes"] }, "claim_mappings": { "username": {"claim": "email", "prefix": "oidc:"}, "groups": {"claim": "groups", "prefix": "oidc:"} } } ``` The following example shows the configuration of a provider with all parameters: ```json { "name": "my-idp", "issuer": { "url": "https://idp.example.com", "audiences": ["kubernetes"], "discovery_url": "https://idp.example.com/.well-known/openid-configuration", "certificate_authority": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----" }, "claim_mappings": { "username": {"claim": "email", "prefix": "oidc:"}, "groups": {"claim": "groups", "prefix": "oidc:"} }, "claim_validation_rules": [ {"claim": "team", "required_value": "platform"} ], "user_validation_rules": [ { "expression": "user.groups.exists(g, g == \"oidc:k8s-engineering\")", "message": "The user must be in the oidc:k8s-engineering group" } ] } ``` | Parameter | Required or optional | Description | | - | - | - | | `name` | Required | Provider name. Must be unique within the cluster. It doesn't become part of usernames or group names. | | `issuer.url` | Required | Issuer URL of the IdP. It must match the `iss` claim of tokens and the `issuer` field of the IdP's discovery document. The URL must use HTTPS, must not contain a query or a fragment, and must be unique within the cluster. For the issuer URL formats of popular IdPs, see [Issuer URLs](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#issuer-urls). The issuer URL can't point to the cluster itself, for example, to its API server endpoints or its [OIDC public endpoint](https://docs.nebius.com/kubernetes/networking/oidc-public-endpoint.md). The cluster already trusts the tokens that it issues to its ServiceAccounts. | | `issuer.audiences` | Required | Token audiences that the cluster accepts, usually the client ID of the application that you registered in the IdP. Specify at least one. The values must be unique. A token is accepted if its `aud` claim contains at least one of them. | | `claim_mappings.username` | Required | How to get the Kubernetes username from the token claims. For more information, see [Claim mappings](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#claim-mappings). | | `claim_mappings.groups` | Optional | How to get Kubernetes groups from the token claims. If you don't specify it, users from this provider have no groups from the token. | | `issuer.discovery_url` | Optional | URL of the discovery document, if it differs from `/.well-known/openid-configuration`. Must differ from `issuer.url`. The `issuer` field of the document must still match `issuer.url`. | | `issuer.certificate_authority` | Optional | PEM bundle of certificate authorities that the API server trusts when it gets the discovery document and the public keys of the IdP. If you don't specify it, the API server uses the system trust store. | | `claim_validation_rules` | Optional | Rules that the token claims must pass. For more information, see [Validation rules](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#validation-rules). | | `user_validation_rules` | Optional | Rules that the mapped username and groups must pass. For more information, see [Validation rules](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#validation-rules). | The cluster checks the configuration when you add or update providers and rejects invalid configurations. During this check, the cluster doesn't contact the IdP, so a configuration can be accepted even if the IdP is unreachable. ### Issuer URLs The following table lists the issuer URL formats of popular IdPs and their documentation on registering applications: | IdP | Issuer URL | Documentation | | - | - | - | | Okta | `https:///oauth2/default` for the default custom authorization server | [Create OIDC app integrations](https://help.okta.com/en-us/content/topics/apps/apps_app_integration_wizard_oidc.htm) | | Microsoft Entra ID | `https://login.microsoftonline.com//v2.0` | [Register an application in Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) | | Google | `https://accounts.google.com` | [OpenID Connect](https://developers.google.com/identity/openid-connect/openid-connect) | | Keycloak | `https:///realms/` | [Managing OpenID Connect clients](https://www.keycloak.org/docs/latest/server_admin/#_oidc_clients) | ### Claim mappings *Claim mappings* tell the cluster which claims to use as the Kubernetes username and groups. For example, with the configuration above, the user `alice@example.com` from the `k8s-engineering` IdP group becomes the user `oidc:alice@example.com` in the `oidc:k8s-engineering` group. You use these mapped names in RBAC bindings. Map a claim in one of the following ways: * By claim name: `{"claim": "email", "prefix": "oidc:"}`. Kubernetes adds the prefix to the claim value. The prefix is optional. Use a prefix to keep users and groups from different providers apart. * By a [Common Expression Language (CEL)](https://kubernetes.io/docs/reference/using-api/cel/) expression: `{"expression": "\"oidc:\" + claims.email"}`. The expression can use any claims of the token. An expression mapping can't have a prefix, not even an empty one. Claim names and values depend on the IdP. Check which claims the ID tokens of your IdP contain and adjust the claim mappings if needed. If you map the username from the `email` claim by its name, Kubernetes rejects tokens in which the `email_verified` claim is `false`. Tokens without the `email_verified` claim are accepted. If an expression uses `claims.email`, the configuration must also check `email_verified`, for example, with a claim validation rule. ### Reserved names The following prefixes are reserved: * `system:`: Kubernetes reserves it for its own users and groups. * `nebius:`: Nebius AI Cloud reserves it for users who access the cluster with Nebius AI Cloud credentials. These users are in groups such as `nebius:viewer`, `nebius:editor`, and `nebius:admin`, and these groups already have permissions in the cluster. A prefix in a claim mapping can't start with `system:` or `nebius:`. The cluster rejects such a configuration. A token is rejected if its mapped username or any of its mapped groups starts with `system:`. This check is always on, and you can't turn it off. For example, if you don't use a group prefix, a member of an IdP group named `system:masters` can't sign in. > [!WARNING] > > Use a group prefix, for example, `oidc:`. Without a prefix, members of an IdP group named `nebius:admin` get the same permissions in the cluster as Nebius AI Cloud admins. ### Validation rules By default, the cluster accepts any valid token from the provider. Validation rules restrict which tokens and users the cluster accepts, for example, only users from a certain team or group. You add the rules to the provider configuration, in the `claim_validation_rules` and `user_validation_rules` parameters. A token is accepted only if it passes all rules. The API server checks the rules in the following order: 1. **Claim validation rules** check the token claims before mapping. Each rule uses one of the following forms: * Exact match: `{"claim": "", "required_value": ""}`. The claim must exist and equal the value. If you omit `required_value`, the claim must be an empty string. This form doesn't support a message. * CEL expression: `{"expression": "", "message": ""}`. The expression must evaluate to `true`. 2. **User validation rules** check the mapped user after mapping: `{"expression": "", "message": ""}`. The expression can use `user.username` and `user.groups`. For example, the rules in the [configuration with all parameters](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#provider-configuration) accept only tokens with the `team` claim set to `platform`, and only users in the `oidc:k8s-engineering` group. A user who doesn't pass a rule gets the Unauthorized error. ## How the cluster updates providers When you update the providers, the cluster replaces the whole list of providers with the list that you pass. The following rules apply: * Pass the complete list of providers, including the providers that you don't change. The cluster removes providers that aren't in the list. * Specify all parameters of each provider. The cluster doesn't keep parameters from the current configuration, so if you omit an optional parameter, the provider no longer has it. * Updates of other cluster parameters don't change the providers. * When the update operation completes, the new configuration is active. For instructions, see [How to update OIDC providers](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-update-oidc-providers). ## See also * [How to configure external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md) * [Troubleshooting authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md) * [Configuration via configuration file](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#api-server-authn-config-file) in the Kubernetes documentation # How to configure external OIDC providers in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md Add an external OpenID Connect (OIDC) identity provider (IdP) to a Managed Service for Kubernetes cluster to let users sign in to the cluster with the IdP. For an overview of how OIDC authentication works and what the provider parameters mean, see [Authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md). ## Prerequisites 1. In your IdP, register an OIDC client application for the cluster and assign the users and groups who need access to the cluster. For the documentation of popular IdPs, see [Issuer URLs](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#issuer-urls). Note the client ID of the application and the issuer URL of the IdP. This guide uses [kubelogin](https://github.com/int128/kubelogin), a kubectl plug-in, to get ID tokens from the IdP. kubelogin is optional: users can get tokens with any other client. If users sign in with kubelogin, also configure the application: * Allow the authorization code grant type. * Add `http://localhost:8000` as a redirect URI. kubelogin listens on this address by default. 2. To grant access by IdP group, configure the IdP to add a `groups` claim to ID tokens. For more information about claims, see [Claims](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#claims). 3. Make sure that the issuer URL is publicly accessible over HTTPS. The API server of the cluster uses this URL to get the discovery document and the public keys of the IdP. 4. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. 5. To manage the cluster with Terraform, [install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. The cluster must be managed by Terraform: create it with Terraform or [import it](https://developer.hashicorp.com/terraform/cli/import) into your configuration. 6. [Create a Managed Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md) with a public endpoint, or use an existing one. Users who sign in with the IdP connect to the cluster through its public endpoint. You can also add an OIDC provider when you create a cluster. For more information, see [How to add an OIDC provider](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-add-an-oidc-provider). 7. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [connect to the cluster](https://docs.nebius.com/kubernetes/connect.md) with your Nebius AI Cloud credentials. You need this access to grant permissions to OIDC users. If OIDC users can't sign in because of a configuration error, you can still use this access to fix it. ## How to view OIDC providers To see the OIDC providers of a cluster and their parameters, run: ```bash nebius mk8s cluster get \ --id \ --format jsonpath='{.spec.control_plane.authentication}' ``` The command prints the configuration in the JSON format, for example, `{"oidc":[{"name":"my-idp",...}]}`. The value of `oidc` is the list of providers. If the cluster has no providers, the output is `{}`. ## How to add an OIDC provider > [tab] CLI > > * To add a provider when you create a cluster, run: > > ```bash > nebius mk8s cluster create \ > --name \ > --control-plane-version 1.36 \ > --control-plane-subnet-id \ > --control-plane-endpoints-public-endpoint=true \ > --control-plane-authentication-oidc '[{ > "name": "my-idp", > "issuer": { > "url": "", > "audiences": [""] > }, > "claim_mappings": { > "username": {"claim": "email", "prefix": "oidc:"}, > "groups": {"claim": "groups", "prefix": "oidc:"} > } > }]' > ``` > > * To add a provider to an existing cluster that has no providers, run: > > ```bash > nebius mk8s cluster update \ > --id \ > --control-plane-authentication-oidc '[{ > "name": "my-idp", > "issuer": { > "url": "", > "audiences": [""] > }, > "claim_mappings": { > "username": {"claim": "email", "prefix": "oidc:"}, > "groups": {"claim": "groups", "prefix": "oidc:"} > } > }]' > ``` > > The command sets the complete list of providers for the cluster. If the cluster already has providers, see [How to update OIDC providers](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-update-oidc-providers). > > The commands contain the following parameters: > > * `--name`: Cluster name. > * `--control-plane-subnet-id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). > * `--control-plane-endpoints-public-endpoint`: Creates a public endpoint. Users who sign in with the IdP connect to the cluster through it. > * `--control-plane-authentication-oidc`: List of OIDC providers with the following parameters: > > * `name`: Provider name, for example, `my-idp`. > * `issuer.url`: Issuer URL of your IdP. > * `issuer.audiences`: Client ID of the application that you registered in the IdP. > * `claim_mappings.username`: The `email` claim with the `oidc:` prefix as the username. > * `claim_mappings.groups`: The `groups` claim with the `oidc:` prefix as the groups. > [tab] Terraform > > 1. Create a configuration file with a cluster that has an OIDC provider: > > ```hcl > resource "nebius_mk8s_v1_cluster" "oidc_cluster" { > name = "" > parent_id = "" > control_plane = { > version = "1.36" > subnet_id = "" > endpoints = { > public_endpoint = {} > } > authentication = { > oidc = [ > { > name = "my-idp" > issuer = { > url = "" > audiences = [""] > } > claim_mappings = { > username = { > claim = "email" > prefix = "oidc:" > } > groups = { > claim = "groups" > prefix = "oidc:" > } > } > } > ] > } > } > } > ``` > > To add a provider to an existing cluster, add the `authentication` block to `control_plane` in the `nebius_mk8s_v1_cluster` resource of the cluster. > > The configuration contains the following parameters: > > * `name`: Cluster name. > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > * `control_plane.subnet_id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). > * `control_plane.authentication.oidc`: List of OIDC providers with the following parameters: > > * `name`: Provider name, for example, `my-idp`. > * `issuer.url`: Issuer URL of your IdP. > * `issuer.audiences`: Client ID of the application that you registered in the IdP. > * `claim_mappings.username`: The `email` claim with the `oidc:` prefix as the username. > * `claim_mappings.groups`: The `groups` claim with the `oidc:` prefix as the groups. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` With this configuration, the user `alice@example.com` from the `k8s-engineering` IdP group becomes the user `oidc:alice@example.com` in the `oidc:k8s-engineering` group. For all provider parameters, see [Provider configuration](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#provider-configuration). When the operation completes, the cluster starts accepting tokens from the provider. To check the configuration, see [How to view OIDC providers](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-view-oidc-providers). ## How to grant access with RBAC OIDC users are authenticated but have no permissions until you bind them to Kubernetes roles with role-based access control (RBAC). Create the bindings with your Nebius AI Cloud credentials. Use the mapped names, including the prefixes. For example, to give read-only access to all members of the `k8s-engineering` IdP group: 1. Create an `oidc-engineering-view.yaml` file with a ClusterRoleBinding: ```yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: oidc-engineering-view roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: view subjects: - kind: Group apiGroup: rbac.authorization.k8s.io name: oidc:k8s-engineering ``` To bind a single user, use `kind: User` and the mapped username, for example, `oidc:alice@example.com`. 2. Apply the file: ```bash kubectl apply -f oidc-engineering-view.yaml ``` For more information, see [Using RBAC Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) in the Kubernetes documentation. ## How to prepare a kubeconfig file for users Users who sign in with the IdP don't need Nebius AI Cloud credentials. To connect to the cluster, they only need its API server endpoint and its certificate authority (CA) certificate. You get both with your Nebius AI Cloud credentials, put them into a kubeconfig file, and give the file to the users. The following steps create a kubeconfig file in which kubectl gets ID tokens from the IdP through kubelogin. For the settings of the client application that kubelogin needs, see [Prerequisites](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#prerequisites). kubelogin is optional. Users can get ID tokens with any other client and send them to the API server in the `Authorization: Bearer ` header of requests. In this case, configure the kubeconfig file and the client application according to the documentation of that client. 1. Get the public endpoint of the cluster: ```bash nebius mk8s cluster get \ --id \ --format jsonpath='{.status.control_plane.endpoints.public_endpoint}' ``` 2. Save the CA certificate of the cluster to the `ca.crt` file: ```bash nebius mk8s cluster get \ --id \ --format jsonpath='{.status.control_plane.auth.cluster_ca_certificate}' \ > ca.crt ``` 3. Create a kubeconfig file, `oidc.kubeconfig`, with the cluster and a user that gets tokens from the IdP through kubelogin: ```bash kubectl config set-cluster \ --kubeconfig=oidc.kubeconfig \ --server= \ --certificate-authority=ca.crt \ --embed-certs kubectl config set-credentials oidc \ --kubeconfig=oidc.kubeconfig \ --exec-api-version=client.authentication.k8s.io/v1 \ --exec-interactive-mode=IfAvailable \ --exec-command=kubectl \ --exec-arg=oidc-login \ --exec-arg=get-token \ --exec-arg=--oidc-issuer-url= \ --exec-arg=--oidc-client-id= \ --exec-arg=--oidc-extra-scope=email kubectl config set-context oidc \ --kubeconfig=oidc.kubeconfig \ --cluster= \ --user=oidc kubectl config use-context oidc --kubeconfig=oidc.kubeconfig ``` The commands contain the following parameters: * `--server`: Public endpoint of the cluster that you got earlier. * `--oidc-issuer-url`: Issuer URL of your IdP. * `--oidc-client-id`: Client ID of the application that you registered in the IdP. * ``: Name of the cluster in the kubeconfig file, for example, the name of the Managed Kubernetes cluster. The `--oidc-extra-scope=email` parameter requests the `email` claim. If your IdP adds the `groups` claim to ID tokens only for a separate scope, request it as well, for example, with `--exec-arg=--oidc-extra-scope=groups`. 4. Give the `oidc.kubeconfig` file to the users. ## How to sign in to the cluster If your cluster administrator gave you a kubeconfig file for signing in with an IdP through kubelogin, as described in [How to prepare a kubeconfig file for users](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-prepare-a-kubeconfig-file-for-users), follow these steps on your machine. You don't need Nebius AI Cloud credentials. If your administrator set up a different client, follow their instructions. 1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl). 2. Install [kubelogin](https://github.com/int128/kubelogin), the kubectl plug-in for signing in with an IdP, by using [krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/): ```bash kubectl krew install oidc-login ``` 3. Check which user you're signed in as: ```bash kubectl auth whoami --kubeconfig=oidc.kubeconfig ``` A browser opens with the sign-in page of your IdP. After you sign in, the output shows the mapped username and groups, for example: ```text ATTRIBUTE VALUE Username oidc:alice@example.com Groups [oidc:k8s-engineering system:authenticated] ``` kubelogin caches the token and gets a new one when it expires. To use the file in every kubectl command without the `--kubeconfig` parameter, set the `KUBECONFIG` environment variable to its path. ## How to update OIDC providers The update replaces the whole list of providers with the list that you pass. For more information, see [How the cluster updates providers](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#how-the-cluster-updates-providers). > [tab] CLI > > 1. [Get the current configuration](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-view-oidc-providers) and copy the value of `oidc`. > > 2. Pass the complete edited list, including the providers and parameters that you don't change. For example, to add a second provider, run: > > ```bash > nebius mk8s cluster update \ > --id \ > --control-plane-authentication-oidc '[ > { > "name": "my-idp", > "issuer": { > "url": "", > "audiences": [""] > }, > "claim_mappings": { > "username": {"claim": "email", "prefix": "oidc:"}, > "groups": {"claim": "groups", "prefix": "oidc:"} > } > }, > { > "name": "ci-idp", > "issuer": { > "url": "", > "audiences": [""] > }, > "claim_mappings": { > "username": {"claim": "sub", "prefix": "ci:"} > } > } > ]' > ``` > > The second provider in this example has the following parameters: > > * `name`: Provider name, for example, `ci-idp`. > * `issuer.url`: Issuer URL of the second IdP. > * `issuer.audiences`: Client ID of the application that you registered in the second IdP. > * `claim_mappings.username`: The `sub` claim with the `ci:` prefix as the username. The provider has no groups mapping. > > To remove a provider, pass the list without it. > > 3. [Check the configuration](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-view-oidc-providers). > > You can also edit the configuration in a text editor. The following command opens the cluster specification. Change the `spec.control_plane.authentication.oidc` parameter and save the file: > > ```bash > nebius mk8s cluster edit --id > ``` > [tab] Terraform > > 1. In the `nebius_mk8s_v1_cluster` resource of the cluster, change the `control_plane.authentication.oidc` list: > > * To add a provider, add an element to the list. > * To change a provider, change its element. > * To remove a provider, delete its element. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > 4. [Check the configuration](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-view-oidc-providers). ### How to change a claim mapping The following example maps the username with an expression instead of the `email` claim in a cluster that has only the provider from [How to add an OIDC provider](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-add-an-oidc-provider). If the cluster has other providers, include them in the list. Otherwise, the update removes them. > [tab] CLI > > ```bash > nebius mk8s cluster update \ > --id \ > --control-plane-authentication-oidc '[{ > "name": "my-idp", > "issuer": { > "url": "", > "audiences": [""] > }, > "claim_mappings": { > "username": {"expression": "\"oidc:\" + claims.email"}, > "groups": {"claim": "groups", "prefix": "oidc:"} > }, > "claim_validation_rules": [{ > "expression": "claims.?email_verified.orValue(true) == true", > "message": "The email address must be verified" > }] > }]' > ``` > > In the command, specify the same values as in [How to add an OIDC provider](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-add-an-oidc-provider). > [tab] Terraform > > 1. In the `username` block of the provider, replace `claim` and `prefix` with `expression`, and add a claim validation rule: > > ```hcl > resource "nebius_mk8s_v1_cluster" "oidc_cluster" { > name = "" > parent_id = "" > control_plane = { > version = "1.36" > subnet_id = "" > endpoints = { > public_endpoint = {} > } > authentication = { > oidc = [ > { > name = "my-idp" > issuer = { > url = "" > audiences = [""] > } > claim_mappings = { > username = { > expression = "\"oidc:\" + claims.email" > } > groups = { > claim = "groups" > prefix = "oidc:" > } > } > claim_validation_rules = [ > { > expression = "claims.?email_verified.orValue(true) == true" > message = "The email address must be verified" > } > ] > } > ] > } > } > } > ``` > > In the configuration, specify the same values as in [How to add an OIDC provider](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-add-an-oidc-provider). > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` The claim validation rule in this example checks `email_verified`, because the expression uses `claims.email`. For more information, see [Claim mappings](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#claim-mappings). ## How to remove all OIDC providers > [tab] CLI > > Pass an empty list: > > ```bash > nebius mk8s cluster update \ > --id \ > --control-plane-authentication-oidc '[]' > ``` > [tab] Terraform > > 1. In the `nebius_mk8s_v1_cluster` resource of the cluster, delete the `authentication` block from `control_plane`. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > 4. [Check the configuration](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-view-oidc-providers). After you remove the providers, users can still access the cluster with their Nebius AI Cloud credentials. ## See also * [Authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md) * [Troubleshooting authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md) * [How to connect to Managed Service for Kubernetes® clusters using kubectl](https://docs.nebius.com/kubernetes/connect.md) * [kubelogin](https://github.com/int128/kubelogin) on GitHub # Troubleshooting authentication with external OIDC providers in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md If users can't sign in to a Managed Service for Kubernetes cluster with an external OpenID Connect (OIDC) identity provider (IdP), or you can't add or update a provider, check the causes below. For an overview of how OIDC authentication works, see [Authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md). If no OIDC user can sign in, connect to the cluster with your Nebius AI Cloud credentials and fix the provider configuration. For instructions, see [How to configure external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md). ## How to find the cause of an error To see how the cluster authenticates a user, run the following command with the kubeconfig file of the user: ```bash kubectl auth whoami --kubeconfig=oidc.kubeconfig ``` Use the output to find the cause: * If kubectl can't get a token from the IdP, see [Sign-in errors](https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md#sign-in-errors). * If the output is `error: You must be logged in to the server (Unauthorized)`, the API server rejected the token. See [Unauthorized error](https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md#unauthorized-error). * If the output shows the username and groups of the user, the user is authenticated. If the user still can't run commands, compare the username and groups with your role-based access control (RBAC) bindings. See [Forbidden error](https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md#forbidden-error). If you sign in with a kubeconfig file from your cluster administrator and can't fix the error yourself, send the administrator the error message and the output of this command. ## Configuration rejected by the cluster The cluster checks the provider configuration before it applies it. The error message names the parameter that failed the check. Common causes: * The cluster runs an [unrecommended Kubernetes version](https://docs.nebius.com/kubernetes/versions.md#available-kubernetes-versions). * A prefix starts with `system:` or `nebius:`. * Two providers have the same name or the same issuer URL. * The issuer URL doesn't use HTTPS, contains a query or a fragment, or points to the cluster itself. * A claim mapping has both `claim` and `expression`, or an expression mapping has a `prefix`. * A claim validation rule has both `claim` and `expression`, an exact-match rule has a `message`, or an expression rule has a `required_value`. * A Common Expression Language (CEL) expression doesn't compile. * An expression uses `claims.email` without checking `email_verified`. * `issuer.certificate_authority` isn't a valid PEM bundle. * The cluster has more than 64 providers. ## Sign-in errors The user can't complete the sign-in, so kubectl doesn't get a token. Check that the user is assigned to the client application in the IdP. If users sign in with kubelogin, also check the following: * kubelogin is installed. If it isn't, kubectl reports that the `oidc-login` command is unknown. For instructions, see [How to sign in to the cluster](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-sign-in-to-the-cluster). * The client application in the IdP allows the authorization code grant type and the `http://localhost:8000` redirect URI. If it doesn't, the IdP shows an error after the user signs in. * The `--oidc-issuer-url` and `--oidc-client-id` values in the kubeconfig file match the issuer URL of the IdP and the client ID of the application. If users sign in with a different client, check its settings according to its documentation. ## Unauthorized error The API server rejected the token. Check the following: * The update operation that added or changed the provider has completed. * The issuer URL and the discovery document are publicly accessible over HTTPS. * The `issuer` field of the discovery document matches `issuer.url` exactly, including the trailing slash. To see the document, open `/.well-known/openid-configuration` in a browser. * The public keys of the IdP include the key that signed the token. * The token hasn't expired. * The `aud` claim of the token contains one of the values in `issuer.audiences`. * The token contains the claims that the mappings use, and `email_verified` isn't `false`. * The token passes all [validation rules](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md#validation-rules). * The mapped username and groups don't start with `system:`. To see the claims of a token from your IdP with kubelogin, run the following command and sign in: ```bash kubectl oidc-login setup \ --oidc-issuer-url= \ --oidc-client-id= \ --oidc-extra-scope=email ``` ## Forbidden error The user is authenticated but has no permission for the request. [Get the mapped username and groups of the user](https://docs.nebius.com/kubernetes/authentication/troubleshoot-oidc-providers.md#how-to-find-the-cause-of-an-error) and check the following: * Your RBAC bindings use the same names as the output, including the prefixes. For more information, see [How to grant access with RBAC](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-grant-access-with-rbac). * If the output has no groups from the IdP, the ID token has no `groups` claim. Configure the IdP to add the claim. If the IdP adds it only for a separate scope, request this scope in the kubeconfig file. For more information, see [How to prepare a kubeconfig file for users](https://docs.nebius.com/kubernetes/authentication/oidc-authentication.md#how-to-prepare-a-kubeconfig-file-for-users). # Using an OIDC public endpoint in Managed Service for Kubernetes® clusters Source: https://docs.nebius.com/kubernetes/networking/oidc-public-endpoint.md All Managed Service for Kubernetes clusters expose a public OpenID Connect (OIDC) discovery endpoint. External systems can use this endpoint to independently verify workload identities by using [JSON Web Tokens (JWT)](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#json-web-token-authentication) that Kubernetes issues automatically. You can use this endpoint to let an external service trust your Managed Kubernetes cluster workloads. To let users sign in to the cluster with tokens from an external identity provider, see [Authentication with external OIDC providers in Managed Service for Kubernetes®](https://docs.nebius.com/kubernetes/authentication/oidc-providers.md). You can't add the OIDC endpoint of a cluster as an identity provider for that same cluster. ## OIDC endpoints For every cluster, Managed Kubernetes exposes the following endpoints at `https://oidc.mk8s.api.nebius.cloud`: | Endpoint | Description | | - | - | | `GET //.well-known/openid-configuration` | OIDC discovery document for the cluster. | | `GET //openid/v1/jwks` | JSON Web Key Set (JWKS) containing the public keys used to verify the tokens issued by the cluster. | Both endpoints are accessible without authentication, so any OIDC-compatible service can fetch them directly. ## How to get a cluster's OIDC endpoint URLs 1. Get the ID of your cluster by its name: ```bash nebius mk8s cluster get-by-name \ --name --format jsonpath='{.metadata.id}' ``` 2. Replace `` with your cluster ID in the endpoint URLs: ```text https://oidc.mk8s.api.nebius.cloud//.well-known/openid-configuration https://oidc.mk8s.api.nebius.cloud//openid/v1/jwks ``` 3. Use these URLs when you register an OIDC identity provider or configure workload identity federation. # Pulling images from Container Registry for workloads in Managed Service for Kubernetes® clusters Source: https://docs.nebius.com/kubernetes/workloads/images-container-registry.md If a node group in a Managed Service for Kubernetes cluster has a [service account](https://docs.nebius.com/iam/overview.md#accounts-and-members) added to it, Pods hosted by the group's nodes can pull images from Container Registry without additional authentication. > [!NOTE] > > We recommend using the service account from the same [project](https://docs.nebius.com/iam/overview.md#projects) as the node group. To set up pulling images without authentication: 1. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. In your Managed Kubernetes cluster, [create or modify a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) so that a service account from a group with at least the `viewer` role is added to it. A service account for node groups that your project came with, `k8s-node-group-sa`, is in the default `viewers` group. > [!WARNING] > > Currently, it is not possible to create a node group with a service account using the web console. For example: > [tab] CLI > > The commands below assume that the Nebius AI Cloud CLI is configured as described in its [documentation](https://docs.nebius.com/cli/configure.md), including adding the [project](https://docs.nebius.com/iam/overview.md#projects) ID in the CLI profile's `parent-id`, and that the Managed Kubernetes cluster ID is stored in the `MK8S_CLUSTER_ID` environment variable. > > ```bash > export MK8S_SA_ID=$(nebius iam service-account get-by-name \ > --name k8s-node-group-sa \ > --format jsonpath='{.metadata.id}') > nebius mk8s node-group create \ > --parent-id $MK8S_CLUSTER_ID \ > --name node-group-example \ > --fixed-node-count 2 \ > --template-service-account-id $MK8S_SA_ID \ > --template-resources-platform cpu-e2 \ > --template-resources-preset 2vcpu-8gb > ``` > > For details about `nebius mk8s node-group create`, see the [CLI reference](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md). > [tab] Terraform > > The configuration below assumes that the [project](https://docs.nebius.com/iam/overview.md#projects) ID and Managed Kubernetes cluster ID are stored in the `project_id` and `mk8s_cluster_id` [Terraform input variables](https://developer.hashicorp.com/terraform/language/values/variables), respectively. > > ```hcl > data "nebius_iam_v1_service_account" "k8s_node_group" { > parent_id = var.project_id > name = "k8s-node-group-sa" > } > > resource "nebius_mk8s_v1_node_group" "example" { > parent_id = var.mk8s_cluster_id > name = "node-group-example" > > fixed_node_count = 2 > > template = { > service_account_id = data.nebius_iam_v1_service_account.k8s_node_group.id > > resources = { > platform = "cpu-e2" > preset = "2vcpu-8gb" > } > } > } > ``` > > For details about the `nebius_mk8s_v1_node_group` Terraform resource, see the [provider reference](https://docs.nebius.com/terraform-provider/reference/resources/mk8s_v1_node_group.md). > [tab] Go SDK > > The code below assumes that the Managed Kubernetes cluster ID is stored in the `mk8sClusterID` variable. > > ```go > serviceAccount, err := sdk.Services().IAM().V1(). > ServiceAccount().GetByName( > ctx, > &iam.GetServiceAccountByNameRequest{ > Name: "k8s-node-group-sa", > }, > ) > if err != nil { > return err > } > saID := serviceAccount.GetMetadata().GetId() > if saID == "" { > return errors.New("service account ID is missing") > } > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: "node-group-example", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > ServiceAccountId: saID, > Resources: &mk8s.ResourcesSpec{ > Platform: "cpu-e2", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code looks the `k8s-node-group-sa` service account up by name and passes its ID to `Spec.Template.ServiceAccountId`. > [tab] Python SDK > > The code below assumes that the Managed Kubernetes cluster ID is stored in the `mk8s_cluster_id` variable. > > ```python > service_account_service = ServiceAccountServiceClient(sdk) > service_account = await service_account_service.get_by_name( > GetServiceAccountByNameRequest(name="k8s-node-group-sa"), > ) > sa_id = service_account.metadata.id > if not sa_id: > raise ValueError("service account ID is missing") > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name="node-group-example", > ), > spec=NodeGroupSpec( > fixed_node_count=2, > template=NodeTemplate( > service_account_id=sa_id, > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > ), > ), > ), > ) > await node_group_operation.wait() > ``` > > The code looks the `k8s-node-group-sa` service account up by name and passes its ID to `spec.template.service_account_id`. > [tab] JavaScript SDK > > The code below assumes that the Managed Kubernetes cluster ID is stored in the `mk8sClusterId` variable. > > ```ts > const serviceAccountService = > new ServiceAccountService(sdk); > const serviceAccount = await serviceAccountService.getByName( > GetServiceAccountByNameRequest.create({ > name: "k8s-node-group-sa", > }), > ); > const saId = serviceAccount.metadata?.id; > if (!saId) { > throw new Error("service account ID is missing"); > } > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: "node-group-example", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > serviceAccountId: saId, > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` > > The code looks the `k8s-node-group-sa` service account up by name and passes its ID to `spec.template.serviceAccountId`. After setting up node groups, you can just refer to Container Registry images in your manifests (for Pods or other resources that manage Pods, such as Deployments) without providing credentials to pull them. > For example, if your nginx image is at `cr.eu-north1.nebius.cloud//nginx:mynginx` (you can get the registry ID in the web console or by using the [nebius registry list](https://docs.nebius.com/cli/reference/registry/list.md) CLI command), here is how to refer to it in a Deployment manifest: > > ```yaml > apiVersion: apps/v1 > kind: Deployment > metadata: > name: nginx-deployment > spec: > replicas: 1 > selector: > matchLabels: > app: nginx > template: > metadata: > labels: > app: nginx > spec: > containers: > - name: nginx > image: cr.eu-north1.nebius.cloud//nginx:mynginx > ports: > - containerPort: 80 > ``` # Working with GPUs in the Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/gpu/set-up.md To run ML, AI and high-performance computing (HPC) workloads in your Managed Service for Kubernetes cluster, you need to add nodes with GPUs to it. Managed Kubernetes nodes are Compute virtual machines, and you can choose VMs with GPUs to serve as nodes in your clusters. In this article, you will learn how to set up GPUs in a Managed Kubernetes cluster. The article also touches on interconnecting GPUs using InfiniBand™ to accelerate your workloads; this topic is covered in detail in [another article](https://docs.nebius.com/kubernetes/gpu/clusters.md). ## How to add nodes with GPUs to a cluster When [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) in a Managed Service for Kubernetes cluster, specify a virtual machine platform that supports GPUs: > [tab] Web console > > In the node group creation form ( **Compute** → **Kubernetes** → your cluster → **Node groups** → **Create node group**), under **Computing resources**: > > 1. Select **With GPU**. > 2. Select a platform and a preset. For available platforms and presets, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md) and [How to find out platforms and presets available in a project](https://docs.nebius.com/compute/virtual-machines/list-platforms.md). > 3. Under **GPU settings**, keep the **Install NVIDIA GPU drivers and other components** option enabled. > 4. Under **Drivers**, select a CUDA driver version. For available driver versions, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components). > 5. Under **Operating system**, select an OS. Available operating systems depend on the selected driver. > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), disable the **Install NVIDIA GPU drivers and other components** option. Then, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups). > [tab] CLI > > Add GPU parameters to the [nebius mk8s node-group create](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md) command: > > ```bash > nebius mk8s node-group create \ > --template-resources-platform gpu-h100-sxm \ > --template-resources-preset 8gpu-128vcpu-1600gb \ > --template-gpu-settings-drivers-preset cuda13.0 \ > ... > ``` > > * In `--template-resources-platform`, specify a platform with GPUs. In `--template-resources-preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). For available platforms and presets, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md) and [How to find out platforms and presets available in a project](https://docs.nebius.com/compute/virtual-machines/list-platforms.md#how-to-find-out-available-platforms-and-presets-cli). > > * In `--template-gpu-settings-drivers-preset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components). > > If you want to [install the drivers manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#drivers-install), omit the `--template-gpu-settings-drivers-preset` parameter. > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit the `--template-gpu-settings-drivers-preset` parameter. Then, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-cli). > [tab] Go SDK > > Add GPU parameters to the node group spec: > > ```go > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: "node-group-example", > }, > Spec: &mk8s.NodeGroupSpec{ > Version: "1.36", > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "8gpu-128vcpu-1600gb", > }, > }, > BootDisk: &mk8s.DiskSpec{ > Size: &mk8s.DiskSpec_SizeGibibytes{ > SizeGibibytes: 100, > }, > Type: mk8s.DiskSpec_NETWORK_SSD, > }, > GpuSettings: &mk8s.GpuSettings{ > DriversPreset: "cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > nodeGroupID := nodeGroupOperation.ResourceID() > if nodeGroupID == "" { > return fmt.Errorf("node group ID is missing") > } > ``` > > * In `Template.Resources.Platform`, specify a platform with GPUs. In `Template.Resources.Size.Preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). For available platforms and presets, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md) and [How to find out platforms and presets available in a project](https://docs.nebius.com/compute/virtual-machines/list-platforms.md#how-to-find-out-available-platforms-and-presets-go-sdk). > > * In `Template.GpuSettings.DriversPreset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-go-sdk). > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit `Template.GpuSettings`. Then, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-go-sdk). > [tab] Python SDK > > Add GPU parameters to the node group spec: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name="node-group-example", > ), > spec=NodeGroupSpec( > version="1.36", > fixed_node_count=2, > template=NodeTemplate( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="8gpu-128vcpu-1600gb", > ), > boot_disk=DiskSpec( > size_gibibytes=100, > type=DiskSpec__DiskType.NETWORK_SSD, > ), > gpu_settings=GpuSettings( > drivers_preset="cuda13.0", > ), > ), > ), > ), > ) > await node_group_operation.wait() > node_group_id = node_group_operation.resource_id > if not node_group_id: > raise ValueError("node group ID is missing") > ``` > > * In `template.resources.platform`, specify a platform with GPUs. In `template.resources.preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). For available platforms and presets, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md) and [How to find out platforms and presets available in a project](https://docs.nebius.com/compute/virtual-machines/list-platforms.md#how-to-find-out-available-platforms-and-presets-python-sdk). > > * In `template.gpu_settings.drivers_preset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-python-sdk). > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit `template.gpu_settings`. Then, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-python-sdk). > [tab] JavaScript SDK > > Add GPU parameters to the node group spec: > > ```ts > const setupNodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await setupNodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: "node-group-example", > }), > spec: NodeGroupSpec.create({ > version: "1.36", > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "8gpu-128vcpu-1600gb", > }, > }), > bootDisk: DiskSpec.create({ > size: { > $case: "sizeGibibytes", > sizeGibibytes: 100, > }, > type: DiskSpec_DiskType.NETWORK_SSD, > }), > gpuSettings: GpuSettings.create({ > driversPreset: "cuda13.0", > }), > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > const nodeGroupId = nodeGroupOperation.resourceId(); > if (!nodeGroupId) { > throw new Error("node group ID is missing"); > } > ``` > > * In `template.resources.platform`, specify a platform with GPUs. In `template.resources.size.preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). For available platforms and presets, see [Types of virtual machines and GPUs in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/types.md) and [How to find out platforms and presets available in a project](https://docs.nebius.com/compute/virtual-machines/list-platforms.md#how-to-find-out-available-platforms-and-presets-javascript-sdk). > > * In `template.gpuSettings.driversPreset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-javascript-sdk). > > > [!NOTE] > > > > If you need to modify the NVIDIA device plug-in (for example, to enable multi-instance GPU), omit `template.gpuSettings`. Then, [manually install the GPU operator](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-javascript-sdk). See an [example](https://docs.nebius.com/kubernetes/node-groups/manage.md#examples) of a full node group specification. To enable InfiniBand interconnect between the nodes with GPUs, specify a GPU cluster when creating the node group. For more details, see [Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand™](https://docs.nebius.com/kubernetes/gpu/clusters.md). To request GPUs through Dynamic Resource Allocation, see [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md). > [!WARNING] > > You cannot change the VM platform and preset or the GPU cluster of an existing node group. Create a new node group instead. ## GPU drivers and other components For node groups with GPUs, Managed Kubernetes offers boot disk images with GPU drivers and other components required for GPUs. You can specify Managed Kubernetes GPU images with `--template-gpu-settings-drivers-preset`. The preset determines the CUDA toolkit and NVIDIA driver series. Each preset has a default operating system (OS), you can optionally override it with `--template-os`. | Driver preset | `cuda12.8` | `cuda13.0` | | - | - | - | | NVIDIA Data Center GPU Driver | 570.x | 580.x | | OS | `ubuntu24.04` | `ubuntu24.04` | > [!WARNING] > > If your cluster's control plane is on Kubernetes 1.30 (deprecated), use `cuda12` instead of `cuda12.8` (Ubuntu 24.04). Kubernetes 1.31 and later support `cuda12.8`, so there is no need to use `cuda12` on these versions. To confirm which `drivers_preset` and `os` values are supported for your platform and Kubernetes version, check the compatibility matrix: > [tab] CLI > > ```bash > nebius mk8s node-group get-compatibility-matrix \ > --cluster-kubernetes-version 1.36 \ > --platform gpu-h200-sxm > ``` > > Example output: > > ```yaml > versions: > - items: > - compatible_platforms: > - gpu-h200-sxm > os: ubuntu24.04 > - compatible_platforms: > - gpu-h200-sxm > drivers_preset: cuda12.8 > os: ubuntu24.04 > - compatible_platforms: > - gpu-h200-sxm > drivers_preset: cuda12 > os: ubuntu24.04 > - compatible_platforms: > - gpu-h200-sxm > drivers_preset: cuda13.0 > os: ubuntu24.04 > kubernetes_version: "1.36" > ``` > [tab] Go SDK > > ```go > matrix, err := sdk.Services().MK8S().V1(). > NodeGroup().GetCompatibilityMatrix( > ctx, > &mk8s.GetNodeGroupCompatibilityMatrixRequest{ > ClusterKubernetesVersion: > "1.36", > Platform: "gpu-h200-sxm", > }, > ) > if err != nil { > return err > } > fmt.Println(matrix) > ``` > > The response lists the supported combinations in `Versions.Items`, each with `CompatiblePlatforms`, `DriversPreset` and `Os`. > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > matrix = await node_group_service.get_compatibility_matrix( > GetNodeGroupCompatibilityMatrixRequest( > cluster_kubernetes_version="1.36", > platform="gpu-h200-sxm", > ), > ) > print(matrix) > ``` > > The response lists the supported combinations in `versions.items`, each with `compatible_platforms`, `drivers_preset` and `os`. > [tab] JavaScript SDK > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const matrix = await nodeGroupService.getCompatibilityMatrix( > GetNodeGroupCompatibilityMatrixRequest.create({ > clusterKubernetesVersion: "1.36", > platform: "gpu-h200-sxm", > }), > ); > console.log(matrix); > ``` > > The response lists the supported combinations in `versions.items`, each with `compatiblePlatforms`, `driversPreset` and `os`. Use the returned `drivers_preset` and `os` values to select the driver branch and, optionally, an operating system (OS) in a node group configuration. For instructions on how to specify these parameters when creating a node group, see [How to add nodes with GPUs to a cluster](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-add-nodes-with-gpus-to-a-cluster). ### How to change the driver preset To change the driver preset for an existing node group: > [tab] CLI > > ```bash > nebius mk8s node-group update \ > --id \ > --auto-approve \ > --template-gpu-settings-drivers-preset > ``` > [tab] Go SDK > > ```go > groupForDriver, err := sdk.Services().MK8S().V1(). > NodeGroup().Get( > ctx, > &mk8s.GetNodeGroupRequest{Id: ""}, > ) > if err != nil { > return err > } > groupDriverSpec := groupForDriver.GetSpec() > if groupDriverSpec == nil || groupDriverSpec.GetTemplate() == nil { > return errors.New("node group template is missing") > } > if groupDriverSpec.GetTemplate().GetGpuSettings() == nil { > groupDriverSpec.GetTemplate().GpuSettings = &mk8s.GpuSettings{} > } > groupDriverSpec.GetTemplate().GetGpuSettings().DriversPreset = > "" > driverGroupOp, err := sdk.Services().MK8S().V1().NodeGroup(). > Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: groupForDriver.GetMetadata(), > Spec: groupDriverSpec, > }, > ) > if err != nil { > return err > } > if _, err = driverGroupOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > driver_group_service = NodeGroupServiceClient(sdk) > group_for_driver = await driver_group_service.get( > GetNodeGroupRequest(id=""), > ) > if ( > group_for_driver.spec is None > or group_for_driver.spec.template is None > ): > raise ValueError("node group template is missing") > if group_for_driver.spec.template.gpu_settings is None: > group_for_driver.spec.template.gpu_settings = GpuSettings() > group_for_driver.spec.template.gpu_settings.drivers_preset = \ > "" > driver_group_operation = await driver_group_service.update( > UpdateNodeGroupRequest( > metadata=group_for_driver.metadata, > spec=group_for_driver.spec, > ), > ) > await driver_group_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const driverGroupService = new NodeGroupService(sdk); > const groupForDriver = await driverGroupService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!groupForDriver.spec?.template) { > throw new Error("node group template is missing"); > } > groupForDriver.spec.template.gpuSettings ??= GpuSettings.create({}); > groupForDriver.spec.template.gpuSettings.driversPreset = > ""; > const driverGroupOperation = await driverGroupService.update( > UpdateNodeGroupRequest.create({ > metadata: groupForDriver.metadata, > spec: groupForDriver.spec, > }), > ).result; > await driverGroupOperation.wait(); > ``` > [!WARNING] > > When you change the driver preset, Managed Kubernetes recreates all nodes in the group according to the group's [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). ### How to install the drivers and components on existing node groups You can create a node group without the boot disk image. For example, you may opt not to use the **Install NVIDIA GPU drivers and other components** option when you create the node group in the web console. In this case, you can choose one of the following options to install the drivers and components: * **Create a new node group with the image and migrate your workloads to it** (recommended) For instructions, see [Moving workload from the existing node group](https://docs.nebius.com/kubernetes/node-groups/moving-workload.md). * **Modify the node group to use the image** > [!WARNING] > > When you modify a node group, Managed Kubernetes recreates each node according to the group's [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#node-group-parameters). > [accordion] How to modify the node group > > > [tab] CLI > > > > Run the [nebius mk8s node-group update](https://docs.nebius.com/cli/reference/mk8s/node-group/update.md) command: > > > > ```bash > > nebius mk8s node-group update \ > > --id \ > > --auto-approve \ > > --template-gpu-settings-drivers-preset cuda13.0 > > ``` > > > [tab] Go SDK > > > > Set `Template.GpuSettings.DriversPreset` on the node group and update it: > > > > ```go > > nodeGroup, err := sdk.Services().MK8S().V1(). > > NodeGroup().Get( > > ctx, > > &mk8s.GetNodeGroupRequest{Id: ""}, > > ) > > if err != nil { > > return err > > } > > nodeGroupSpec := nodeGroup.GetSpec() > > if nodeGroupSpec == nil || nodeGroupSpec.GetTemplate() == nil { > > return errors.New("node group template spec is missing") > > } > > if nodeGroupSpec.GetTemplate().GetGpuSettings() == nil { > > nodeGroupSpec.GetTemplate().GpuSettings = &mk8s.GpuSettings{} > > } > > gpuSettings := nodeGroupSpec.GetTemplate().GetGpuSettings() > > gpuSettings.DriversPreset = "cuda13.0" > > updateNodeGroupOperation, err := sdk.Services().MK8S().V1(). > > NodeGroup().Update( > > ctx, > > &mk8s.UpdateNodeGroupRequest{ > > Metadata: nodeGroup.GetMetadata(), > > Spec: nodeGroupSpec, > > }, > > ) > > if err != nil { > > return err > > } > > if _, err = updateNodeGroupOperation.Wait(ctx); err != nil { > > return err > > } > > ``` > > > [tab] Python SDK > > > > Set `template.gpu_settings.drivers_preset` on the node group and update it: > > > > ```python > > node_group_service = NodeGroupServiceClient(sdk) > > node_group = await node_group_service.get( > > GetNodeGroupRequest(id=""), > > ) > > if node_group.spec is None or node_group.spec.template is None: > > raise ValueError("node group template spec is missing") > > if node_group.spec.template.gpu_settings is None: > > node_group.spec.template.gpu_settings = GpuSettings() > > node_group.spec.template.gpu_settings.drivers_preset = "cuda13.0" > > update_node_group_operation = await node_group_service.update( > > UpdateNodeGroupRequest( > > metadata=node_group.metadata, > > spec=node_group.spec, > > ), > > ) > > await update_node_group_operation.wait() > > ``` > > > [tab] JavaScript SDK > > > > Set `template.gpuSettings.driversPreset` on the node group and update it: > > > > ```ts > > const updateNodeGroupService = new NodeGroupService(sdk); > > const nodeGroup = await updateNodeGroupService.get( > > GetNodeGroupRequest.create({ > > id: "", > > }), > > ); > > if (!nodeGroup.spec?.template) { > > throw new Error("node group template spec is missing"); > > } > > nodeGroup.spec.template.gpuSettings ??= GpuSettings.create({}); > > nodeGroup.spec.template.gpuSettings.driversPreset = "cuda13.0"; > > const updateNodeGroupOperation = await updateNodeGroupService.update( > > UpdateNodeGroupRequest.create({ > > metadata: nodeGroup.metadata, > > spec: nodeGroup.spec, > > }), > > ).result; > > await updateNodeGroupOperation.wait(); > > ``` * **Manually install NVIDIA operators** You can install Kubernetes operators from NVIDIA that manage components required for GPUs and their networking: * **NVIDIA Network Operator** Installing NVIDIA Network Operator is required when at least one node group in the cluster does not use the boot disk image offered by Managed Kubernetes and satisfies any of the following conditions: * The node group uses NVIDIA B200 GPUs. * The node group is added to a GPU cluster for [InfiniBand interconnection](https://docs.nebius.com/kubernetes/gpu/clusters.md). In all other cases, NVIDIA Network Operator is optional. * **NVIDIA GPU Operator** Any cluster with at least one node group that has GPUs and does not use the boot disk image offered by Managed Kubernetes, must have NVIDIA GPU Operator installed. To install the operators, follow the instructions, depending on whether you enabled the InfiniBand interconnection: > [accordion] With InfiniBand: GPU and network operators > > > [!WARNING] > > > > Install and check the operators in the exact order presented in these instructions. The operators depend on each other. > > 1. Prepare your environment: > > 1. Configure kubectl, the Kubernetes CLI, to work with your cluster: > > ```bash > nebius mk8s cluster get-credentials \ > --id --external > ``` > > For more details, see [How to connect to Managed Service for Kubernetes® clusters using kubectl](https://docs.nebius.com/kubernetes/connect.md). > > 2. Install [Helm](https://helm.sh/docs/), the package manager for Kubernetes that we will use to install the operator: > > ```bash > curl -fsSL -o get_helm.sh \ > https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 > chmod 700 get_helm.sh > ./get_helm.sh > ``` > > For more ways to install, see the [Helm documentation](https://helm.sh/docs/intro/install/). > > 2. Install the NVIDIA Network Operator from the Nebius AI Cloud chart repository: > > ```bash > helm install network-operator \ > oci://cr.eu-north1.nebius.cloud/marketplace/nebius/nvidia-network-operator/chart/network-operator \ > --version 25.7.0 \ > -n nvidia-network-operator --create-namespace \ > --wait > ``` > > 3. Verify that the NVIDIA Network Operator installed its components correctly. Get the `NICClusterPolicy` instance status: > > ```bash > kubectl get nicclusterpolicy.mellanox.com nic-cluster-policy \ > -n nvidia-network-operator -o json | jq -r '.status' > ``` > > The output example is the following: > > ```json > { > "appliedStates": [ > ... > { > "name": "state-OFED", > "state": "ready" > }, > ... > ], > "state": "ready" > } > ``` > > While `state-OFED` is `notReady`, you can check the driver installation logs: > > ```bash > kubectl logs -n nvidia-network-operator \ > $(kubectl get pods -n nvidia-network-operator \ > | grep mofed | head -1 | awk '{print $1}') > ``` > > 4. Install the NVIDIA GPU Operator from the Nebius AI Cloud chart repository: > > ```bash For NVIDIA B300 GPUs > helm install gpu-operator \ > oci://cr.eu-north1.nebius.cloud/marketplace/nebius/nvidia-gpu-operator/chart/gpu-operator \ > --version v25.10.0 \ > --set driver.version=580.95.05 \ > -n nvidia-gpu-operator \ > --create-namespace \ > --wait > ``` > > ```bash For any other GPUs > helm install gpu-operator \ > oci://cr.eu-north1.nebius.cloud/marketplace/nebius/nvidia-gpu-operator/chart/gpu-operator \ > --version v25.10.0 \ > -n nvidia-gpu-operator \ > --create-namespace \ > --wait > ``` > > [GPUDirect RDMA](https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/gpu-operator-rdma.html) is enabled by default and uses the recommended DMA-BUF Linux kernel module. > > For more command parameters, see the [NVIDIA GPU Operator documentation](https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/getting-started.html#common-chart-customization-options). > > 5. Verify that the GPU driver is installed correctly. > > > [!WARNING] > > > > Do not check the GPU driver until you install both operators. > > Get the last log line from each DaemonSet that installs the driver: > > ```bash > for pod in $(kubectl get pods -n nvidia-gpu-operator \ > | grep nvidia-driver-daemonset | awk '{print $1}'); do > echo -e "$pod:\n\t$(kubectl logs -n nvidia-gpu-operator $pod --tail 1)"; > done > ``` > > If the last lines are `Done, now waiting for signal`, the driver should work correctly. > [accordion] Without InfiniBand: GPU operator > > 1. Prepare your environment: > > 1. Configure kubectl, the Kubernetes CLI, to work with your cluster: > > ```bash > nebius mk8s cluster get-credentials \ > --id --external > ``` > > For more details, see [How to connect to Managed Service for Kubernetes® clusters using kubectl](https://docs.nebius.com/kubernetes/connect.md). > > 2. Install [Helm](https://helm.sh/docs/), the package manager for Kubernetes that we will use to install the operator: > > ```bash > curl -fsSL -o get_helm.sh \ > https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 > chmod 700 get_helm.sh > ./get_helm.sh > ``` > > For more ways to install, see the [Helm documentation](https://helm.sh/docs/intro/install/). > > 2. Install the NVIDIA GPU Operator from the Nebius AI Cloud chart repository: > > ```bash For NVIDIA B300 GPUs > helm install gpu-operator \ > oci://cr.eu-north1.nebius.cloud/marketplace/nebius/nvidia-gpu-operator/chart/gpu-operator \ > --version v25.10.0 \ > --set driver.version=580.95.05 \ > -n nvidia-gpu-operator --create-namespace \ > --wait > ``` > > ```bash For any other GPUs > helm install gpu-operator \ > oci://cr.eu-north1.nebius.cloud/marketplace/nebius/nvidia-gpu-operator/chart/gpu-operator \ > --version v25.10.0 \ > -n nvidia-gpu-operator --create-namespace \ > --wait > ``` > > For more options, see the [NVIDIA GPU Operator documentation](https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/getting-started.html#common-chart-customization-options). > > 3. Verify that the GPU driver is installed correctly. > > Get the last log line from each DaemonSet that installs the driver: > > ```bash > for pod in $(kubectl get pods -n nvidia-gpu-operator \ > | grep nvidia-driver-daemonset | awk '{print $1}'); do > echo -e "$pod:\n\t$(kubectl logs -n nvidia-gpu-operator $pod --tail 1)"; > done > ``` > > If the last lines are `Done, now waiting for signal`, the driver should work correctly. ## Example: Using CUDA for vector addition To test CUDA support in the cluster with GPU nodes and drivers installed on them, you can run a small CUDA application, which adds two vectors together: 1. [Connect to the cluster using kubectl](https://docs.nebius.com/kubernetes/connect.md). 2. Follow instructions in the [NVIDIA GPU Operator documentation](https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/getting-started.html#cuda-vectoradd). ## See also * [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md) * [Interconnecting GPUs in a Managed Kubernetes cluster using InfiniBand](https://docs.nebius.com/kubernetes/gpu/clusters.md) * [Tutorial: Running NCCL tests in a cluster with InfiniBand-connected GPUs](https://docs.nebius.com/kubernetes/gpu/nccl-test.md) * [Creating and modifying node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md) *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Interconnecting GPUs in Managed Service for Kubernetes® clusters using InfiniBand™ Source: https://docs.nebius.com/kubernetes/gpu/clusters.md To accelerate ML, AI and high-performance computing (HPC) workloads that you run in your [Managed Service for Kubernetes clusters with GPUs](https://docs.nebius.com/kubernetes/gpu/set-up.md), you can interconnect the GPUs using [InfiniBand](https://www.infinibandta.org/about-infiniband/), a high-throughput, low-latency networking standard. For more details about InfiniBand in Nebius AI Cloud, see the [Compute documentation](https://docs.nebius.com/compute/clusters/gpu.md). In this article, you will learn how to set up InfiniBand in a Managed Kubernetes cluster. ## How to enable InfiniBand for a node group > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > 2. Open the page of the cluster where you want to create a node group. > 3. Click  **Create node group**. > 4. Under **Computing resources**: > > 1. Select **With GPU**. > > 2. Select a platform and a preset compatible with GPU clusters. The compatible platforms and presets: > > | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | > | - | - | - | > | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | > | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | > | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | > > 3. Select a GPU cluster or create one. If the field is inactive, make sure you have selected a compatible platform and preset. > > > [!WARNING] > > > > All virtual machines added to a GPU cluster must be in the same [project](https://docs.nebius.com/iam/overview.md#projects) as the GPU cluster. > > 4. Under **GPU settings**, keep the **Install NVIDIA GPU drivers and other components** option enabled. > > If you want to [install the drivers manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups), disable this option. > [tab] CLI > > 1. Depending on your project's [region](https://docs.nebius.com/overview/regions.md), select an [InfiniBand fabric](https://docs.nebius.com/compute/clusters/gpu.md#infiniband-fabrics) and save it to an environment variable: > > ```bash > export INFINIBAND_FABRIC= > ``` > > 2. Create a GPU cluster and save its ID: > > ```bash > export GPU_CLUSTER_ID=$(nebius compute gpu-cluster create \ > --name gpu-cluster-name \ > --infiniband-fabric $INFINIBAND_FABRIC \ > --format jsonpath='{.metadata.id}') > ``` > > 3. [Create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) with GPUs and specify the GPU cluster ID in its parameters by using the [nebius mk8s node-group create](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md) command: > > ```bash > nebius mk8s node-group create \ > --template-resources-platform gpu-h100-sxm \ > --template-resources-preset 8gpu-128vcpu-1600gb \ > --template-gpu-cluster-id $GPU_CLUSTER_ID \ > --template-gpu-settings-drivers-preset cuda13.0 \ > ... > ``` > > > [!WARNING] > > > > If a node group uses a GPU cluster, the GPU cluster must be located in the same project as the node group's parent cluster. > > * In `--template.gpu-cluster-id`, specify the GPU cluster ID. > > * In `--template-resources-platform`, specify a platform with GPUs. In `--template-resources-preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). The compatible platforms and presets are: > > | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | > | - | - | - | > | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | > | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | > | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | > > * In `--template-gpu-settings-drivers-preset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components). > > If you want to [install the drivers manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#drivers-install), omit the `--template-gpu-settings-drivers-preset` parameter. > [tab] Go SDK > > 1. Depending on your project's [region](https://docs.nebius.com/overview/regions.md), select an [InfiniBand fabric](https://docs.nebius.com/compute/clusters/gpu.md#infiniband-fabrics): > > ```go > infinibandFabric := "" > ``` > > 2. Create a GPU cluster and save its ID: > > ```go > gpuClusterOperation, err := sdk.Services().Compute().V1(). > GpuCluster().Create( > ctx, > &compute.CreateGpuClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "gpu-cluster-name", > }, > Spec: &compute.GpuClusterSpec{ > InfinibandFabric: infinibandFabric, > }, > }, > ) > if err != nil { > return err > } > if _, err = gpuClusterOperation.Wait(ctx); err != nil { > return err > } > gpuClusterID := gpuClusterOperation.ResourceID() > if gpuClusterID == "" { > return fmt.Errorf("GPU cluster ID is missing") > } > ``` > > 3. [Create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) with GPUs and specify the GPU cluster ID in its parameters: > > ```go > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: "node-group-example", > }, > Spec: &mk8s.NodeGroupSpec{ > Version: "1.36", > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 1, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "8gpu-128vcpu-1600gb", > }, > }, > BootDisk: &mk8s.DiskSpec{ > Size: &mk8s.DiskSpec_SizeGibibytes{ > SizeGibibytes: 100, > }, > Type: mk8s.DiskSpec_NETWORK_SSD, > }, > GpuCluster: &mk8s.GpuClusterSpec{ > Id: gpuClusterID, > }, > GpuSettings: &mk8s.GpuSettings{ > DriversPreset: "cuda13.0", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > * In `Template.GpuCluster.Id`, specify the GPU cluster ID. > > * In `Template.Resources.Platform`, specify a platform with GPUs. In `Template.Resources.Size.Preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). The compatible platforms and presets are: > > | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | > | - | - | - | > | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | > | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | > | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | > > * In `Template.GpuSettings.DriversPreset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-go-sdk). > > If you want to [install the drivers manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-go-sdk), omit `Template.GpuSettings`. > [tab] Python SDK > > 1. Depending on your project's [region](https://docs.nebius.com/overview/regions.md), select an [InfiniBand fabric](https://docs.nebius.com/compute/clusters/gpu.md#infiniband-fabrics): > > ```python > infiniband_fabric = "" > ``` > > 2. Create a GPU cluster and save its ID: > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > gpu_cluster_operation = await gpu_cluster_service.create( > CreateGpuClusterRequest( > metadata=ResourceMetadata(name="gpu-cluster-name"), > spec=GpuClusterSpec( > infiniband_fabric=infiniband_fabric, > ), > ), > ) > await gpu_cluster_operation.wait() > gpu_cluster_id = gpu_cluster_operation.resource_id > if not gpu_cluster_id: > raise ValueError("GPU cluster ID is missing") > ``` > > 3. [Create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) with GPUs and specify the GPU cluster ID in its parameters: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name="node-group-example", > ), > spec=NodeGroupSpec( > version="1.36", > fixed_node_count=1, > template=NodeTemplate( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="8gpu-128vcpu-1600gb", > ), > boot_disk=DiskSpec( > size_gibibytes=100, > type=DiskSpec__DiskType.NETWORK_SSD, > ), > gpu_cluster=GpuClusterSpec(id=gpu_cluster_id), > gpu_settings=GpuSettings(drivers_preset="cuda13.0"), > ), > ), > ), > ) > await node_group_operation.wait() > ``` > > * In `template.gpu_cluster.id`, specify the GPU cluster ID. > > * In `template.resources.platform`, specify a platform with GPUs. In `template.resources.preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). The compatible platforms and presets are: > > | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | > | - | - | - | > | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | > | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | > | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | > > * In `template.gpu_settings.drivers_preset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-python-sdk). > > If you want to [install the drivers manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-python-sdk), omit `template.gpu_settings`. > [tab] JavaScript SDK > > 1. Depending on your project's [region](https://docs.nebius.com/overview/regions.md), select an [InfiniBand fabric](https://docs.nebius.com/compute/clusters/gpu.md#infiniband-fabrics): > > ```ts > const infinibandFabric = ""; > ``` > > 2. Create a GPU cluster and save its ID: > > ```ts > const gpuClusterService = new GpuClusterService(sdk); > const gpuClusterOperation = await gpuClusterService.create( > CreateGpuClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "gpu-cluster-name", > }), > spec: GpuClusterSpec.create({ > infinibandFabric, > }), > }), > ).result; > await gpuClusterOperation.wait(); > const gpuClusterId = gpuClusterOperation.resourceId(); > if (!gpuClusterId) { > throw new Error("GPU cluster ID is missing"); > } > ``` > > 3. [Create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) with GPUs and specify the GPU cluster ID in its parameters: > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: "node-group-example", > }), > spec: NodeGroupSpec.create({ > version: "1.36", > size: { > $case: "fixedNodeCount", > fixedNodeCount: 1, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "8gpu-128vcpu-1600gb", > }, > }), > bootDisk: DiskSpec.create({ > size: { > $case: "sizeGibibytes", > sizeGibibytes: 100, > }, > type: DiskSpec_DiskType.NETWORK_SSD, > }), > gpuCluster: GpuClusterSpec.create({ > id: gpuClusterId, > }), > gpuSettings: GpuSettings.create({ > driversPreset: "cuda13.0", > }), > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` > > * In `template.gpuCluster.id`, specify the GPU cluster ID. > > * In `template.resources.platform`, specify a platform with GPUs. In `template.resources.size.preset`, specify a compatible preset (number of GPUs and vCPUs, RAM size). The compatible platforms and presets are: > > | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | > | - | - | - | > | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | > | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | > | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | > | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | > > * In `template.gpuSettings.driversPreset`, specify a supported preset to use a boot disk image that contains drivers and other components for GPUs. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components-javascript-sdk). > > If you want to [install the drivers manually](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups-javascript-sdk), omit `template.gpuSettings`. ## Example: NCCL tests To test InfiniBand performance in a Managed Service for Kubernetes cluster, you can run the NVIDIA NCCL test in it. For instructions, see our [tutorial](https://docs.nebius.com/kubernetes/gpu/nccl-test.md). ## See also * [Working with GPUs in a Managed Kubernetes cluster](https://docs.nebius.com/kubernetes/gpu/set-up.md) * [Dynamic Resource Allocation](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md) * [Creating and modifying node groups](https://docs.nebius.com/kubernetes/node-groups/manage.md) *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Dynamic resource allocation in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md Dynamic resource allocation (DRA) is a Kubernetes feature that lets workloads request specialized devices, such as GPUs and remote direct memory access (RDMA) network interfaces. Without DRA, a GPU resource request specifies only a quantity, such as `nvidia.com/gpu: 1`. Kubernetes schedules the Pod on a node with enough available GPUs. With DRA, a workload can request devices from a DeviceClass and specify requirements for their properties and configuration. Kubernetes selects suitable devices, schedules the Pod on a node that can access them, and asks the device driver to prepare them for the container. Managed Service for Kubernetes supports DRA for two kinds of devices: | Device | Driver | Provided by | DeviceClass | | - | - | - | - | | NVIDIA® GPU | NVIDIA® DRA driver (`gpu.nvidia.com`) | Installed and maintained by you | `gpu.nvidia.com` | | RDMA or InfiniBand™ network interface | DRANet (`dra.net`) | Managed by Nebius | `rdma.networking.nebius.ai` or `ib.networking.nebius.ai` | This guide explains how to enable DRA on a node group and use it to allocate resources to a workload. > [!WARNING] > > Allocating a GPU claim and a network interface to the same Pod does not guarantee that the devices share a PCI root or the same non-uniform memory access (NUMA) node. If the workload requires that placement, validate it in the application. ## Prerequisites 1. [Create a Managed Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md) that runs Kubernetes 1.34 or later, or [upgrade](https://docs.nebius.com/kubernetes/manage-versions.md) an existing cluster. Kubernetes 1.34 is the first version in which the DRA API, `resource.k8s.io/v1`, is stable. For the versions available in Managed Kubernetes, see [Kubernetes versions](https://docs.nebius.com/kubernetes/versions.md). 2. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [connect to the cluster](https://docs.nebius.com/kubernetes/connect.md). 3. [Install jq](https://jqlang.github.io/jq/download/). 4. [Install Helm](https://helm.sh/docs/intro/install/). ## How to enable DRA on a node group Enable DRA in the GPU settings of the node group. The legacy NVIDIA device plug-in and the NVIDIA DRA driver must not manage the same GPUs. This setting prepares the nodes for GPU DRA and disables the legacy plug-in on that group. When you use a preinstalled NVIDIA driver, select a [driver preset](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components). Otherwise, install the NVIDIA GPU Operator and, for InfiniBand, the NVIDIA Network Operator. When installing GPU Operator, set `devicePlugin.enabled=false` so the Operator does not start the legacy plug-in. For the commands and installation order, see [How to install the drivers and components on existing node groups](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-install-the-drivers-and-components-on-existing-node-groups). Use one of the following: * To create a node group, add the DRA settings in the [create request](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > [tab] CLI > > Add `--template-gpu-settings-dra=true` to the create command: > > ```bash > nebius mk8s node-group create \ > --template-gpu-settings-dra=true \ > --template-gpu-settings-drivers-preset \ > ... > ``` > > Set `` when you use a preinstalled driver. Otherwise, omit `--template-gpu-settings-drivers-preset`. > [tab] Terraform > > Add `dra = true` to `gpu_settings` in the [`nebius_mk8s_v1_node_group`](https://docs.nebius.com/terraform-provider/reference/resources/mk8s_v1_node_group) resource: > > ```hcl > resource "nebius_mk8s_v1_node_group" "" { > gpu_settings = { > dra = true > drivers_preset = "" > } > } > } > ``` > > Set `` when you use a preinstalled driver. Otherwise, omit `drivers_preset`. > [tab] Go SDK > > In the create call, set `GpuSettings` to: > > ```go > GpuSettings: &mk8s.GpuSettings{ > Dra: true, > DriversPreset: "", > }, > ``` > > Set `` when you use a preinstalled driver. Otherwise, omit `DriversPreset`. > [tab] Python SDK > > In the create call, set `gpu_settings` to: > > ```python > gpu_settings=GpuSettings( > dra=True, > drivers_preset="", > ), > ``` > > Set `` when you use a preinstalled driver. Otherwise, omit `drivers_preset`. > [tab] JavaScript SDK > > In the create call, set `gpuSettings` to: > > ```javascript > gpuSettings: GpuSettings.create({ > dra: true, > driversPreset: "", > }), > ``` > > Set `` when you use a preinstalled driver. Otherwise, omit `driversPreset`. * To enable DRA on an existing node group, add the same settings when you [update the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-modify-node-groups). > [!WARNING] > > Enabling or disabling DRA on an existing node group recreates its nodes according to the group's [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas). After enabling DRA, proceed with one of the following: * [Allocating a GPU](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#allocating-a-gpu). * [Allocating an RDMA or InfiniBand interface](https://docs.nebius.com/kubernetes/gpu/dynamic-resource-allocation.md#allocating-an-rdma-or-infiniband-interface). ## Allocating a GPU Managed Kubernetes does not install the NVIDIA DRA driver. Install and maintain the driver yourself. ### Install the NVIDIA DRA driver 1. Add the NVIDIA chart repository: ```bash helm repo add nvidia https://helm.ngc.nvidia.com/nvidia helm repo update ``` 2. Install the supported NVIDIA DRA driver version: ```bash helm install nvidia-dra-driver-gpu nvidia/nvidia-dra-driver-gpu \ --create-namespace \ --namespace nvidia-dra-driver-gpu \ --set gpuResourcesEnabledOverride=true \ --wait ``` For other chart values required by your node image, see the [NVIDIA DRA driver for GPUs documentation](https://github.com/NVIDIA/k8s-dra-driver-gpu). ### Check the NVIDIA DRA driver 1. Check that the driver Pods are ready: ```bash kubectl get pods -n nvidia-dra-driver-gpu ``` The output lists one controller Pod and one kubelet plugin Pod for each GPU node. All Pods are `Running`, with all containers ready: ```text NAME READY STATUS RESTARTS AGE dra-driver-nvidia-gpu-controller-*** 1/1 Running 0 4d21h dra-driver-nvidia-gpu-kubelet-plugin-*** 2/2 Running 0 4d21h dra-driver-nvidia-gpu-kubelet-plugin-*** 2/2 Running 0 4d21h dra-driver-nvidia-gpu-kubelet-plugin-*** 2/2 Running 0 4d21h ... ``` 2. Check that the driver has created the GPU DeviceClass: ```bash kubectl get deviceclass gpu.nvidia.com ``` The expected output is: ```text NAME AGE gpu.nvidia.com 4d21h ``` 3. Check that the driver has published the GPU inventory: ```bash kubectl get resourceslices -o json | jq '[ .items[] | select(.spec.driver == "gpu.nvidia.com") | {node: .spec.nodeName, devices: [.spec.devices[].name]} ]' ``` The output lists every target GPU node with its GPUs, for example: ```json [ { "node": "computeinstance-e00***", "devices": [ "gpu-3", "gpu-2", "gpu-1", "gpu-0" ] }, { "node": "computeinstance-e00***", "devices": [ "gpu-3", "gpu-2", "gpu-1", "gpu-0" ] } ] ``` ### Request a GPU 1. Save the following manifest as `gpu-workload.yaml`. Replace `` with a container image that includes `nvidia-smi`. The Pod command runs `nvidia-smi` to confirm the GPU. For example, `nvidia/cuda:13.1.1-runtime-ubuntu24.04`. ```yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaimTemplate metadata: name: gpu spec: spec: devices: requests: - name: gpu exactly: deviceClassName: gpu.nvidia.com count: 1 --- apiVersion: v1 kind: Pod metadata: name: gpu-workload spec: restartPolicy: Never resourceClaims: - name: gpu resourceClaimTemplateName: gpu containers: - name: workload image: command: ["sh", "-c", "nvidia-smi && sleep infinity"] resources: claims: - name: gpu ``` 2. Create the ResourceClaimTemplate and Pod: ```bash kubectl apply -f gpu-workload.yaml ``` 3. Wait until the Pod is running: ```bash kubectl get pod gpu-workload --watch ``` 4. Check that the GPU is visible in the container: ```bash kubectl exec gpu-workload -- nvidia-smi ``` The output lists one allocated GPU. ## Allocating an RDMA or InfiniBand interface ### How managed DRANet works When you enable DRA on a node group in a [GPU cluster](https://docs.nebius.com/kubernetes/gpu/clusters.md), Managed Kubernetes installs and maintains the DRANet driver for you. You don't need to install it yourself. Managed Kubernetes: * Runs the `dranet` DaemonSet in the `kube-system` namespace on nodes labeled `nebius.com/dranet-rdma-capable=true`. * Discovers the RDMA-capable network interfaces on those nodes. * Publishes the discovered interfaces to Kubernetes as ResourceSlices. * Provides DeviceClasses that workloads can use to request an RDMA or InfiniBand interface. ### Check managed DRANet 1. Check that the `dranet` DaemonSet is running: ```bash kubectl get ds -A | grep -E 'NAMESPACE|dranet' ``` The expected output is: ```text NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE kube-system dranet nebius.com/dranet-rdma-capable=true ``` The DaemonSet is in the `kube-system` namespace. The ready count matches the number of eligible nodes, and the node selector is `nebius.com/dranet-rdma-capable=true`. 2. Check that Managed Kubernetes has created the network DeviceClasses: ```bash kubectl get deviceclass rdma.networking.nebius.ai ib.networking.nebius.ai -o name ``` The expected output is: ```text deviceclass.resource.k8s.io/rdma.networking.nebius.ai deviceclass.resource.k8s.io/ib.networking.nebius.ai ``` The DeviceClasses select the following interfaces: | DeviceClass | Interface selected | | - | - | | `rdma.networking.nebius.ai` | Any RDMA-capable interface | | `ib.networking.nebius.ai` | InfiniBand interface | 3. Check that DRANet has published the network-device inventory: ```bash kubectl get resourceslices -o json | jq '[ .items[] | select(.spec.driver == "dra.net") | {node: .spec.nodeName, devices: [.spec.devices[] | {name, attributes}]} ]' ``` Each device lists its name and attributes. Confirm that the interface is RDMA-capable. > [!NOTE] > > Don't request both `rdma.networking.nebius.ai` and `ib.networking.nebius.ai` when the workload needs only one network device. Kubernetes treats them as independent device requests and allocates two separate devices. Choose one DeviceClass based on the workload requirements: * Use `ib.networking.nebius.ai` when the workload specifically requires an InfiniBand interface. InfiniBand interfaces are RDMA-capable, so you don't need an additional request for `rdma.networking.nebius.ai`. * Use `rdma.networking.nebius.ai` when the workload can use any RDMA-capable interface, including either InfiniBand or Ethernet-based RDMA. Request both only when the workload requires two separate network devices. ### Request an InfiniBand interface The following example requests one interface from the `ib.networking.nebius.ai` DeviceClass. To request any RDMA-capable interface instead, use `rdma.networking.nebius.ai`. 1. Save the following manifest as `ib-workload.yaml`. Replace `` with a container image that includes the RDMA user-space tools you use to test the allocated interface. ```yaml apiVersion: resource.k8s.io/v1 kind: ResourceClaimTemplate metadata: name: ib-network spec: spec: devices: requests: - name: ib exactly: deviceClassName: ib.networking.nebius.ai count: 1 --- apiVersion: v1 kind: Pod metadata: name: rdma-workload spec: restartPolicy: Never resourceClaims: - name: network resourceClaimTemplateName: ib-network containers: - name: workload image: command: ["sleep", "infinity"] resources: claims: - name: network ``` `count` specifies the number of interfaces to allocate. It does not change the bandwidth of an individual interface. If you omit `count`, the default is 1. 2. Create the ResourceClaimTemplate and the Pod: ```bash kubectl apply -f ib-workload.yaml ``` 3. Wait until the Pod is running: ```bash kubectl get pod rdma-workload --watch ``` ### Verify the network allocation 1. Get the generated claim name from the Pod: ```bash kubectl get pod rdma-workload -o jsonpath='{.status.resourceClaimStatuses}' ``` 2. Inspect the generated ResourceClaim. Replace `` with the name from the previous command: ```bash kubectl get resourceclaim -o yaml ``` In `status.allocation.devices.results`, the allocation contains the DRANet driver, device pool and allocated device: ```yaml status: allocation: devices: results: - request: ib driver: dra.net pool: device: ``` 3. Check that the allocated interface is visible inside the container: ```bash kubectl exec rdma-workload -- ls /sys/class/net ``` In addition to the default interfaces, the output contains the allocated interface: ```text eth0 lo ``` 4. Check that the RDMA devices are visible to the container: ```bash kubectl exec rdma-workload -- ls /sys/class/infiniband ``` The output contains the associated RDMA device, for example: ```text mlx5_0 ``` A ResourceClaim allocation and an interface visible in the container confirm that Kubernetes has passed the interface to the Pod. They don't show that RDMA traffic works. Test connectivity and throughput with the application's network test. ## See also * [Working with GPUs](https://docs.nebius.com/kubernetes/gpu/set-up.md) * [Interconnecting GPUs with InfiniBand](https://docs.nebius.com/kubernetes/gpu/clusters.md) * [Dynamic Resource Allocation](https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/) in the Kubernetes documentation, including DeviceClasses and ResourceClaims *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Topology-aware scheduling for GPU workloads in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/gpu/topology-aware-scheduling.md Modern AI/ML workloads depend heavily on high-throughput, low-latency communication between nodes. In GPU clusters connected via InfiniBand™, the physical network topology has a direct impact on performance. Topology-aware scheduling (TAS) enables Kubernetes schedulers to optimize workload placement based on how nodes are physically connected within the InfiniBand fabric. With this feature, Nebius AI Cloud exposes InfiniBand topology information as *node labels*, allowing schedulers to place workloads on nodes that are closer in the network hierarchy. This can improve communication efficiency and provide performance gains for distributed workloads. For more information about Kubernetes scheduling, see the [Kubernetes scheduler documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/). ## Prerequisites 1. [Create a Managed Service for Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md) and [attach at least one GPU node group](https://docs.nebius.com/kubernetes/node-groups/manage.md) to it. 2. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl). 3. [Connect to the cluster by using kubectl](https://docs.nebius.com/kubernetes/connect.md). ## How to view topology labels in your cluster View the topology labels on GPU nodes with the following command: ```bash kubectl get nodes -L topology.nebius.com/gpu-cluster-id,topology.nebius.com/tier-2,topology.nebius.com/tier-1,kubernetes.io/hostname ``` The following labels can be present on GPU nodes: | Label | Description | | - | - | | `topology.nebius.com/gpu-cluster-id` | Identifies a connected high-speed network domain. Nodes with the same value have high-speed network connectivity between each other. | | `topology.nebius.com/tier-0` | Closest topology level. For example, this can represent a direct accelerator interconnect, such as multi-node NVLink between NVIDIA GPUs. This label is set only for nodes that support this type of communication. | | `topology.nebius.com/tier-1` | Lower-level network locality domain. For example, this can represent rack-level switches that connect nodes in one or more racks into a single block. | | `topology.nebius.com/tier-2` | Wider network locality domain. For example, this can represent spine-level switches that connect multiple blocks inside a data center. | The lower the tier level shared by two nodes, the better the expected communication performance between them. For example, two nodes with the same `topology.nebius.com/tier-1` value are expected to be closer to each other than two nodes that only share the same `topology.nebius.com/tier-2` value. ### Example output ```text NAME STATUS ROLES AGE VERSION GPU-CLUSTER-ID TIER-2 TIER-1 HOSTNAME computeinstance-e00f4wsk77x4vsr58s Ready 144d v1.32.9 computegpucluster-e00agxzkvne8558nv8 959d125cbd887219574193fdba27b2c8 282cfcbf8e735653e4ce9884052cb523 computeinstance-e00f4wsk77x4vsr58s computeinstance-e00nm33x3y9597zzxj Ready 54d v1.32.9 computeinstance-e00nm33x3y9597zzxj computeinstance-e00tw5jypq4zvfrsrx Ready 77d v1.32.9 computegpucluster-e00z7ftxx6dacdbra5 5ca19afc3d62844695b08033aeba635b 297bbb6a0db40d875c266b589dc95f5b computeinstance-e00tw5jypq4zvfrsrx computeinstance-e00v7g42bam61yqzp3 Ready 144d v1.32.9 computegpucluster-e00agxzkvne8558nv8 959d125cbd887219574193fdba27b2c8 04011d5d2b17ec74672df94efbbeeb15 computeinstance-e00v7g42bam61yqzp3 ``` Nodes that share the same value for a label belong to the same *topology domain* at that level. A topology domain is a group of nodes that are physically close to each other in the network hierarchy and are therefore expected to have faster communication between them. For example, in the sample output: * `computeinstance-e00f4wsk77x4vsr58s` and `computeinstance-e00v7g42bam61yqzp3` share the same `GPU-CLUSTER-ID` and `TIER-2` values, which means they belong to the same high-speed network domain and the same wider network locality domain. These nodes have different `TIER-1` values, which indicates that they belong to different lower-level locality domains. * `computeinstance-e00tw5jypq4zvfrsrx` belongs to a different GPU cluster and topology hierarchy because all of its topology label values are different. * `computeinstance-e00nm33x3y9597zzxj` does not have topology labels. This usually means that the node is not attached to a GPU cluster, or TAS is not enabled. The exact physical meaning of each tier depends on the infrastructure configuration and is not guaranteed to match these examples. ## How to enable topology-aware scheduling [Kueue](https://kueue.sigs.k8s.io/docs/concepts/topology_aware_scheduling/) is used below as an example scheduler. You can also use other schedulers that support TAS, such as [Volcano](https://volcano.sh/en/docs/network_topology_aware_scheduling/). ### Steps #### Install and configure Kueue 1. [Install Kueue](https://kueue.sigs.k8s.io/docs/getting-started/installation/#install-a-released-version). 2. Enable TAS: ```bash kubectl -n kueue-system patch deployment kueue-controller-manager \ --type json \ -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=TopologyAwareScheduling=true"}]' ``` 3. Create a file named `kueue-tas.yaml` to configure the Kueue resources: ```yaml apiVersion: kueue.x-k8s.io/v1beta2 kind: Topology metadata: name: ib-topology spec: levels: - nodeLabel: "topology.nebius.com/gpu-cluster-id" - nodeLabel: "topology.nebius.com/tier-2" - nodeLabel: "topology.nebius.com/tier-1" - nodeLabel: "kubernetes.io/hostname" --- apiVersion: kueue.x-k8s.io/v1beta2 kind: ResourceFlavor metadata: name: gpu-flavor-tas spec: nodeLabels: nebius.com/node-group-id: "" topologyName: "ib-topology" tolerations: - key: "nvidia.com/gpu" operator: "Exists" effect: "NoSchedule" --- apiVersion: kueue.x-k8s.io/v1beta2 kind: ClusterQueue metadata: name: gpu-cluster-queue-tas spec: namespaceSelector: {} resourceGroups: - coveredResources: ["cpu", "memory", "nvidia.com/gpu"] flavors: - name: "gpu-flavor-tas" resources: - name: "cpu" nominalQuota: 100 - name: "memory" nominalQuota: "100Gi" - name: "nvidia.com/gpu" nominalQuota: "16" --- apiVersion: kueue.x-k8s.io/v1beta2 kind: LocalQueue metadata: name: gpu-user-queue-tas namespace: default spec: clusterQueue: gpu-cluster-queue-tas ``` To get the ``, open your Kubernetes cluster in the web console, go to the **Node groups** tab and copy the node group ID. 4. Apply the configuration: ```bash kubectl apply -f kueue-tas.yaml ``` 5. Check that the Kueue resources were created: ```bash kubectl get topology,resourceflavor,clusterqueue,localqueue ``` #### Schedule workloads with TAS using Kueue To request TAS, add a topology annotation to the Pod template of your workload. 1. Create a file named `job-tas.yaml` that requests TAS for the workload: ```yaml apiVersion: batch/v1 kind: Job metadata: name: job-tas namespace: default labels: kueue.x-k8s.io/queue-name: gpu-user-queue-tas spec: parallelism: completions: completionMode: Indexed template: metadata: annotations: spec: containers: - name: dummy-job image: registry.k8s.io/e2e-test-images/agnhost:2.53 args: ["pause"] resources: requests: cpu: "100m" memory: "100Mi" nvidia.com/gpu: 8 limits: nvidia.com/gpu: 8 restartPolicy: Never ``` Replace the following variables: * ``: Number of Pods that are running in parallel. * ``: Requested topology constraint. See the following table for available values: | Scenario | Description | Value of `` | | - | - | - | | Required to run within a GPU cluster | Kueue admits the workload only if enough resources are available within the same GPU cluster. Otherwise, the workload remains pending until resources become available or the topology constraint changes. | `kueue.x-k8s.io/podset-required-topology: "topology.nebius.com/gpu-cluster-id"` | | Required to run within a topology domain | Kueue admits the workload only if enough resources are available within the same topology domain. Otherwise, the workload remains pending until resources become available or the topology constraint changes. | `kueue.x-k8s.io/podset-required-topology: "topology.nebius.com/tier-2"` | | Preferred to run within a topology domain | Kueue tries to schedule Pods within the same topology domain. If this is not possible, Kueue can place Pods across multiple topology domains. | `kueue.x-k8s.io/podset-preferred-topology: "topology.nebius.com/tier-2"` | In Kueue, a *podset* represents a group of Pods belonging to the same workload (for example, replicas of a Job). 2. Create the Job: ```bash kubectl apply -f job-tas.yaml ``` 3. Check admission status: ```bash kubectl get workloads -A kubectl describe workload -n ``` If Kueue does not admit the workload, reduce parallelism, use less restrictive topology constraints or increase available GPU capacity. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Running NCCL tests in a Managed Service for Kubernetes® cluster with InfiniBand™-connected GPUs Source: https://docs.nebius.com/kubernetes/gpu/nccl-test.md To boost performance of the high-performance computing (HPC) and AI workloads that you run in a Managed Service for Kubernetes cluster, you can set it up so that the GPUs on its nodes are interconnected directly using InfiniBand. In this tutorial, you will create a Managed Service for Kubernetes cluster with GPUs interconnected using InfiniBand, install operators and drivers from NVIDIA on it, and run NVIDIA NCCL tests to check InfiniBand performance. ## Costs The tutorial includes the following chargeable resources: * [Compute virtual machines with GPUs](https://docs.nebius.com/compute/resources/pricing.md) * [Managed Service for Kubernetes cluster](https://docs.nebius.com/kubernetes/resources/pricing.md) ## Prerequisites 1. Set up the interface that you are going to use: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to generate a kubeconfig file for kubectl. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to generate a kubeconfig file for kubectl. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > You will use the CLI to generate a kubeconfig file for kubectl. 2. Get the IDs of the default subnet and the `k8s-node-group-sa` default service account: > [tab] CLI > > ```bash > export SUBNET_ID=$(nebius vpc subnet list \ > --format jsonpath='{.items[0].metadata.id}') > export SA_ID=$(nebius iam service-account get-by-name \ > --name k8s-node-group-sa \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > subnets, err := sdk.Services().VPC().V1(). > Subnet().List(ctx, &vpc.ListSubnetsRequest{}) > if err != nil { > return err > } > if len(subnets.GetItems()) == 0 { > return errors.New("no subnets found") > } > subnetID := subnets.GetItems()[0].GetMetadata().GetId() > serviceAccount, err := sdk.Services().IAM().V1(). > ServiceAccount().GetByName( > ctx, > &iam.GetServiceAccountByNameRequest{ > Name: "k8s-node-group-sa", > }, > ) > if err != nil { > return err > } > saID := serviceAccount.GetMetadata().GetId() > if saID == "" { > return errors.New("service account ID is missing") > } > ``` > > The code saves the IDs to the `subnetID` and `saID` variables. > [tab] Python SDK > > ```python > subnet_service = SubnetServiceClient(sdk) > subnets = await subnet_service.list(ListSubnetsRequest()) > if not subnets.items: > raise ValueError("no subnets found") > subnet_id = subnets.items[0].metadata.id > service_account_service = ServiceAccountServiceClient(sdk) > service_account = await service_account_service.get_by_name( > GetServiceAccountByNameRequest(name="k8s-node-group-sa"), > ) > sa_id = service_account.metadata.id > if not sa_id: > raise ValueError("service account ID is missing") > ``` > > The code saves the IDs to the `subnet_id` and `sa_id` variables. > [tab] JavaScript SDK > > ```ts > const subnetService = new SubnetService(sdk); > const subnets = await subnetService.list( > ListSubnetsRequest.create({}), > ); > const subnetId = subnets.items[0]?.metadata?.id; > if (!subnetId) { > throw new Error("no subnets found"); > } > const serviceAccountService = new ServiceAccountService(sdk); > const serviceAccount = await serviceAccountService.getByName( > GetServiceAccountByNameRequest.create({ > name: "k8s-node-group-sa", > }), > ); > const saId = serviceAccount.metadata?.id; > if (!saId) { > throw new Error("service account ID is missing"); > } > ``` > > The code saves the IDs to the `subnetId` and `saId` variables. 3. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [Helm](https://helm.sh/docs/intro/install/). ## Steps ### Set up a Managed Service for Kubernetes cluster with GPUs and InfiniBand 1. Create a GPU cluster: > [tab] CLI > > ```bash > export GPU_CLUSTER_ID=$(nebius compute gpu-cluster create \ > --name k8s-gpus --infiniband-fabric fabric-3 \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > gpuClusterOperation, err := sdk.Services().Compute().V1(). > GpuCluster().Create( > ctx, > &compute.CreateGpuClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "k8s-gpus", > }, > Spec: &compute.GpuClusterSpec{ > InfinibandFabric: "fabric-3", > }, > }, > ) > if err != nil { > return err > } > if _, err = gpuClusterOperation.Wait(ctx); err != nil { > return err > } > gpuClusterID := gpuClusterOperation.ResourceID() > if gpuClusterID == "" { > return fmt.Errorf("GPU cluster ID is missing") > } > ``` > [tab] Python SDK > > ```python > gpu_cluster_service = GpuClusterServiceClient(sdk) > gpu_cluster_operation = await gpu_cluster_service.create( > CreateGpuClusterRequest( > metadata=ResourceMetadata(name="k8s-gpus"), > spec=GpuClusterSpec(infiniband_fabric="fabric-3"), > ), > ) > await gpu_cluster_operation.wait() > gpu_cluster_id = gpu_cluster_operation.resource_id > if not gpu_cluster_id: > raise ValueError("GPU cluster ID is missing") > ``` > [tab] JavaScript SDK > > ```ts > const gpuClusterService = new GpuClusterService(sdk); > const gpuClusterOperation = await gpuClusterService.create( > CreateGpuClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "k8s-gpus", > }), > spec: GpuClusterSpec.create({ > infinibandFabric: "fabric-3", > }), > }), > ).result; > await gpuClusterOperation.wait(); > const gpuClusterId = gpuClusterOperation.resourceId(); > if (!gpuClusterId) { > throw new Error("GPU cluster ID is missing"); > } > ``` 2. Create a Managed Service for Kubernetes cluster with a public endpoint: > [tab] CLI > > ```bash > export MK8S_CLUSTER_ID=$(nebius mk8s cluster create \ > --name nccl \ > --control-plane-version 1.36 \ > --control-plane-endpoints-public-endpoint=true \ > --control-plane-subnet-id $SUBNET_ID \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > clusterOperation, err := sdk.Services().MK8S().V1(). > Cluster().Create( > ctx, > &mk8s.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > Name: "nccl", > }, > Spec: &mk8s.ClusterSpec{ > ControlPlane: &mk8s.ControlPlaneSpec{ > Version: "1.36", > SubnetId: subnetID, > Endpoints: &mk8s.ControlPlaneEndpointsSpec{ > PublicEndpoint: &mk8s.PublicEndpointSpec{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = clusterOperation.Wait(ctx); err != nil { > return err > } > mk8sClusterID := clusterOperation.ResourceID() > if mk8sClusterID == "" { > return fmt.Errorf("cluster ID is missing") > } > ``` > [tab] Python SDK > > ```python > cluster_service = ClusterServiceClient(sdk) > cluster_operation = await cluster_service.create( > CreateClusterRequest( > metadata=ResourceMetadata(name="nccl"), > spec=ClusterSpec( > control_plane=ControlPlaneSpec( > version="1.36", > subnet_id=subnet_id, > endpoints=ControlPlaneEndpointsSpec( > public_endpoint=PublicEndpointSpec(), > ), > ), > ), > ), > ) > await cluster_operation.wait() > mk8s_cluster_id = cluster_operation.resource_id > if not mk8s_cluster_id: > raise ValueError("cluster ID is missing") > ``` > [tab] JavaScript SDK > > ```ts > const clusterService = new ClusterService(sdk); > const clusterOperation = await clusterService.create( > CreateClusterRequest.create({ > metadata: ResourceMetadata.create({ > name: "nccl", > }), > spec: ClusterSpec.create({ > controlPlane: ControlPlaneSpec.create({ > version: "1.36", > subnetId, > endpoints: ControlPlaneEndpointsSpec.create({ > publicEndpoint: PublicEndpointSpec.create({}), > }), > }), > }), > }), > ).result; > await clusterOperation.wait(); > const mk8sClusterId = clusterOperation.resourceId(); > if (!mk8sClusterId) { > throw new Error("cluster ID is missing"); > } > ``` 3. Create a node group in the cluster: > [tab] CLI > > ```bash > nebius mk8s node-group create \ > --name nccl-gpu-nodes \ > --parent-id $MK8S_CLUSTER_ID \ > --fixed-node-count 2 \ > --template-service-account-id $SA_ID \ > --template-resources-platform "gpu-h100-sxm" \ > --template-resources-preset "8gpu-128vcpu-1600gb" \ > --template-boot-disk-type network_ssd \ > --template-boot-disk-size-bytes 137438953472 \ > --template-gpu-settings-drivers-preset cuda13.0 \ > --template-gpu-cluster-id $GPU_CLUSTER_ID > ``` > [tab] Go SDK > > ```go > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: "nccl-gpu-nodes", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > ServiceAccountId: saID, > Resources: &mk8s.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "8gpu-128vcpu-1600gb", > }, > }, > BootDisk: &mk8s.DiskSpec{ > Size: &mk8s.DiskSpec_SizeBytes{ > SizeBytes: 137438953472, > }, > Type: mk8s.DiskSpec_NETWORK_SSD, > }, > GpuSettings: &mk8s.GpuSettings{ > DriversPreset: "cuda13.0", > }, > GpuCluster: &mk8s.GpuClusterSpec{ > Id: gpuClusterID, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name="nccl-gpu-nodes", > ), > spec=NodeGroupSpec( > fixed_node_count=2, > template=NodeTemplate( > service_account_id=sa_id, > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="8gpu-128vcpu-1600gb", > ), > boot_disk=DiskSpec( > size_bytes=137438953472, > type=DiskSpec__DiskType.NETWORK_SSD, > ), > gpu_settings=GpuSettings(drivers_preset="cuda13.0"), > gpu_cluster=GpuClusterSpec(id=gpu_cluster_id), > ), > ), > ), > ) > await node_group_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: "nccl-gpu-nodes", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > serviceAccountId: saId, > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "8gpu-128vcpu-1600gb", > }, > }), > bootDisk: DiskSpec.create({ > size: { > $case: "sizeBytes", > sizeBytes: 137438953472, > }, > type: DiskSpec_DiskType.NETWORK_SSD, > }), > gpuSettings: GpuSettings.create({ > driversPreset: "cuda13.0", > }), > gpuCluster: GpuClusterSpec.create({ > id: gpuClusterId, > }), > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` For this tutorial, it is required that: * The node group has the GPU cluster specified. * The node group includes at least two nodes. * The nodes use a [VM platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md) compatible with GPU clusters: | Platform | Presets | [Regions](https://docs.nebius.com/overview/regions.md) | | - | - | - | | NVIDIA® B300 NVLink (`gpu-b300-sxm`) | `8gpu-192vcpu-2768gb` | `uk-south1`, `eu-west2`, `us-north1` | | NVIDIA® B200 NVLink (`gpu-b200-sxm`) | `8gpu-160vcpu-1792gb` | `us-central1` | | NVIDIA® B200 NVLink (`gpu-b200-sxm-a`) | `8gpu-160vcpu-1792gb` | `me-west1` | | NVIDIA® H200 NVLink (`gpu-h200-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1`, `eu-north2`, `eu-west1`, `us-central1` | | NVIDIA® H100 NVLink (`gpu-h100-sxm`) | `8gpu-128vcpu-1600gb` | `eu-north1` | In this example, the nodes use the `gpu-h100-sxm` VM platform with the `8gpu-128vcpu-1600gb` preset. * The nodes use a boot disk image offered by Managed Kubernetes that contains drivers and other components for GPUs. Without this image, you need to install the drivers and components manually. For more details, see [GPU drivers and other components](https://docs.nebius.com/kubernetes/gpu/set-up.md#gpu-drivers-and-other-components). 4. Generate a kubeconfig file with the cluster details for kubectl. This step uses the CLI regardless of the interface that you used to create the cluster. If you created the cluster with an SDK, first save the returned cluster ID to the `MK8S_CLUSTER_ID` environment variable: ```bash export MK8S_CLUSTER_ID= ``` Then, generate the file: ```bash nebius mk8s cluster get-credentials \ --id $MK8S_CLUSTER_ID --external ``` To verify that kubectl is connected to the cluster, you can run `kubectl cluster-info`. ### Run the NCCL tests 1. Install the [Kubeflow Training Operator](https://www.kubeflow.org/docs/components/trainer/legacy-v1/overview/) (also known as Kubeflow Trainer). ```bash kubectl apply --server-side -k "github.com/kubeflow/training-operator/manifests/overlays/standalone?ref=v1.9.3" ``` 2. Create a namespace for the tests, named `nccl-test` in this tutorial: ``` kubectl create ns nccl-test ``` 3. Create `nccl-test.yaml` with an `MPIJob` for your tests. > [!NOTE] > > This example is for 2 nodes. If you [created a node group](https://docs.nebius.com/kubernetes/gpu/nccl-test.md#set-up-a-managed-service-for-kubernetes-cluster-with-gpus-and-infiniband) with a different number of nodes, change accordingly the `mpirun` command in `.spec.mpiReplicaSpecs.Launcher.template.spec.containers[0].args` and the number of workers in `.spec.mpiReplicaSpecs.Worker.replicas`. > [accordion] nccl-test.yaml — NVIDIA B200 GPUs > > ```yaml > apiVersion: kubeflow.org/v1 > kind: MPIJob > metadata: > name: nccl-test-nebius > spec: > slotsPerWorker: 8 # Number of GPUs on each node > mpiReplicaSpecs: > Launcher: > replicas: 1 > template: > spec: > containers: > - args: > # In `-np 16`, 16 is the total number of GPUs on all nodes > # (`.spec.slotsPerWorker` × `.spec.mpiReplicaSpecs.Worker.replicas`) > - 'mpirun -np 16 -bind-to none -x LD_LIBRARY_PATH > -x NCCL_DEBUG=INFO -x NCCL_SOCKET_IFNAME=eth0 > -mca coll ^hcoll > -x UCX_NET_DEVICES=eth0 > -x NCCL_IB_HCA=mlx5 > -x SHARP_COLL_ENABLE_PCI_RELAXED_ORDERING=1 > -x NCCL_COLLNET_ENABLE=0 > /opt/nccl_tests/build/all_reduce_perf -b 512M -e 8G -f 2 -g 1' > command: > - /bin/bash > - -c > env: > - name: OMPI_ALLOW_RUN_AS_ROOT > value: "1" > - name: OMPI_ALLOW_RUN_AS_ROOT_CONFIRM > value: "1" > image: cr.eu-north1.nebius.cloud/nebius-benchmarks/nccl-tests:2.26.5-ubu22.04-cu12.8 > name: nccl > resources: > requests: > cpu: 2 > memory: 1208Mi > securityContext: > privileged: true > initContainers: > - command: > - sh > - -c > - ulimit -Hl unlimited && ulimit -Sl unlimited > image: busybox:1.27.2 > name: init-limit > securityContext: > privileged: true > Worker: > replicas: 2 # Number of nodes > template: > spec: > automountServiceAccountToken: false > containers: > - image: cr.eu-north1.nebius.cloud/nebius-benchmarks/nccl-tests:2.26.5-ubu22.04-cu12.8 > name: nccl > resources: > # If you have other applications running in your cluster, > # adjust the `cpu` and `memory` values according to > # the resources available on the nodes > limits: > cpu: 96 > memory: 1600G > nvidia.com/gpu: 8 > requests: > cpu: 96 > memory: 1600G > nvidia.com/gpu: 8 > securityContext: > privileged: true > volumeMounts: > - mountPath: /dev/shm > name: dshm > enableServiceLinks: false > initContainers: > - command: > - sh > - -c > - ulimit -Hl unlimited && ulimit -Sl unlimited > image: busybox:1.27.2 > name: init-limit > securityContext: > privileged: true > volumes: > - emptyDir: > medium: Memory > name: dshm > runPolicy: > cleanPodPolicy: Running > ``` > [accordion] nccl-test.yaml — NVIDIA H200 or H100 GPUs > > ```yaml > apiVersion: kubeflow.org/v1 > kind: MPIJob > metadata: > name: nccl-test-nebius > spec: > slotsPerWorker: 8 # Number of GPUs on each node > mpiReplicaSpecs: > Launcher: > replicas: 1 > template: > spec: > containers: > - args: > # In `-np 16`, 16 is the total number of GPUs on all nodes > # (`.spec.slotsPerWorker` × `.spec.mpiReplicaSpecs.Worker.replicas`) > - 'mpirun -np 16 -bind-to none -x LD_LIBRARY_PATH > -x NCCL_DEBUG=INFO -x NCCL_SOCKET_IFNAME=eth0 > -x NCCL_IB_HCA=mlx5 > -x UCX_NET_DEVICES=eth0 > -x SHARP_COLL_ENABLE_PCI_RELAXED_ORDERING=1 > -x NCCL_COLLNET_ENABLE=0 > /opt/nccl_tests/build/all_reduce_perf -b 512M -e 8G -f 2 -g 1' > command: > - /bin/bash > - -c > env: > - name: OMPI_ALLOW_RUN_AS_ROOT > value: "1" > - name: OMPI_ALLOW_RUN_AS_ROOT_CONFIRM > value: "1" > image: cr.eu-north1.nebius.cloud/nebius-benchmarks/nccl-tests:2.23.4-ubu22.04-cu12.4 > name: nccl > resources: > requests: > cpu: 2 > memory: 1208Mi > securityContext: > privileged: true > initContainers: > - command: > - sh > - -c > - ulimit -Hl unlimited && ulimit -Sl unlimited > image: busybox:1.27.2 > name: init-limit > securityContext: > privileged: true > Worker: > replicas: 2 # Number of nodes > template: > spec: > automountServiceAccountToken: false > containers: > - image: cr.eu-north1.nebius.cloud/nebius-benchmarks/nccl-tests:2.23.4-ubu22.04-cu12.4 > name: nccl > resources: > # If you have other applications running in your cluster, > # adjust the `cpu` and `memory` values according to > # the resources available on the nodes > limits: > cpu: 96 > memory: 1600G > nvidia.com/gpu: 8 > requests: > cpu: 96 > memory: 1600G > nvidia.com/gpu: 8 > securityContext: > privileged: true > volumeMounts: > - mountPath: /dev/shm > name: dshm > enableServiceLinks: false > initContainers: > - command: > - sh > - -c > - ulimit -Hl unlimited && ulimit -Sl unlimited > image: busybox:1.27.2 > name: init-limit > securityContext: > privileged: true > volumes: > - emptyDir: > medium: Memory > name: dshm > runPolicy: > cleanPodPolicy: Running > ``` 4. Deploy the `MPIJob` in `nccl-test`: ```text kubectl apply -f nccl-test.yaml -n nccl-test ``` 5. Check that the test Pods are running: ```bash kubectl get pods -w -n nccl-test ``` Wait until all the Pods are running, like this: ```text NAME READY STATUS RESTARTS AGE nccl-test-nebius-launcher 1/1 Running 0 24s nccl-test-nebius-worker-0 1/1 Running 0 24s nccl-test-nebius-worker-1 1/1 Running 0 24s ``` 6. Check the test logs: ```bash kubectl logs -f nccl-test-nebius-launcher -n nccl-test \ | grep -v "NCCL INFO" ``` In the result, check the average bus bandwidth. If its value is higher than 300 GB/sec, the connection is stable. Example: ``` ... # out-of-place in-place # size count type redop root time algbw busbw #wrong time algbw busbw #wrong # (B) (elements) (us) (GB/s) (GB/s) (us) (GB/s) (GB/s) 536870912 134217728 float sum -1 3674.4 146.11 283.09 0 3648.4 147.15 285.11 0 1073741824 268435456 float sum -1 6411.6 167.47 324.47 0 6416.7 167.33 324.21 0 2147483648 536870912 float sum -1 12735 168.62 326.71 0 12979 165.45 320.57 0 4294967296 1073741824 float sum -1 25389 169.17 327.76 0 25598 167.79 325.09 0 8589934592 2147483648 float sum -1 50979 168.50 326.47 0 50799 169.10 327.63 0 # Out of bounds values : 0 OK # Avg bus bandwidth : 317.11 ``` The average bus bandwidth is not equal to the InfiniBand one as some of the NCCL operations it measures use NVLink. Nevertheless, it accurately estimates the connection. To stop streaming logs, press **Ctrl** + **C**. 7. Delete the `MPIJob`. ```text kubectl delete -f nccl-test.yaml -n nccl-test ``` > [!NOTE] > > You should delete the `MPIJob` even if you want to run another test. In this case, redeploy the `MPIJob` as described in steps 2–3. ## How to delete the created resources Some of the created resources are chargeable. If you do not need them, delete these resources, so Nebius AI Cloud does not charge for them: * Delete the installed operator: ```bash kubectl delete -k "github.com/kubeflow/training-operator/manifests/overlays/standalone?ref=v1.9.3" ``` * Delete the node group with GPUs: > [tab] CLI > > ```bash > export MK8S_CLUSTER_ID=$(nebius mk8s cluster get-by-name \ > --name nccl --format jsonpath='{.metadata.id}') > nebius mk8s node-group delete --id \ > $(nebius mk8s node-group get-by-name \ > --name nccl-gpu-nodes --parent-id $MK8S_CLUSTER_ID \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > cluster, err := sdk.Services().MK8S().V1(). > Cluster().GetByName( > ctx, > &common.GetByNameRequest{Name: "nccl"}, > ) > if err != nil { > return err > } > clusterID := cluster.GetMetadata().GetId() > if clusterID == "" { > return errors.New("cluster ID is missing") > } > nodeGroup, err := sdk.Services().MK8S().V1(). > NodeGroup().GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: clusterID, > Name: "nccl-gpu-nodes", > }, > ) > if err != nil { > return err > } > nodeGroupID := nodeGroup.GetMetadata().GetId() > if nodeGroupID == "" { > return errors.New("node group ID is missing") > } > deleteOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Delete( > ctx, > &mk8s.DeleteNodeGroupRequest{Id: nodeGroupID}, > ) > if err != nil { > return err > } > if _, err = deleteOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > cluster_service = ClusterServiceClient(sdk) > cluster = await cluster_service.get_by_name( > GetByNameRequest(name="nccl"), > ) > cluster_id = cluster.metadata.id > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get_by_name( > GetByNameRequest( > parent_id=cluster_id, > name="nccl-gpu-nodes", > ), > ) > node_group_operation = await node_group_service.delete( > DeleteNodeGroupRequest(id=node_group.metadata.id), > ) > await node_group_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const clusterService = new ClusterService(sdk); > const cluster = await clusterService.getByName( > GetByNameRequest.create({ > name: "nccl", > }), > ); > const clusterId = cluster.metadata?.id; > if (!clusterId) { > throw new Error("cluster ID is missing"); > } > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroup = await nodeGroupService.getByName( > GetByNameRequest.create({ > parentId: clusterId, > name: "nccl-gpu-nodes", > }), > ); > const nodeGroupId = nodeGroup.metadata?.id; > if (!nodeGroupId) { > throw new Error("node group ID is missing"); > } > const deleteOperation = await nodeGroupService.delete( > DeleteNodeGroupRequest.create({ > id: nodeGroupId, > }), > ).result; > await deleteOperation.wait(); > ``` * Delete the entire cluster: > [tab] CLI > > ```bash > nebius mk8s cluster delete --id \ > $(nebius mk8s cluster get-by-name \ > --name nccl --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > clusterToDelete, err := sdk.Services().MK8S().V1(). > Cluster().GetByName( > ctx, > &common.GetByNameRequest{Name: "nccl"}, > ) > if err != nil { > return err > } > clusterToDeleteID := clusterToDelete.GetMetadata().GetId() > if clusterToDeleteID == "" { > return errors.New("cluster ID is missing") > } > deleteClusterOperation, err := sdk.Services().MK8S().V1(). > Cluster().Delete( > ctx, > &mk8s.DeleteClusterRequest{Id: clusterToDeleteID}, > ) > if err != nil { > return err > } > if _, err = deleteClusterOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > delete_cluster_service = ClusterServiceClient(sdk) > cluster_to_delete = await delete_cluster_service.get_by_name( > GetByNameRequest(name="nccl"), > ) > cluster_operation = await delete_cluster_service.delete( > DeleteClusterRequest(id=cluster_to_delete.metadata.id), > ) > await cluster_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const deleteClusterService = new ClusterService(sdk); > const clusterToDelete = await deleteClusterService.getByName( > GetByNameRequest.create({ > name: "nccl", > }), > ); > const clusterToDeleteId = clusterToDelete.metadata?.id; > if (!clusterToDeleteId) { > throw new Error("cluster ID is missing"); > } > const deleteClusterOperation = await deleteClusterService.delete( > DeleteClusterRequest.create({ > id: clusterToDeleteId, > }), > ).result; > await deleteClusterOperation.wait(); > ``` *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Managing AI workloads across Managed Service for Kubernetes® clusters with SkyPilot Source: https://docs.nebius.com/kubernetes/skypilot.md You can use Managed Service for SkyPilot as a single, declarative job surface that runs your AI workloads across one or more [Managed Service for Kubernetes](https://docs.nebius.com/kubernetes.md) clusters. Managed SkyPilot picks the best cluster for each job based on hardware availability and the constraints in the task definition, and ensures fault tolerance across clusters when capacity is tight in the preferred one. The SkyPilot placement logic combines constraint matching with policy: * With *capability match*, Managed SkyPilot filters clusters by whether they meet the requested hardware and features, such as the GPU model, the number of GPUs per node, InfiniBand™ or a shared filesystem. * With *capacity chasing*, Managed SkyPilot chases capacity across other clusters or regions when the preferred cluster has insufficient capacity. * With *failover and retries*, Managed SkyPilot handles provisioning failures, such as preemptions or insufficient capacity, by automatically retrying with other matching clusters. ## Costs Nebius AI Cloud charges you only for [Managed Kubernetes nodes](https://docs.nebius.com/kubernetes/resources/pricing.md). ## Steps ### Install dependencies 1. Make sure you have Python 3.10 or higher [installed](https://www.python.org/downloads/). 2. Install the SkyPilot CLI with Kubernetes and Nebius support: ```bash pip3 install "skypilot[kubernetes,nebius]" ``` ### Prepare infrastructure 1. Create a Managed SkyPilot server: 1. In the Nebius AI Cloud console, go to  **AI orchestration** → **SkyPilot**. If you don't have a Managed SkyPilot server in your project, a landing page opens. 2. Click  **Create server**. The creation page opens. 3. Enter a name for the server or keep the default one. 4. Click **Create server**. 2. Connect to the Managed SkyPilot server: ```bash sky api login -e "https://skypilot.nebius.cloud" ``` 3. Check that SkyPilot can reach your project: ```bash sky check kubernetes ``` At this stage, no Managed Kubernetes clusters have been added yet, so the output looks similar to the following: ```text Checking credentials to enable infra for SkyPilot. Kubernetes: disabled Reason [compute]: No available context found in kubeconfig. 🎉 Enabled infra 🎉 No infra to check/enabled. ``` You will run the same command again later to confirm that the contexts are picked up. 4. [Create](https://docs.nebius.com/kubernetes/clusters/manage.md) at least one Managed Kubernetes cluster with a GPU node group. To demonstrate cross-cluster fault tolerance, create two or more clusters. ### Add Managed Kubernetes clusters to Managed SkyPilot The Managed SkyPilot server auto-discovers all Managed Kubernetes clusters in the same project. You don't need to add a local kubeconfig or configure a service account. 1. Open the SkyPilot dashboard. On the server page in the web console, click **How to connect** and then open the public endpoint URL. 2. On the dashboard, go to the **Infra** tab and click **Refresh**. The dashboard lists the Managed Kubernetes clusters available to Managed SkyPilot. 3. Verify that SkyPilot can access the clusters: ```bash sky check kubernetes ``` The output lists the enabled contexts: ```text Kubernetes: enabled [compute] Allowed contexts: ├── : enabled. └── : enabled. 🎉 Enabled infra 🎉 Kubernetes [compute] Allowed contexts: ├── └── ``` 4. (Optional) For detailed per-cluster and per-node GPU availability, run: ```bash sky show-gpus ``` The output shows the available GPUs and per-node availability: ```text GPU REQUESTABLE_QTY_PER_NODE UTILIZATION H100 1, 2, 4, 8 24 of 24 free Kubernetes per-node GPU availability CONTEXT NODE vCPU Memory (GB) GPU GPU UTILIZATION NODE STATUS computeinstance- - - H100 8 of 8 free Healthy computeinstance- - - H100 8 of 8 free Healthy ``` ### (Optional) Limit clusters that Managed SkyPilot uses By default, Managed SkyPilot can place jobs on any Managed Kubernetes cluster it discovers. To restrict Managed SkyPilot to a subset of clusters for every user of this server, set `kubernetes.allowed_contexts` in the dashboard: 1. In the SkyPilot dashboard, click **Configuration**. 2. In the **Edit SkyPilot API Server Configuration** textbox, paste the following YAML, listing the contexts in the order in which SkyPilot should evaluate them: ```yaml kubernetes: allowed_contexts: - - ``` 3. Click **Apply**. To verify which contexts are enabled, run `sky check kubernetes` again. ### Run a job Decide how Managed SkyPilot should choose the target Managed Kubernetes cluster: * **To let Managed SkyPilot fail over across clusters**, run `sky launch` without specifying a cluster: ```bash sky launch --gpus H100 --infra k8s echo 'Hello World' ``` Managed SkyPilot picks the first context that satisfies the request and submits the job: ```text Considered resources (1 node): ---------------------------------------------------------------------------------------------------- INFRA INSTANCE vCPUs Mem(GB) GPUS COST ($) CHOSEN ---------------------------------------------------------------------------------------------------- Kubernetes () - 4 16 H100:1 0.00 ✔ ---------------------------------------------------------------------------------------------------- Launching a new cluster 'sky-...'. Proceed? [Y/n]: y ``` * **To target a specific Managed Kubernetes cluster**, set `--infra k8s/`: ```bash sky launch --gpus H100 --infra k8s/ echo 'Hello World' ``` If the targeted cluster does not have the requested resources, SkyPilot returns an error: ```text sky.exceptions.ResourcesUnavailableError: Kubernetes cluster does not contain any instances satisfying the request: 1x Kubernetes({'H100': 1}, region=). To fix: relax or change the resource requirements. ``` In the `--gpus` parameter, set the node group [platform](https://docs.nebius.com/compute/virtual-machines/types.md), such as `H100`, `B300` or `L40S`. Both examples run a Bash command as the entrypoint. You can also pass a YAML task definition instead. For examples, see the [SkyPilot quickstart](https://docs.skypilot.co/en/latest/getting-started/quickstart.html). ### (Optional) Monitor jobs To list all SkyPilot jobs created during this tutorial and their statuses, run: ```bash sky status ``` To stream the logs of a job, run: ```bash sky logs ``` ## How to delete the created resources Some of the created resources are chargeable. If you don't need them, delete these resources, so Nebius AI Cloud doesn't charge for them: * Delete SkyPilot jobs created during this tutorial: ```bash sky down --all -y ``` * [Delete Managed Kubernetes clusters](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-delete-clusters). * If you no longer need the Managed SkyPilot server, delete it in the Nebius AI Cloud console. Go to  **AI orchestration** → **SkyPilot**, open the **Settings** tab, and click **Delete server**. *** *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Mounting disks to Pods in a Managed Service for Kubernetes® cluster Source: https://docs.nebius.com/kubernetes/storage/disk-over-csi.md Nebius AI Cloud offers persistent storage for Pods in Managed Service for Kubernetes clusters. In this tutorial, you will mount a Compute disk as a persistent volume to a Pod in your cluster. ## Background By default, files created or modified by a container in a Kubernetes Pod are lost when the container crashes, or is stopped or restarted. [Persistent volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) help you avoid this: they keep the files for the lifetime of the Pod, regardless of the states of its individual containers to the Pod. These volumes are mounted to a node that is running the Pod. In Nebius AI Cloud, Managed Service for Kubernetes offers a native solution for persistent volumes in your clusters. You can mount disks from another Nebius AI Cloud service, Compute, to your Pods as persistent volumes. Compute provides multiple disk types that vary in performance, reliability and price, and you can choose between them depending on your use case. For more details, see the [Compute documentation](https://docs.nebius.com/compute/storage/types.md#disks). Mounting disks to Pods relies on support for Container Storage Interface (CSI), which is enabled on newer Managed Kubernetes clusters and can be enabled for older clusters (see prerequisites below). A disk can be used on one node at a time. If you need to share data between Pods and nodes, use Compute shared filesystems instead of disks. See [Mounting shared filesystems to Pods in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md) for details. ## Costs Nebius AI Cloud only charges for a Compute disk. For more details, see the [Compute pricing](https://docs.nebius.com/compute/resources/pricing.md#disks). ## Prerequisites 1. [Create a Managed Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md) or choose an existing one. 2. If you are working with an existing cluster, [verify that it supports CSI](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md#verify-that-your-cluster-supports-csi). 3. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [connect to the cluster](https://docs.nebius.com/kubernetes/connect.md). [Nebius AI Cloud disks](https://docs.nebius.com/compute/storage/types.md#disks) are created automatically; you do not need to create them beforehand. ### Verify that your cluster supports CSI If your Managed Kubernetes cluster was created on or after January 7, 2025, it already supports CSI and no additional configuration is required. Proceed to the tutorial's [steps](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md#steps). If your cluster was created before January 7, 2025, enable CSI support in it: > [accordion] How to enable CSI support > > 1. Get IDs of the node groups in the cluster: > > > [tab] Web console > > > > 1. In [Managed Kubernetes](https://console.nebius.com/mk8s), open your cluster. > > 2. Switch to the **Node groups** tab. > > 3. For each node group, find its ID under its name and click to copy it. > > > [tab] CLI > > > > 1. Get the cluster ID. List all clusters: > > > > ```bash > > nebius mk8s cluster list > > ``` > > > > Alternatively, look the cluster up by name: > > > > ```bash > > nebius mk8s cluster get-by-name --name > > ``` > > > > The cluster ID is returned in `.metadata.id`. > > > > 2. Get the list of the cluster's node groups, by using the cluster ID as parent ID: > > > > ```bash > > nebius mk8s node-group list --parent-id > > ``` > > > > The IDs of the node groups are returned in the `.metadata.id` fields. > > > [tab] Go SDK > > > > 1. Get the cluster ID. List all clusters: > > > > ```go > > clusterService := sdk.Services().MK8S().V1().Cluster() > > clusters, err := clusterService.List( > > ctx, > > &mk8s.ListClustersRequest{}, > > ) > > if err != nil { > > return err > > } > > fmt.Println(clusters) > > ``` > > > > Alternatively, look the cluster up by name: > > > > ```go > > clusterLookupService := sdk.Services().MK8S().V1().Cluster() > > cluster, err := clusterLookupService.GetByName( > > ctx, > > &common.GetByNameRequest{ > > Name: "", > > }, > > ) > > if err != nil { > > return err > > } > > fmt.Println(cluster) > > ``` > > > > The cluster ID is returned in `Metadata.Id`. > > > > 2. Get the list of the cluster's node groups, by using the cluster ID as `ParentId`: > > > > ```go > > nodeGroupService := sdk.Services().MK8S().V1().NodeGroup() > > nodeGroups, err := nodeGroupService.List( > > ctx, > > &mk8s.ListNodeGroupsRequest{ > > ParentId: "", > > }, > > ) > > if err != nil { > > return err > > } > > fmt.Println(nodeGroups) > > ``` > > > > The IDs of the node groups are returned in `Metadata.Id`. > > > [tab] Python SDK > > > > 1. Get the cluster ID. List all clusters: > > > > ```python > > cluster_service = ClusterServiceClient(sdk) > > clusters = await cluster_service.list(ListClustersRequest()) > > print(clusters) > > ``` > > > > Alternatively, look the cluster up by name: > > > > ```python > > cluster_service = ClusterServiceClient(sdk) > > cluster = await cluster_service.get_by_name( > > GetByNameRequest(name=""), > > ) > > print(cluster) > > ``` > > > > The cluster ID is returned in `metadata.id`. > > > > 2. Get the list of the cluster's node groups, by using the cluster ID as `parent_id`: > > > > ```python > > node_group_service = NodeGroupServiceClient(sdk) > > node_groups = await node_group_service.list( > > ListNodeGroupsRequest(parent_id=""), > > ) > > print(node_groups) > > ``` > > > > The IDs of the node groups are returned in `metadata.id`. > > > [tab] JavaScript SDK > > > > 1. Get the cluster ID. List all clusters: > > > > ```ts > > const clusterService = new ClusterService(sdk); > > const clusters = await clusterService.list( > > ListClustersRequest.create({}), > > ); > > console.log(clusters); > > ``` > > > > Alternatively, look the cluster up by name: > > > > ```ts > > const clusterLookupService = new ClusterService(sdk); > > const cluster = await clusterLookupService.getByName( > > GetByNameRequest.create({ > > name: "", > > }), > > ); > > console.log(cluster); > > ``` > > > > The cluster ID is returned in `metadata.id`. > > > > 2. Get the list of the cluster's node groups, by using the cluster ID as `parentId`: > > > > ```ts > > const nodeGroupService = new NodeGroupService(sdk); > > const nodeGroups = await nodeGroupService.list( > > ListNodeGroupsRequest.create({ > > parentId: "", > > }), > > ); > > console.log(nodeGroups); > > ``` > > > > The IDs of the node groups are returned in `metadata.id`. > > 2. Upgrade each node group: > > > [tab] CLI > > > > ```bash > > nebius mk8s node-group upgrade --id --latest-infra-version > > ``` > > > [tab] Go SDK > > > > ```go > > upgradeOperation, err := sdk.Services().MK8S().V1(). > > NodeGroup().Upgrade( > > ctx, > > &mk8s.UpgradeNodeGroupRequest{ > > Id: "", > > LatestInfraVersion: &emptypb.Empty{}, > > }, > > ) > > if err != nil { > > return err > > } > > if _, err = upgradeOperation.Wait(ctx); err != nil { > > return err > > } > > ``` > > > [tab] Python SDK > > > > ```python > > node_group_service = NodeGroupServiceClient(sdk) > > upgrade_operation = await node_group_service.upgrade( > > UpgradeNodeGroupRequest( > > id="", > > latest_infra_version=Empty(), > > ), > > ) > > await upgrade_operation.wait() > > ``` > > > [tab] JavaScript SDK > > > > ```ts > > const nodeGroupUpgradeService = new NodeGroupService(sdk); > > const upgradeOperation = await nodeGroupUpgradeService.upgrade( > > UpgradeNodeGroupRequest.create({ > > id: "", > > latestInfraVersion: {}, > > }), > > ).result; > > await upgradeOperation.wait(); > > ``` > > 3. [Contact support](https://console.nebius.com/support) or your solution architect to enable CSI support. ## Steps ### Create a storage class for custom provisioning (optional) Before using Compute disks as persistent volumes, you can choose how disks are provisioned: the [disk type](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks), the filesystem type (ext4 or xfs) and when a disk should be created (together with a persistent volume claim or when the claim is used by a Pod). To do this, define a custom Kubernetes storage class. > [!NOTE] > > The default storage class offered by Managed Kubernetes, `compute-csi-default-sc`, creates a [Network SSD disk](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks) with an ext4 filesystem, and does so when a Pod that uses a persistent volume claim with this storage class is created. If this configuration suits you, you can skip this step and proceed to [creating a persistent volume claim](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md#create-a-persistent-volume-claim). To create a custom storage class: 1. Create a manifest, for example `storage-class.yaml`, that defines the storage class. For example: ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: storage-test-class provisioner: compute.csi.nebius.com volumeBindingMode: WaitForFirstConsumer parameters: csi.storage.k8s.io/fstype: xfs type: "NETWORK_SSD_IO_M3" disk_block_size_bytes: "4096" encrypted: "true" ``` * `.metadata.name` — Name of the storage class. Use it when referring to the class in [persistent volume claims](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md#create-a-persistent-volume-claim) (`.spec.storageClassName`). * `.provisioner` — Volume [provisioner](https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner). For Nebius AI Cloud disks, the provisioner is `compute.csi.nebius.com`. * `.volumeBindingMode` — [Volume binding mode](https://kubernetes.io/docs/concepts/storage/storage-classes/#volume-binding-mode) that determines when a Nebius AI Cloud disk is created for a persistent volume claim of this storage class. Supported values are `WaitForFirstConsumer` (the disk is created together with a Pod that uses the claim) or `Immediate` (the disk is created together with the claim, even if no Pods use it yet). > [!TIP] > > Disks created in the `Immediate` binding mode may start to be [charged](https://docs.nebius.com/compute/resources/pricing.md#disks) and to count towards [quotas](https://docs.nebius.com/compute/resources/quotas-limits.md#storage) before being actually used in Pods. To avoid this, use the `WaitForFirstConsumer` binding mode. * `.parameters."csi.storage.k8s.io/fstype"` — Filesystem for disks: `ext4` or `xfs`. * `.parameters.type` — Nebius AI Cloud disk type. See the [list of network disk types and their IDs](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks). Write IDs in uppercase, for example, `NETWORK_SSD`, `NETWORK_SSD_IO_M3`. * `.parameters.disk_block_size_bytes` — [Block size](https://docs.nebius.com/compute/storage/manage.md#type-encryption-and-size) of disks, in bytes. The value must be a power of two between `"4096"` (default) and `"131072"`. The block size cannot be changed after the disk is created. With the default block size, a disk cannot exceed 16 TiB. For larger disks, set a larger block size. * `.parameters.encrypted` — Whether to enable [encryption](https://docs.nebius.com/compute/storage/types.md#encryption-of-disks) for disks: `"true"` or `"false"` (default). Set this parameter to `"true"` only for `NETWORK_SSD_NON_REPLICATED` and `NETWORK_SSD_IO_M3` disks. `NETWORK_SSD` disks are always encrypted, and setting `encrypted: "true"` for them causes disk provisioning to fail. 2. Apply the manifest to your cluster: ```bash kubectl apply -f storage-class.yaml ``` ### Create a persistent volume claim Persistent volume claims are requests that Pods make for persistent volumes. These requests include what kind of storage should be provided (in our case, a Compute disk with the default or a custom storage class) and how large it should be. To create a persistent volume claim: 1. Create a manifest, for example `pvc.yaml`, that defines the claim. For example: ```yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: storage-test-claim spec: accessModes: - ReadWriteOnce storageClassName: compute-csi-default-sc resources: requests: storage: 4Gi ``` * `.metadata.name` — Name of your claim. Use it when referring to the claim in Pod configurations. * `.spec.accessModes` — Array of [access modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) that determine how the persistent volume can be mounted to nodes. The only mode supported for Nebius AI Cloud block storage is `ReadWriteOnce`; the volume can be mounted as read-write by a single node. For storage that can be mounted to multiple nodes (`ReadWriteMany`), see [Mounting shared filesystems to Pods in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md). * `.spec.storageClassName` — [Storage class](https://kubernetes.io/docs/concepts/storage/storage-classes/) of the volume. The default storage class for Nebius AI Cloud block storage, `compute-csi-default-sc`, creates a [Network SSD disk](https://docs.nebius.com/compute/storage/types.md#network-ssd-disks) with an ext4 filesystem. To use another disk type or filesystem, [create a custom storage class](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md#create-a-storage-class-for-custom-provisioning-optional) by using the Nebius AI Cloud provisioner and specify its name here. * `.spec.resources.requests.storage` — Volume size. 2. Apply the manifest to your cluster: ```bash kubectl apply -f pvc.yaml ``` ### Mount a volume to a Pod and test it When a persistent volume claim is used in a Pod's specification, the Compute disk created for the claim is mounted to the Pod as a persistent volume. > [!WARNING] > > A disk created for a claim is mounted to each Pod that uses the claim, and is deleted together with the claim. Do not use a claim on multiple Pods at one time, as a disk can only be mounted to a single node. For a solution that shares storage between nodes, see [Mounting shared filesystems to Pods in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md). To create a Pod with a volume and test it: 1. Create a manifest, for example `pod.yaml`, that defines the Pod. For example, in the manifest below, a volume named `persistent-storage`, created from the `test-claim` persistent volume claim, is mounted to the Pod's container at `/data`: ```yaml apiVersion: v1 kind: Pod metadata: name: storage-test-app spec: volumes: - name: persistent-storage persistentVolumeClaim: claimName: storage-test-claim containers: - name: app image: centos command: ["/bin/sh"] args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"] volumeMounts: - name: persistent-storage mountPath: /data ``` * `.spec.volumes[0].name`: Name of the volume that is created for the Pod. * `.spec.volumes[0].persistentVolumeClaim.claimName`: Name of the persistent volume claim that is used to create a volume. * `.spec.containers[0].volumeMounts[0].name`: Same volume name as in `.spec.volumes[0].name`. * `.spec.containers[0].volumeMounts[0].mountPath`: Mount point for the volume. > [!NOTE] > > You can configure volumes in Kubernetes resources that manage Pods, like [Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) or [StatefulSets](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/), in the same way, by using sub-fields of `.spec.template.spec.volumes` and `.spec.template.spec.containers`. 2. Apply the manifest to your cluster: ```bash kubectl apply -f pod.yaml ``` 3. Wait until the Pod is ready: ```bash kubectl wait --for condition=Ready=true pod/storage-test-app ``` 4. Test that the container has written into `/data/out.txt`: ```bash kubectl exec storage-test-app -- cat /data/out.txt ``` ## How to delete the created resources The created Compute disk is chargeable. If you do not need it, delete the Pod and the persistent volume claim, so that the disk is deleted and Nebius AI Cloud does not charge for it: ```bash kubectl delete pod/storage-test-app pvc/storage-test-claim ``` ## See also * [Mounting shared filesystems to Pods in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md) * [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md) # Mounting shared filesystems to Pods in a Managed Service for Kubernetes® cluster Source: https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md In this tutorial, you will use a Container Storage Interface (CSI) driver offered by Nebius AI Cloud to mount a Compute shared filesystem to nodes in a Managed Service for Kubernetes and use it as a persistent volume shared between Pods running on the nodes. To work with disks that can be mounted to a single node instead of shared filesystems, see [Mounting disks to Pods in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md). ## Costs The tutorial includes the following chargeable resources: * [Compute shared filesystem](https://docs.nebius.com/compute/resources/pricing.md#shared-filesystems) * [Compute virtual machines](https://docs.nebius.com/compute/resources/pricing.md) that make up a node group ## Prerequisites 1. Set up the interface that you are going to use: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. The CLI commands in this article assume that the CLI is properly configured. For example, they omit the ID of the parent project, as it is assumed to be set in the CLI profile. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 3. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and [Helm](https://helm.sh/docs/intro/install/). 4. Install `jq`: ```bash Ubuntu sudo apt-get install jq ``` ```bash macOS brew install jq ``` 5. [Create a Managed Kubernetes cluster](https://docs.nebius.com/kubernetes/clusters/manage.md) or use an existing one. ## Steps ### Create a shared filesystem Create a 256 GiB SSD shared filesystem: > [tab] CLI > > ```bash > nebius compute filesystem create \ > --name mk8s-csi-storage \ > --size-gibibytes 256 \ > --type network_ssd \ > --block-size-bytes 4096 > ``` > > When setting the filesystem size (`size-gibibytes`), make sure it is enough for all your Pods to store their data. > [tab] Go SDK > > ```go > filesystemOperation, err := sdk.Services().Compute().V1(). > Filesystem().Create( > ctx, > &compute.CreateFilesystemRequest{ > Metadata: &common.ResourceMetadata{ > Name: "mk8s-csi-storage", > }, > Spec: &compute.FilesystemSpec{ > Size: &compute.FilesystemSpec_SizeGibibytes{ > SizeGibibytes: 256, > }, > BlockSizeBytes: 4096, > Type: compute.FilesystemSpec_NETWORK_SSD, > }, > }, > ) > if err != nil { > return err > } > if _, err = filesystemOperation.Wait(ctx); err != nil { > return err > } > filesystemID := filesystemOperation.ResourceID() > if filesystemID == "" { > return fmt.Errorf("filesystem ID is missing") > } > ``` > > When setting the filesystem size (`SizeGibibytes`), make sure it is enough for all your Pods to store their data. The code saves the new filesystem's ID to `filesystemID`. > [tab] Python SDK > > ```python > filesystem_service = FilesystemServiceClient(sdk) > filesystem_operation = await filesystem_service.create( > CreateFilesystemRequest( > metadata=ResourceMetadata(name="mk8s-csi-storage"), > spec=FilesystemSpec( > block_size_bytes=4096, > type=FilesystemSpec.FilesystemType.NETWORK_SSD, > size_gibibytes=256, > ), > ), > ) > await filesystem_operation.wait() > filesystem_id = filesystem_operation.resource_id > if not filesystem_id: > raise ValueError("filesystem ID is missing") > ``` > > When setting the filesystem size (`size_gibibytes`), make sure it is enough for all your Pods to store their data. The code saves the new filesystem's ID to `filesystem_id`. > [tab] JavaScript SDK > > ```ts > const filesystemService = new FilesystemService(sdk); > const filesystemOperation = > await filesystemService.create( > CreateFilesystemRequest.create({ > metadata: ResourceMetadata.create({ > name: "mk8s-csi-storage", > }), > spec: FilesystemSpec.create({ > blockSizeBytes: 4096, > type: FilesystemSpec_FilesystemType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 256, > }, > }), > }), > ).result; > await filesystemOperation.wait(); > const filesystemId = filesystemOperation.resourceId(); > if (!filesystemId) { > throw new Error("filesystem ID is missing"); > } > ``` > > When setting the filesystem size (`sizeGibibytes`), make sure it is enough for all your Pods to store their data. The code saves the new filesystem's ID to `filesystemId`. > [!WARNING] > > The filesystem that you are adding to a node group must be located in the same project as the node group's parent cluster. For more details about projects and resource hierarchy in Nebius AI Cloud, see [How resources, identities and access are managed in Nebius AI Cloud](https://docs.nebius.com/iam/overview.md). ### Create a node group and mount the filesystem to nodes > [!WARNING] > > Do not omit `nofail` in the cloud-init user data. If it is not specified and a node cannot find the filesystem on restart (for example, it has been deleted), the node will not boot. > [tab] CLI > > 1. Create the cloud-init user data that will mount the shared filesystem to nodes: > > ```bash > export MOUNT_POINT=/mnt/data > export MOUNT_TAG=csi-storage > export USER_DATA=$(jq -Rrs '.' < runcmd: > - sudo mkdir -p $MOUNT_POINT > - sudo mount -t virtiofs $MOUNT_TAG $MOUNT_POINT > - printf "%s %s virtiofs defaults,nofail 0 2\n" "$MOUNT_TAG" "$MOUNT_POINT" | sudo tee -a /etc/fstab > EOF > ) > ``` > > This will mount the filesystem to nodes at `/mnt/data` as `csi-storage`. To use another mount point or mount tag, modify the variables. > > 2. Create the node group: > > ```bash > nebius mk8s node-group create \ > --parent-id \ > --name "ng-1" \ > --fixed-node-count 2 \ > --template-resources-platform "cpu-e2" \ > --template-resources-preset "2vcpu-8gb" \ > --template-filesystems "[{\"existing_filesystem\": {\"id\": \"\"}, \"attach_mode\": \"READ_WRITE\", \"mount_tag\": \"$MOUNT_TAG\"}]" \ > --template-cloud-init-user-data "$USER_DATA" > ``` > [tab] Go SDK > > Create the node group. `CloudInitUserData` carries the commands that mount the shared filesystem to nodes, and `Filesystems` attaches the filesystem itself: > > ```go > fsAttachMode := mk8s.AttachedFilesystemSpec_READ_WRITE > existingFilesystem := &mk8s.ExistingFilesystem{ > Id: "", > } > filesystemType := &mk8s.AttachedFilesystemSpec_ExistingFilesystem{ > ExistingFilesystem: existingFilesystem, > } > userData := strings.Join([]string{ > "runcmd:", > " - sudo mkdir -p /mnt/data", > " - sudo mount -t virtiofs csi-storage /mnt/data", > ` - printf "%s %s virtiofs defaults,nofail 0 2\n" ` + > `"csi-storage" "/mnt/data" | sudo tee -a /etc/fstab`, > }, "\n") > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "ng-1", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: 2, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "cpu-d3", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > }, > Filesystems: []*mk8s.AttachedFilesystemSpec{ > { > AttachMode: fsAttachMode, > MountTag: "csi-storage", > Type: filesystemType, > }, > }, > CloudInitUserData: userData, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > This mounts the filesystem to nodes at `/mnt/data` as `csi-storage`. To use another mount point or mount tag, modify `userData` and `MountTag`. > [tab] Python SDK > > Create the node group. `cloud_init_user_data` carries the commands that mount the shared filesystem to nodes, and `filesystems` attaches the filesystem itself: > > ```python > filesystem_attach_mode = ( > AttachedFilesystemSpec.AttachMode.READ_WRITE > ) > user_data = "\n".join( > [ > "runcmd:", > " - sudo mkdir -p /mnt/data", > " - sudo mount -t virtiofs csi-storage /mnt/data", > ' - printf "%s %s virtiofs defaults,nofail 0 2\\n" ' > '"csi-storage" "/mnt/data" | sudo tee -a /etc/fstab', > ], > ) > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id="", > name="ng-1", > ), > spec=NodeGroupSpec( > fixed_node_count=2, > template=NodeTemplate( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > filesystems=[ > AttachedFilesystemSpec( > attach_mode=filesystem_attach_mode, > existing_filesystem=ExistingFilesystem( > id="", > ), > mount_tag="csi-storage", > ), > ], > cloud_init_user_data=user_data, > ), > ), > ), > ) > await node_group_operation.wait() > ``` > > This mounts the filesystem to nodes at `/mnt/data` as `csi-storage`. To use another mount point or mount tag, modify `user_data` and `mount_tag`. > [tab] JavaScript SDK > > Create the node group. `cloudInitUserData` carries the commands that mount the shared filesystem to nodes, and `filesystems` attaches the filesystem itself: > > ```ts > const userData = [ > "runcmd:", > " - sudo mkdir -p /mnt/data", > " - sudo mount -t virtiofs csi-storage /mnt/data", > ' - printf "%s %s virtiofs defaults,nofail 0 2\\n" ' + > '"csi-storage" "/mnt/data" | sudo tee -a /etc/fstab', > ].join("\n"); > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "ng-1", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: 2, > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > filesystems: [ > AttachedFilesystemSpec.create({ > attachMode: AttachedFilesystemSpec_AttachMode.READ_WRITE, > mountTag: "csi-storage", > type: { > $case: "existingFilesystem", > existingFilesystem: ExistingFilesystem.create({ > id: "", > }), > }, > }), > ], > cloudInitUserData: userData, > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` > > This mounts the filesystem to nodes at `/mnt/data` as `csi-storage`. To use another mount point or mount tag, modify `userData` and `mountTag`. ### Install the CSI driver 1. Pull the driver's Helm chart: ```bash helm pull \ oci://cr.eu-north1.nebius.cloud/mk8s/helm/csi-mounted-fs-path \ --version 0.1.10 ``` 2. Install the chart: ```bash helm upgrade csi-mounted-fs-path ./csi-mounted-fs-path-0.1.10.tgz --install \ --set dataDir=$MOUNT_POINT/csi-mounted-fs-path-data/ ``` `$MOUNT_POINT` is the mount point that you configured for the nodes. If you created the node group with an SDK, substitute the path itself, for example `/mnt/data`. The chart creates the `csi-mounted-fs-path-sc` `StorageClass`. By default, this `StorageClass` uses the `WaitForFirstConsumer` [volume binding mode](https://kubernetes.io/docs/concepts/storage/storage-classes/#volume-binding-mode), which delays volume provisioning until a Pod uses the `PersistentVolumeClaim`. To provision a volume as soon as the `PersistentVolumeClaim` is created, add `--set storageClass.volumeBindingMode=Immediate` to the installation command. ### Mount the filesystem to Pods Here is an example of a `PersistentVolumeClaim` that claims space on the shared filesystem, and a Pod that mounts the filesystem at `/data` through the `PersistentVolumeClaim`: ```yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: csi-pvc spec: accessModes: - ReadWriteMany resources: requests: storage: 1Gi storageClassName: csi-mounted-fs-path-sc --- kind: Pod apiVersion: v1 metadata: name: my-csi-app spec: containers: - name: my-csi-app image: busybox volumeMounts: - mountPath: "/data" name: my-csi-volume command: [ "sleep", "1000000" ] securityContext: allowPrivilegeEscalation: false privileged: false volumes: - name: my-csi-volume persistentVolumeClaim: claimName: csi-pvc ``` ## How to use several shared filesystems One CSI driver installation supports multiple shared filesystems, each with its own `StorageClass`. Before configuring the chart, make sure that each filesystem is attached to the node group and mounted on every node that can run the driver. 1. Repeat [Create a shared filesystem](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md#create-a-shared-filesystem) for each filesystem that you want to use. When [creating the node group](https://docs.nebius.com/kubernetes/storage/filesystem-over-csi.md#create-a-node-group-and-mount-the-filesystem-to-nodes), add one filesystem attachment and one mount command for each filesystem. Use distinct mount tags and mount points. 2. Create `values.yaml`. For each additional filesystem, add an entry to both `additionalStoragePools` and `additionalStorageClasses`, following this example: ```yaml dataDir: /mnt/data/csi-mounted-fs-path-data/ additionalStoragePools: - name: fs-2 hostPath: /mnt/fs-2/csi-mounted-fs-path-data/ additionalStorageClasses: - name: fs-2-sc storagePool: fs-2 ``` In `hostPath`, specify the filesystem mount point on the nodes, followed by `/csi-mounted-fs-path-data/`. The `storagePool` value must match the corresponding pool `name`. If upgrading, preserve the existing `dataDir` value. Renaming a pool or changing its path can make existing volumes inaccessible. 3. Install or upgrade the chart with the values file: ```bash helm upgrade csi-mounted-fs-path ./csi-mounted-fs-path-0.1.10.tgz --install \ --values values.yaml ``` 4. In each `PersistentVolumeClaim`, set `storageClassName` to the filesystem's `StorageClass`, such as `fs-2-sc`. ## How to delete the created resources Some of the created resources are chargeable. If you do not need them, delete these resources, so Nebius AI Cloud does not charge for them: 1. Delete the node group: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > 2. Open the page of the required cluster and then go to the **Node groups** tab. > 3. In the row of the required node group, click  → **Delete**. > 4. Confirm the node group deletion. > [tab] CLI > > 1. Get the ID of the node group that you want to delete: > > ```bash > nebius mk8s node-group list --parent-id > ``` > > 2. Delete the node group: > > ```bash > nebius mk8s node-group delete --id > ``` > [tab] Go SDK > > 1. Get the ID of the node group that you want to delete: > > ```go > nodeGroupService := sdk.Services().MK8S().V1().NodeGroup() > nodeGroups, err := nodeGroupService.List( > ctx, > &mk8s.ListNodeGroupsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(nodeGroups) > ``` > > 2. Delete the node group: > > ```go > deleteNodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Delete( > ctx, > &mk8s.DeleteNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deleteNodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the node group that you want to delete: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_groups = await node_group_service.list( > ListNodeGroupsRequest(parent_id=""), > ) > print(node_groups) > ``` > > 2. Delete the node group: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > delete_node_group_operation = await node_group_service.delete( > DeleteNodeGroupRequest(id=""), > ) > await delete_node_group_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the node group that you want to delete: > > ```ts > const nodeGroupListService = new NodeGroupService(sdk); > const nodeGroups = await nodeGroupListService.list( > ListNodeGroupsRequest.create({ > parentId: "", > }), > ); > console.log(nodeGroups); > ``` > > 2. Delete the node group: > > ```ts > const nodeGroupDeleteService = new NodeGroupService(sdk); > const deleteNodeGroupOperation = > await nodeGroupDeleteService.delete( > DeleteNodeGroupRequest.create({ > id: "", > }), > ).result; > await deleteNodeGroupOperation.wait(); > ``` 2. Delete the Compute shared filesystem: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Shared filesystems**. > 2. Next to the filesystem's name, click → **Delete**. > 3. Enter the filesystem's name and confirm deletion. > [tab] CLI > > ```bash > nebius compute filesystem delete --id > ``` > [tab] Go SDK > > ```go > deleteFilesystemOperation, err := sdk.Services().Compute(). > V1().Filesystem().Delete( > ctx, > &compute.DeleteFilesystemRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deleteFilesystemOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > filesystem_service = FilesystemServiceClient(sdk) > delete_filesystem_operation = await filesystem_service.delete( > DeleteFilesystemRequest(id=""), > ) > await delete_filesystem_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const filesystemDeleteService = new FilesystemService(sdk); > const deleteFilesystemOperation = > await filesystemDeleteService.delete( > DeleteFilesystemRequest.create({ > id: "", > }), > ).result; > await deleteFilesystemOperation.wait(); > ``` ## See also * [Mounting disks to Pods in a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/storage/disk-over-csi.md) * [Types of storage volumes in Compute](https://docs.nebius.com/compute/storage/types.md) # Deploying and deleting applications for Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/manage-applications.md Nebius AI Cloud provides several applications that you can deploy on [Managed Kubernetes clusters](https://docs.nebius.com/kubernetes/clusters/manage.md). For example, you can deploy a database, a certificate manager, or libraries for LLM inference. You can use popular tools, such as [Argo CD](https://argo-cd.readthedocs.io/en/stable/) and [Grafana Loki](https://grafana.com/oss/loki/). For information about deploying applications, see [Deploying applications in Nebius AI Cloud](https://docs.nebius.com/applications/deploy.md). Each application requires at least one node group in a cluster. You can create it [beforehand](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups) or during the [application deployment](https://docs.nebius.com/kubernetes/manage-applications.md#how-to-find-and-deploy-an-application). ## Prerequisites Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## How to find and deploy an application To see the list of applications for Managed Kubernetes and deploy an application: > [tab] Web console > > 1. In the sidebar, go to **Applications**. > 2. In the **Deployment** dropdown, select **Kubernetes** to see only applications that support Kubernetes deployment. > 3. Choose an application, open its page, and click **Deploy on cluster**. > 4. Configure the application. If you do not have a suitable Managed Kubernetes cluster to deploy the application, you can create a new cluster on this step. The application creates the necessary node groups in the new or existing cluster automatically. > 5. Click **Deploy application**. > 6. Wait until the statuses of the cluster and application are `Running`. ## How to delete an application > [tab] Web console > > 1. In the sidebar, go to **Applications**. > 2. Go to the **Installed** tab to see your deployed applications. > 3. Find the application you want to delete and open it. > 4. On the application details page, go to the **Settings** tab. > 5. Click **Delete application**. > 6. To confirm that you want to delete the application, enter its name and click **Delete application**. When you delete an application, node groups created with it remain in the cluster and are subject to Managed Kubernetes [charges](https://docs.nebius.com/kubernetes/resources/pricing.md) and [quotas](https://docs.nebius.com/kubernetes/resources/quotas-limits.md). If you do not need these node groups, [delete them](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-delete-node-groups). # Monitoring clusters and nodes in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/monitoring.md You can monitor Managed Service for Kubernetes cluster and nodes states on the dashboards in the Nebius AI Cloud web console. Use the dashboards to monitor current resource utilization, get information to schedule [quota](https://docs.nebius.com/kubernetes/resources/quotas-limits.md) increases and quickly identify anomalies. In case of issues with your cluster, dashboards help the Nebius support team investigate the issue. Data for the dashboards is collected automatically. For more information about metrics collection, see [Monitoring agent on Compute virtual machines](https://docs.nebius.com/observability/agents/monitoring-agent.md). ## Explore the dashboards The cluster usage data becomes available 5–10 minutes after nodes are created in the cluster. You can view it on the **Monitoring** tab of the cluster and the node group pages. You can select specific nodes to check their health separately. On the cluster monitoring page, you can also select specific node groups. Use time filters to view a specific period of usage. By default, the data is refreshed every 15 seconds. You can configure this interval next to the time filters. ## Monitoring metrics Managed Service for Kubernetes nodes are hosted by Compute virtual machines and produce the same metrics. You can read about them in [Monitoring virtual machines in Nebius AI Cloud](https://docs.nebius.com/compute/monitoring/virtual-machines.md). # Logs in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/logs.md Managed Service for Kubernetes provides logs about clusters and node groups. Use these logs for troubleshooting and tracking actions on Managed Kubernetes resources. All logs are available on the  [Observability → Logs](https://console.nebius.com/observability/logs) page of the web console. Audit and control plane logs are also available on the **Logs** tab of a cluster page. The service supports three types of logs: * **Audit logs**: Contain metadata about operations that modify a cluster. For example, who and when created or deleted a Pod. Disabled by default; you can [enable them](https://docs.nebius.com/kubernetes/logs.md#how-to-enable-audit-logs). * **Control plane logs**: Show actions recorded by [control plane components](https://docs.nebius.com/kubernetes/components.md#control-plane-components) of a cluster. For example, you can learn about the cluster scaling, Pod scheduling, or node availability. The control plane logs are collected from the following components: * API server ([kube-apiserver](https://kubernetes.io/docs/concepts/overview/kubernetes-api/)) * Scheduler ([kube-scheduler](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/)) * [Cluster autoscaler](https://docs.nebius.com/kubernetes/node-groups/autoscaling.md) * Controller manager ([kube-controller-manager](https://kubernetes.io/docs/concepts/architecture/controller/)) * Cloud controller manager In addition, Kubernetes generates node events. They provide information about Kubernetes resources, for example, state changes, node errors, Pod errors, or scheduling failures. The control plane logs are enabled by default; you cannot disable them. * **journald logs**: Show entries recorded by systemd services running on cluster nodes. Disabled by default; you can [enable them](https://docs.nebius.com/kubernetes/logs.md#how-to-enable-journald-logs). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to enable audit logs Audit logs in Managed Kubernetes are disabled by default. To enable them for a cluster, specify the [cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters): > [tab] CLI > > ```bash > nebius mk8s cluster update --id --control-plane-audit-logs > ``` > [tab] Go SDK > > ```go > clusterForLogs, err := sdk.Services().MK8S().V1(). > Cluster().Get( > ctx, > &mk8s.GetClusterRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > clusterForLogsSpec := clusterForLogs.GetSpec() > if clusterForLogsSpec == nil || > clusterForLogsSpec.GetControlPlane() == nil { > return fmt.Errorf("cluster control plane spec is missing") > } > clusterForLogsSpec.ControlPlane.AuditLogs = &mk8s.AuditLogsSpec{} > logsOperation, err := sdk.Services().MK8S().V1(). > Cluster().Update( > ctx, > &mk8s.UpdateClusterRequest{ > Metadata: clusterForLogs.GetMetadata(), > Spec: clusterForLogsSpec, > }, > ) > if err != nil { > return err > } > if _, err = logsOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code reads the current cluster spec, sets `Spec.ControlPlane.AuditLogs` and sends the spec back, so the other cluster parameters keep their current values. > [tab] Python SDK > > ```python > logs_cluster_service = ClusterServiceClient(sdk) > cluster_for_logs = await logs_cluster_service.get( > GetClusterRequest(id=""), > ) > if cluster_for_logs.spec is None: > raise ValueError("cluster spec is missing") > if cluster_for_logs.spec.control_plane is None: > raise ValueError("cluster control plane spec is missing") > cluster_for_logs.spec.control_plane.audit_logs = AuditLogsSpec() > logs_operation = await logs_cluster_service.update( > UpdateClusterRequest( > metadata=cluster_for_logs.metadata, > spec=cluster_for_logs.spec, > ), > ) > await logs_operation.wait() > ``` > > The code reads the current cluster spec, sets `spec.control_plane.audit_logs` and sends the spec back, so the other cluster parameters keep their current values. > [tab] JavaScript SDK > > ```ts > const logsClusterService = new ClusterService(sdk); > const clusterForLogs = await logsClusterService.get( > GetClusterRequest.create({ > id: "", > }), > ); > if (!clusterForLogs.spec?.controlPlane) { > throw new Error("cluster control plane spec is missing"); > } > clusterForLogs.spec.controlPlane.auditLogs = AuditLogsSpec.create({}); > const logsOperation = await logsClusterService.update( > UpdateClusterRequest.create({ > metadata: clusterForLogs.metadata, > spec: clusterForLogs.spec, > }), > ).result; > await logsOperation.wait(); > ``` > > The code reads the current cluster spec, sets `spec.controlPlane.auditLogs` and sends the spec back, so the other cluster parameters keep their current values. ## How to view audit and control plane logs > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Kubernetes**. > 2. Open the page of the required cluster and then go to the **Logs** tab. > 3. In the **Bucket** field, select **Managed Kubernetes audit logs** or **Managed Kubernetes control planes**. > 4. (Optional) To check logs for a specific control plane component, select it in the **Component** field. > 5. Apply the required period. ## How to enable journald logs The monitoring agent installed on cluster nodes can collect [journald](https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html) logs from systemd services and forward them to Observability Logs. To configure journald log collection, set instance metadata labels when you create or update a node group. The settings apply to all nodes in the group. > [!WARNING] > > Updating instance metadata labels recreates all nodes in the group. Enable journald logs when you [create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups) to avoid this update. For an existing group, configure its [deployment strategy](https://docs.nebius.com/kubernetes/node-groups/manage.md#deployment-strategy-and-quotas) to create replacement nodes before removing existing ones. > [tab] CLI > > To enable journald log collection for a new node group, add the labels when you [create the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > ```bash > nebius mk8s node-group create \ > --parent-id \ > --name \ > --fixed-node-count \ > --template-resources-platform \ > --template-resources-preset \ > --template-instance-metadata-labels "nebius.o11y.systemd-logs-collection.enabled=true,nebius.o11y.systemd-logs-collection.units=kubelet.service;containerd.service" > ``` > > The `--template-instance-metadata-labels` parameter accepts the following labels, separated by commas: > > * `nebius.o11y.systemd-logs-collection.enabled=true`: Enables journald log collection. > * `nebius.o11y.systemd-logs-collection.units=`: Specifies the systemd units to collect logs from. Separate multiple units with semicolons, for example, `sshd.service;containerd.service`. If you omit this label, logs from all units are collected. > > To enable journald log collection for an existing node group, update its instance metadata labels. The `--template-instance-metadata-labels` parameter replaces all existing instance metadata labels, so include the labels you want to keep as `` in the command: > > ```bash > nebius mk8s node-group update \ > --id \ > --template-instance-metadata-labels ",nebius.o11y.systemd-logs-collection.enabled=true" > ``` > [tab] Go SDK > > To enable journald log collection for a new node group, add the labels when you [create the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > ```go > instanceLabels := map[string]string{ > "nebius.o11y.systemd-logs-collection.enabled": "true", > "nebius.o11y.systemd-logs-collection.units": > "kubelet.service;containerd.service", > } > nodeGroupOperation, err := sdk.Services().MK8S().V1(). > NodeGroup().Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_FixedNodeCount{ > FixedNodeCount: , > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "", > }, > }, > InstanceMetadata: > &mk8s.InstanceMetadataTemplate{ > Labels: instanceLabels, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = nodeGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > The `Spec.Template.InstanceMetadata.Labels` map accepts the following labels: > > * `nebius.o11y.systemd-logs-collection.enabled`: Enables journald log collection. Set it to `"true"`. > * `nebius.o11y.systemd-logs-collection.units`: Specifies the systemd units to collect logs from. Separate multiple units with semicolons, for example, `"sshd.service;containerd.service"`. If you omit this label, logs from all units are collected. > > To enable journald log collection for an existing node group, update its instance metadata labels: > > ```go > nodeGroupService := sdk.Services().MK8S().V1().NodeGroup() > nodeGroup, err := nodeGroupService.Get( > ctx, > &mk8s.GetNodeGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > nodeTemplate := nodeGroup.GetSpec().GetTemplate() > if nodeTemplate == nil { > return errors.New("node group template is missing") > } > instanceMetadata := nodeTemplate.GetInstanceMetadata() > if instanceMetadata == nil { > instanceMetadata = &mk8s.InstanceMetadataTemplate{} > nodeTemplate.InstanceMetadata = instanceMetadata > } > if instanceMetadata.Labels == nil { > instanceMetadata.Labels = map[string]string{} > } > journaldLabel := "nebius.o11y.systemd-logs-collection.enabled" > instanceMetadata.Labels[journaldLabel] = "true" > updateOperation, err := nodeGroupService.Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: nodeGroup.GetMetadata(), > Spec: nodeGroup.GetSpec(), > }, > ) > if err != nil { > return err > } > if _, err = updateOperation.Wait(ctx); err != nil { > return err > } > ``` > > The code reads the current node group specification, adds the journald label to `Spec.Template.InstanceMetadata.Labels` and sends the specification back, so the other instance metadata labels and node group parameters keep their current values. > [tab] Python SDK > > To enable journald log collection for a new node group, add the labels when you [create the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group_operation = await node_group_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=NodeGroupSpec( > fixed_node_count=, > template=NodeTemplate( > resources=ResourcesSpec( > platform="", > preset="", > ), > instance_metadata=InstanceMetadataTemplate( > labels={ > "nebius.o11y.systemd-logs-collection.enabled": > "true", > "nebius.o11y.systemd-logs-collection.units": > "kubelet.service;containerd.service", > }, > ), > ), > ), > ), > ) > await node_group_operation.wait() > ``` > > The `spec.template.instance_metadata.labels` dictionary accepts the following labels: > > * `nebius.o11y.systemd-logs-collection.enabled`: Enables journald log collection. Set it to `"true"`. > * `nebius.o11y.systemd-logs-collection.units`: Specifies the systemd units to collect logs from. Separate multiple units with semicolons, for example, `"sshd.service;containerd.service"`. If you omit this label, logs from all units are collected. > > To enable journald log collection for an existing node group, update its instance metadata labels: > > ```python > node_group_service = NodeGroupServiceClient(sdk) > node_group = await node_group_service.get( > GetNodeGroupRequest(id=""), > ) > labels = node_group.spec.template.instance_metadata.labels > labels["nebius.o11y.systemd-logs-collection.enabled"] = "true" > update_operation = await node_group_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await update_operation.wait() > ``` > > The code reads the current node group specification, adds the journald label to `spec.template.instance_metadata.labels` and sends the specification back, so the other instance metadata labels and node group parameters keep their current values. > [tab] JavaScript SDK > > To enable journald log collection for a new node group, add the labels when you [create the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > ```ts > const nodeGroupService = new NodeGroupService(sdk); > const nodeGroupOperation = await nodeGroupService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "", > }), > spec: NodeGroupSpec.create({ > size: { > $case: "fixedNodeCount", > fixedNodeCount: , > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "", > size: { > $case: "preset", > preset: "", > }, > }), > instanceMetadata: InstanceMetadataTemplate.create({ > labels: { > "nebius.o11y.systemd-logs-collection.enabled": > "true", > "nebius.o11y.systemd-logs-collection.units": > "kubelet.service;containerd.service", > }, > }), > }), > }), > }), > ).result; > await nodeGroupOperation.wait(); > ``` > > The `spec.template.instanceMetadata.labels` object accepts the following labels: > > * `nebius.o11y.systemd-logs-collection.enabled`: Enables journald log collection. Set it to `"true"`. > * `nebius.o11y.systemd-logs-collection.units`: Specifies the systemd units to collect logs from. Separate multiple units with semicolons, for example, `"sshd.service;containerd.service"`. If you omit this label, logs from all units are collected. > > To enable journald log collection for an existing node group, update its instance metadata labels: > > ```ts > const updateNodeGroupService = new NodeGroupService(sdk); > const nodeGroup = await updateNodeGroupService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > if (!nodeGroup.spec?.template) { > throw new Error("node group template is missing"); > } > const nodeTemplate = nodeGroup.spec.template; > nodeTemplate.instanceMetadata = InstanceMetadataTemplate.create({ > ...nodeTemplate.instanceMetadata, > labels: { > ...nodeTemplate.instanceMetadata?.labels, > "nebius.o11y.systemd-logs-collection.enabled": "true", > }, > }); > const updateOperation = await updateNodeGroupService.update( > UpdateNodeGroupRequest.create({ > metadata: nodeGroup.metadata, > spec: nodeGroup.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > The code reads the current node group specification, adds the journald label to `spec.template.instanceMetadata.labels` and sends the specification back, so the other instance metadata labels and node group parameters keep their current values. ## How to view journald logs > [tab] Web console > > 1. In the web console, go to  [Observability → Logs](https://console.nebius.com/observability/logs). > 2. In the **Bucket** field, select **User logs**. > 3. To show only the logs of your cluster, enter the following query: > > ``` > {__bucket__="default", mk8s_cluster_id=""} > ``` > > The `__bucket__` label is required. For more information about the query syntax, see [LogQL implementation by Nebius AI Cloud](https://docs.nebius.com/observability/logs/query-language.md). > [tab] CLI > > Get the journald logs of your cluster for the last hour: > > ```bash > nebius logging query '{mk8s_cluster_id=""}' \ > --bucket default \ > --since 1h > ``` > > The command contains the following parameters: > > * `--bucket`: Log bucket. The `default` bucket stores user logs, including journald logs. > * `--since` (optional): Period to get logs for, counting back from the current time. The default value is `1h`. > > For more information about querying logs, see [How to query logs with Nebius AI Cloud CLI](https://docs.nebius.com/observability/logs/nebius-cli.md). ## See also * [Logs in Nebius AI Cloud](https://docs.nebius.com/observability/logging.md) # Autoscaling in Managed Service for Kubernetes Source: https://docs.nebius.com/kubernetes/node-groups/autoscaling.md In Managed Service for Kubernetes, the **cluster autoscaler** integrates with the underlying infrastructure to monitor and manage [node groups](https://docs.nebius.com/kubernetes/components.md#node-group) in your cluster, to add or remove nodes seamlessly as needed. It makes scaling decisions based on the following principles: * If there are unschedulable Pods in the cluster due to resource constraints, the cluster autoscaler adds new nodes to accommodate these Pods. * If nodes in the cluster are underutilized, the cluster autoscaler removes these nodes in order to optimize resource usage and reduce costs. > [!TIP] > > If you have a GPU node group with autoscaling, add a CPU node group with at least two nodes (or with autoscaling) to the cluster. In this case, when there are no tasks to perform, [CoreDNS and Cilium networking add-ons](https://docs.nebius.com/kubernetes/networking/add-ons.md) can run on CPU nodes, so that the GPU node group can scale down and reduce your costs. ## Set up autoscaling for new node groups You can set up autoscaling when creating a new node group: > [tab] Web console > > When [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups): > > 1. Under **Size**, select **Enable autoscaling**. > > 2. Specify the **Min. nodes** and **Max. nodes** numbers in the group. > [tab] CLI > > When [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups), add the following parameters to the [nebius mk8s node-group create](https://docs.nebius.com/cli/reference/mk8s/node-group/create.md) command: > > ```bash > nebius mk8s node-group create \ > ... \ > --autoscaling-min-node-count \ > --autoscaling-max-node-count > ``` > > For example, to set the autoscaling from 2 to 4 nodes, add `--autoscaling-min-node-count 2 --autoscaling-max-node-count 4` to the `nebius mk8s node-group create` command. > [tab] Go SDK > > When [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups), set `Spec.Size.Autoscaling` instead of a fixed node count: > > ```go > createService := sdk.Services().MK8S().V1().NodeGroup() > createOperation, err := createService.Create( > ctx, > &mk8s.CreateNodeGroupRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: mk8sClusterID, > Name: nodeGroupName, > }, > Spec: &mk8s.NodeGroupSpec{ > Size: &mk8s.NodeGroupSpec_Autoscaling{ > Autoscaling: &mk8s.NodeGroupAutoscalingSpec{ > MinNodeCount: , > MaxNodeCount: , > }, > }, > Template: &mk8s.NodeTemplate{ > Resources: &mk8s.ResourcesSpec{ > Platform: "cpu-d3", > Size: &mk8s.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = createOperation.Wait(ctx); err != nil { > return err > } > ``` > > For example, to set the autoscaling from 2 to 4 nodes, set `MinNodeCount` to `2` and `MaxNodeCount` to `4`. > [tab] Python SDK > > When [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups), set `spec.autoscaling` instead of a fixed node count: > > ```python > create_service = NodeGroupServiceClient(sdk) > create_operation = await create_service.create( > CreateNodeGroupRequest( > metadata=ResourceMetadata( > parent_id=mk8s_cluster_id, > name=node_group_name, > ), > spec=NodeGroupSpec( > autoscaling=NodeGroupAutoscalingSpec( > min_node_count=, > max_node_count=, > ), > template=NodeTemplate( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > ), > ), > ), > ) > await create_operation.wait() > ``` > > For example, to set the autoscaling from 2 to 4 nodes, set `min_node_count` to `2` and `max_node_count` to `4`. > [tab] JavaScript SDK > > When [creating a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups), set `spec.size.autoscaling` instead of a fixed node count: > > ```ts > const createService = new NodeGroupService(sdk); > const createOperation = await createService.create( > CreateNodeGroupRequest.create({ > metadata: ResourceMetadata.create({ > parentId: mk8sClusterId, > name: nodeGroupName, > }), > spec: NodeGroupSpec.create({ > size: { > $case: "autoscaling", > autoscaling: NodeGroupAutoscalingSpec.create({ > minNodeCount: , > maxNodeCount: , > }), > }, > template: NodeTemplate.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > }), > }), > }), > ).result; > await createOperation.wait(); > ``` > > For example, to set the autoscaling from 2 to 4 nodes, set `minNodeCount` to `2` and `maxNodeCount` to `4`. ## Set up autoscaling for existing node groups You cannot manage autoscaling for existing node groups in the web console. Use the CLI or an SDK instead. > [tab] CLI > > To enable autoscaling for an existing node group, add the following parameters to the [nebius mk8s node-group update](https://docs.nebius.com/cli/reference/mk8s/node-group/update.md) command: > > ```bash > nebius mk8s node-group update --id \ > --autoscaling-min-node-count \ > --autoscaling-max-node-count > ``` > > For example, to set the autoscaling from 2 to 4 nodes, add `--autoscaling-min-node-count 2 --autoscaling-max-node-count 4` to the `nebius mk8s node-group update` command. > [tab] Go SDK > > 1. To find the node group ID by name: > > ```go > lookupService := sdk.Services().MK8S().V1().NodeGroup() > nodeGroup, err := lookupService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: mk8sClusterID, > Name: nodeGroupName, > }, > ) > if err != nil { > return err > } > nodeGroupID := nodeGroup.GetMetadata().GetId() > if nodeGroupID == "" { > return errors.New("node group ID is missing") > } > ``` > > 2. Set `MinNodeCount` and `MaxNodeCount` on the node group's autoscaling spec: > > ```go > updateService := sdk.Services().MK8S().V1().NodeGroup() > nodeGroup, err = updateService.Get( > ctx, > &mk8s.GetNodeGroupRequest{Id: ""}, > ) > if err != nil { > return err > } > autoscaling := nodeGroup.GetSpec().GetAutoscaling() > if autoscaling == nil { > return errors.New("node group autoscaling is missing") > } > autoscaling.MinNodeCount = > autoscaling.MaxNodeCount = > updateOperation, err := updateService.Update( > ctx, > &mk8s.UpdateNodeGroupRequest{ > Metadata: nodeGroup.GetMetadata(), > Spec: nodeGroup.GetSpec(), > }, > ) > if err != nil { > return err > } > if _, err = updateOperation.Wait(ctx); err != nil { > return err > } > ``` > > For example, to set the autoscaling from 2 to 4 nodes, set `MinNodeCount` to `2` and `MaxNodeCount` to `4`. > [tab] Python SDK > > 1. To find the node group ID by name: > > ```python > lookup_service = NodeGroupServiceClient(sdk) > node_group = await lookup_service.get_by_name( > GetByNameRequest( > parent_id=mk8s_cluster_id, > name=node_group_name, > ), > ) > node_group_id = node_group.metadata.id > if not node_group_id: > raise ValueError("node group ID is missing") > ``` > > 2. Set `min_node_count` and `max_node_count` on the node group's autoscaling spec: > > ```python > update_service = NodeGroupServiceClient(sdk) > node_group = await update_service.get( > GetNodeGroupRequest(id=""), > ) > if node_group.spec is None: > raise ValueError("node group spec is missing") > if node_group.spec.autoscaling is None: > raise ValueError("node group autoscaling is missing") > node_group.spec.autoscaling.min_node_count = > node_group.spec.autoscaling.max_node_count = > update_operation = await update_service.update( > UpdateNodeGroupRequest( > metadata=node_group.metadata, > spec=node_group.spec, > ), > ) > await update_operation.wait() > ``` > > For example, to set the autoscaling from 2 to 4 nodes, set `min_node_count` to `2` and `max_node_count` to `4`. > [tab] JavaScript SDK > > 1. To find the node group ID by name: > > ```ts > const lookupService = new NodeGroupService(sdk); > const nodeGroup = await lookupService.getByName( > GetByNameRequest.create({ > parentId: mk8sClusterId, > name: nodeGroupName, > }), > ); > const nodeGroupId = nodeGroup.metadata?.id; > if (!nodeGroupId) { > throw new Error("node group ID is missing"); > } > ``` > > 2. Set `minNodeCount` and `maxNodeCount` on the node group's autoscaling spec: > > ```ts > const updateService = new NodeGroupService(sdk); > const nodeGroupForUpdate = await updateService.get( > GetNodeGroupRequest.create({ > id: "", > }), > ); > const autoscaling = nodeGroupForUpdate.spec?.size?.autoscaling; > if (!autoscaling) { > throw new Error("node group autoscaling is missing"); > } > autoscaling.minNodeCount = ; > autoscaling.maxNodeCount = ; > const updateOperation = await updateService.update( > UpdateNodeGroupRequest.create({ > metadata: nodeGroupForUpdate.metadata, > spec: nodeGroupForUpdate.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > For example, to set the autoscaling from 2 to 4 nodes, set `minNodeCount` to `2` and `maxNodeCount` to `4`. The same operation changes the minimum and maximum numbers of nodes on a node group that already has autoscaling enabled. ## Troubleshooting ### More GPU nodes than required * **Issue**: When a Managed Kubernetes cluster has the NVIDIA GPU Operator and the NVIDIA Network Operator installed, and workloads on a GPU node group are run with autoscaling, the cluster autoscaler can create more nodes in the group than the workloads require. * **Possible reason**: A bug in Kubernetes Autoscaler that causes inconsistency in how nodes are considered ready or not ready for Pods. For more information, see [Excess multiGPU nodes when using GPU + network operators](https://github.com/kubernetes/autoscaler/issues/7956) in the Kubernetes Autoscaler repository on GitHub. * **Solution**: 1. Uninstall the NVIDIA operators. 2. [Create a GPU node group](https://docs.nebius.com/kubernetes/gpu/set-up.md#how-to-add-nodes-with-gpus-to-a-cluster) and [migrate your workloads](https://docs.nebius.com/kubernetes/node-groups/moving-workload.md) to it. A node group created this way uses the GPU-adapted boot disk image offered by Managed Kubernetes, which solves the issue because the NVIDIA operators are no longer required. ## See also * [Cluster autoscaler parameters](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca) in the official GitHub repository. # Moving workload from the existing node group Source: https://docs.nebius.com/kubernetes/node-groups/moving-workload.md The workload is moved automatically after you evict it from the existing node group. Before moving your workload, you need to: 1. Install [jq](https://jqlang.github.io/jq/download/) if you don't have it on your system: ```bash Ubuntu sudo apt-get install jq ``` ```bash macOS brew install jq ``` 2. [Get your cluster ID](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-modify-clusters) which is returned in the `.metadata.id` field of the cluster resource. The examples in this guide assume that the cluster ID is saved to the `K8S_CLUSTER_ID` environment variable for the CLI or to the `k8sClusterID`, `k8s_cluster_id`, or `k8sClusterId` variable for the Go, Python, or JavaScript SDK. To move your workload: 1. [Create a node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#how-to-create-node-groups). > For example, the following command creates a group of two nodes, each with one NVIDIA H100 GPU, and all drivers and components required for the GPU: > > ```bash > nebius mk8s node-group create \ > --parent-id $K8S_CLUSTER_ID \ > --name mk8s-node-group-test \ > --fixed-node-count 2 \ > --template-resources-platform gpu-h100-sxm \ > --template-resources-preset 1gpu-16vcpu-200gb \ > --template-gpu-settings-drivers-preset cuda12 > ``` 2. Save the ID of the node group from which you want to move the workload. For example, you can get it by the node group's name (if you have set and know it) and the parent cluster's ID: > [tab] CLI > > ```bash > export K8S_NODE_GROUP_ID=$(nebius mk8s node-group get-by-name \ > --parent-id $K8S_CLUSTER_ID \ > --name node-group-name \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > lookupService := sdk.Services().MK8S().V1().NodeGroup() > oldNodeGroup, err := lookupService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: k8sClusterID, > Name: oldNodeGroupName, > }, > ) > if err != nil { > return err > } > oldNodeGroupID := oldNodeGroup.GetMetadata().GetId() > if oldNodeGroupID == "" { > return errors.New("node group ID is missing") > } > ``` > > Assign the node group name to the `oldNodeGroupName` variable before you run the code. > [tab] Python SDK > > ```python > lookup_service = NodeGroupServiceClient(sdk) > old_node_group = await lookup_service.get_by_name( > GetByNameRequest( > parent_id=k8s_cluster_id, > name=old_node_group_name, > ), > ) > old_node_group_id = old_node_group.metadata.id > if not old_node_group_id: > raise ValueError("node group ID is missing") > ``` > > Assign the node group name to the `old_node_group_name` variable before you run the code. > [tab] JavaScript SDK > > ```ts > const lookupService = new NodeGroupService(sdk); > const oldNodeGroup = await lookupService.getByName( > GetByNameRequest.create({ > parentId: k8sClusterId, > name: oldNodeGroupName, > }), > ); > const oldNodeGroupId = oldNodeGroup.metadata?.id; > if (!oldNodeGroupId) { > throw new Error("node group ID is missing"); > } > ``` > > Assign the node group name to the `oldNodeGroupName` variable before you run the code. 3. Get the list of node names in the node group from which you want to move the workload: ```sh export OLD_NODES=$(kubectl get nodes -o json \ | jq '.items[].metadata | select(.annotations."cluster.x-k8s.io/owner-name" = "$K8S_NODE_GROUP_ID") | .name') ``` 4. Cordon off the old nodes so that no new Pods are scheduled on them: ```sh for node in $OLD_NODES; do kubectl cordon $node; done ``` 5. Drain the old nodes so that the existing Pods can be evicted from them: ```sh for node in $OLD_NODES; do kubectl drain --force --ignore-daemonsets --delete-emptydir-data $node; done ``` Kubernetes will automatically move evicted Pods to suitable nodes. 6. Delete the old node group: > [tab] CLI > > ```bash > nebius mk8s node-group delete --id $K8S_NODE_GROUP_ID > ``` > [tab] Go SDK > > ```go > deleteService := sdk.Services().MK8S().V1().NodeGroup() > deleteOperation, err := deleteService.Delete( > ctx, > &mk8s.DeleteNodeGroupRequest{Id: oldNodeGroupID}, > ) > if err != nil { > return err > } > if _, err = deleteOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > ```python > delete_service = NodeGroupServiceClient(sdk) > delete_operation = await delete_service.delete( > DeleteNodeGroupRequest(id=old_node_group_id), > ) > await delete_operation.wait() > ``` > [tab] JavaScript SDK > > ```ts > const deleteService = new NodeGroupService(sdk); > const deleteOperation = await deleteService.delete( > DeleteNodeGroupRequest.create({ > id: oldNodeGroupId, > }), > ).result; > await deleteOperation.wait(); > ``` # "Unable to allocate CIDR from the pool" error Source: https://docs.nebius.com/kubernetes/troubleshooting/cidr-allocation-error.md When you create a Managed Service for Kubernetes® cluster, it may get stuck in the `Provisioning` status with the following error: ```text "rpc error: code = FailedPrecondition desc = Unable to allocate private ipv4 cidr /32 from the pool. Please verify the availability of the cidrs and retry the allocation." ``` This error usually indicates that there is not enough CIDR space available for IP address allocation. Possible causes: * [Quota for IP addresses is exceeded](https://docs.nebius.com/kubernetes/troubleshooting/cidr-allocation-error.md#quota-for-ip-addresses-is-exceeded) * [Selected subnet is too small](https://docs.nebius.com/kubernetes/troubleshooting/cidr-allocation-error.md#selected-subnet-is-too-small) * [CIDR block is too large](https://docs.nebius.com/kubernetes/troubleshooting/cidr-allocation-error.md#cidr-block-is-too-large) ## Quota for IP addresses is exceeded You may not have enough free [quota](https://docs.nebius.com/vpc/resources/quotas-limits.md) for the IP addresses the cluster requires. To find out if that is the case, get and compare the following information: * See the complete list of required allocations in [Network requirements for Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/networking/requirements.md). * Check your free quota on the [Administration → Limits → Quotas](https://console.nebius.com/quotas) page in the web console. To fix this, use one of the following solutions: * Remove unused resources to free up quota. * Request a quota increase on the **Administration** → **Limits** → **Quotas** page. ## Selected subnet is too small The [subnet](https://docs.nebius.com/vpc/overview.md#subnet) you specified during cluster creation may not have enough CIDR blocks. To find out if that is the case, get and compare the following information: * See the complete list of required allocations in [Network requirements for Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/networking/requirements.md). * Get the subnet metadata: > [tab] CLI > > ```bash > nebius vpc subnet get --id > ``` > > To find the available CIDR blocks, check the `cidr` values in the `spec.ipv4_private_pools.pools.cidrs` list in the response. > [tab] Go SDK > > ```go > subnet, err := sdk.Services().VPC().V1(). > Subnet().Get( > ctx, > &vpc.GetSubnetRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(subnet) > ``` > > To find the available CIDR blocks, check the `Cidr` values in the `Spec.Ipv4PrivatePools.Pools.Cidrs` list in the response. > [tab] Python SDK > > ```python > subnet_service = SubnetServiceClient(sdk) > subnet = await subnet_service.get( > GetSubnetRequest(id=""), > ) > print(subnet) > ``` > > To find the available CIDR blocks, check the `cidr` values in the `spec.ipv4_private_pools.pools.cidrs` list in the response. > [tab] JavaScript SDK > > ```ts > const subnetService = new SubnetService(sdk); > const subnet = await subnetService.get( > GetSubnetRequest.create({ > id: "", > }), > ); > console.log(subnet); > ``` > > To find the available CIDR blocks, check the `cidr` values in the `spec.ipv4PrivatePools.pools.cidrs` list in the response. To fix this, use one of the following solutions: * Add a [pool](https://docs.nebius.com/vpc/overview.md#pool) with more CIDR blocks to the subnet. * Use another, larger subnet for your cluster. ## CIDR block is too large If you specified a CIDR block for Kubernetes services that is too large, no free blocks for other control plane requirements may be left in the subnet. To find out if that is the case, get and compare the following information: * Get the subnet metadata: > [tab] CLI > > ```bash > nebius vpc subnet get --id > ``` > > To find the available CIDR blocks, check the `cidr` values in the `spec.ipv4_private_pools.pools.cidrs` list in the response. > [tab] Go SDK > > ```go > subnet, err := sdk.Services().VPC().V1(). > Subnet().Get( > ctx, > &vpc.GetSubnetRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(subnet) > ``` > > To find the available CIDR blocks, check the `Cidr` values in the `Spec.Ipv4PrivatePools.Pools.Cidrs` list in the response. > [tab] Python SDK > > ```python > subnet_service = SubnetServiceClient(sdk) > subnet = await subnet_service.get( > GetSubnetRequest(id=""), > ) > print(subnet) > ``` > > To find the available CIDR blocks, check the `cidr` values in the `spec.ipv4_private_pools.pools.cidrs` list in the response. > [tab] JavaScript SDK > > ```ts > const subnetService = new SubnetService(sdk); > const subnet = await subnetService.get( > GetSubnetRequest.create({ > id: "", > }), > ); > console.log(subnet); > ``` > > To find the available CIDR blocks, check the `cidr` values in the `spec.ipv4PrivatePools.pools.cidrs` list in the response. * Check the value of the `spec.kube_network.service_cidrs` parameter that you set during cluster creation. To fix this, use one of the following solutions: * Specify a smaller block for services in the `spec.kube_network.service_cidrs` parameter. * Add a [pool](https://docs.nebius.com/vpc/overview.md#pool) with more CIDR blocks to the subnet. * Use another, larger subnet for your cluster. # How to collect diagnostic logs from Managed Service for Kubernetes® nodes Source: https://docs.nebius.com/kubernetes/troubleshooting/logs.md Managed Service for Kubernetes [nodes](https://docs.nebius.com/kubernetes/components.md#node) are Compute virtual machines (VMs). *Diagnostic logs* from Managed Kubernetes nodes help you troubleshoot issues with VM operations, networking, and workloads. The procedure for collecting diagnostic logs depends on the GPU and access settings you configured when you [created the node group](https://docs.nebius.com/kubernetes/node-groups/manage.md#regular-node-groups). We strongly recommend collecting logs while the issue is still occurring, because they capture more information about the broken state than logs collected after the issue has been resolved. Determine which of the following cases applies to your environment, and follow the relevant procedure: * Nodes that have one or more GPUs, without SSH configuration: [connect to the cluster with kubectl to start a debug session](https://docs.nebius.com/kubernetes/troubleshooting/logs.md#how-to-collect-logs-by-using-kubectl). * Nodes that have one or more GPUs, with SSH configuration: [connect to the node with SSH to collect logs](https://docs.nebius.com/kubernetes/troubleshooting/logs.md#how-to-collect-logs-by-using-ssh). * Nodes without GPUs: [contact our support team](https://docs.nebius.com/kubernetes/troubleshooting/logs.md#how-to-request-log-collection-from-support). ## Types of logs This guide describes how to collect the following types of logs for troubleshooting: * GPU logs: `nvidia-bug-report.sh`. * General system logs, including more context about system services and package versions: `sos report`. * [NVIDIA® Mellanox®](https://www.nvidia.com/en-us/networking/management-software/) adapter (InfiniBand™/NVSwitch/Ethernet) logs: `sysinfo-snapshot`. ## How to collect logs by using kubectl If your nodes have GPUs and you have `kubectl` access to the cluster, but no SSH access to the nodes, do the following to collect the logs: 1. Connect to the cluster with [kubectl](https://docs.nebius.com/kubernetes/connect.md). 2. Start a debugging session for the required node and open an interactive shell in the debug container: ```bash kubectl debug node/ -it --image ubuntu --profile sysadmin -- bash ``` In the command, specify: * `node_ID`: Node to debug. To get the nodes in the cluster, run: ```bash kubectl get nodes ``` Alternatively, in the [web console](https://console.nebius.com/), go to **Compute** → **Virtual machines**. On the **Kubernetes nodes** tab, click next to the node ID to copy it. * `--image`: Container image to use for the debug container. We recommend setting it to `ubuntu` to start a temporary debug container. * `--profile`: Set to `sysadmin` to use the built-in debugging profile. Refer to the [Kubernetes documentation](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/) for more information. * `-it`: Starts an interactive terminal session in the debug container. * `bash`: Starts the Bash shell in the debug container. In the output, note the name of the temporary debug Pod that was created. You will need it in a later step. 3. Switch to the host filesystem: ```bash chroot /host ``` 4. Generate GPU logs: ```bash nvidia-bug-report.sh ``` This command usually runs for about five minutes and generates `nvidia-bug-report.log.gz` in the current working directory. If the command stops responding, run it in safe mode: ```bash nvidia-bug-report.sh --safe-mode ``` 5. If you need more system information, generate general system logs: ```bash sos report --batch ``` This command generates an archive in the following format: `/tmp/sosreport---.tar.gz`. 6. If you are troubleshooting Mellanox adapter issues, generate Mellanox adapter logs: ```bash /opt/nebius/sysinfo-snapshot ``` This command generates an archive in the following format: `/tmp/sysinfo-snapshot---.tgz`. 7. From your local shell, copy the generated log file(s) from the debug Pod: > [!WARNING] > > Don't exit the shell. This will terminate the debug Pod, and you will not be able to copy files from it. Instead, open a new terminal to run the `kubectl cp` command. ```bash kubectl cp :/host/ ./ ``` In the command, specify: * `debug_Pod_name`: Name of the temporary debug Pod created when you ran `kubectl debug`. * `generated_file_path`: Path to the generated log file on the node, for example, `/tmp/sosreport-*.tar.gz`. * `local_file_name`: Name to save the file as on your local machine, for example, `/tmp/sosreport.tar.gz`. ## How to collect logs by using SSH If your nodes have GPUs, and you have configured SSH access, do the following to collect the logs: 1. Connect to the node over SSH. Nodes are Compute VMs, therefore, you connect the same way you would [connect to a VM by using SSH](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh). 2. Generate the logs as described in [How to collect logs](https://docs.nebius.com/compute/virtual-machines/logs.md#how-to-collect-logs). 3. Retrieve the generated log files as described in [How to get generated log files](https://docs.nebius.com/compute/virtual-machines/logs.md#how-to-get-generated-log-files). ## How to request log collection from support If your nodes don't have GPUs, [create a support ticket](https://docs.nebius.com/overview/support.md) to get assistance with troubleshooting. When you create the ticket, write that you give the support team explicit permission to access your logs. *InfiniBand and InfiniBand Trade Association are registered trademarks of the InfiniBand Trade Association.* # Managed Service for Kubernetes® quotas and constraints Source: https://docs.nebius.com/kubernetes/resources/quotas-limits.md ## Quotas Managed Service for Kubernetes has quotas on the number of clusters and uses the same quotas on nodes and IP addresses as Compute. For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). ### Clusters | Quota name | Default value, `eu-north1`, `eu-north2`, `eu-west1`, `eu-west2`, `eu-south1`, `uk-south1`, `uk-south2`, `us-central1`, `us-north1` | Default value, `me-west1` | | :- | :- | :- | | Clusters per [region](https://docs.nebius.com/overview/regions.md) | 2 | 0 | ### Nodes Managed Service for Kubernetes nodes comply with the same quotas as Compute virtual machines. You can find them in [Quotas in Compute](https://docs.nebius.com/compute/resources/quotas-limits.md). ### Network See [Quotas in Virtual Networks](https://docs.nebius.com/vpc/resources/quotas-limits.md). ## Constraints Certain Managed Kubernetes resources have technical constraints that may depend on your quotas, but can't be changed directly. ### Kubernetes feature gates [Alpha Kubernetes feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-stages) can't be enabled in Managed Kubernetes clusters. A feature introduced behind an Alpha feature gate is available only in a [supported Kubernetes version](https://docs.nebius.com/kubernetes/versions.md) where the feature is enabled by default. If necessary, [upgrade your cluster](https://docs.nebius.com/kubernetes/manage-versions.md) to such a version. ### Nodes The number of nodes you can create in a Managed Kubernetes cluster depends on the type of used IP address and whether high availability control plane is enabled. This number is limited by your **Allocations** [quota](https://docs.nebius.com/vpc/resources/quotas-limits.md). > For example, with the default **Allocations** quota of 1000, you can create up to 498 nodes across all clusters when using only private IP addresses with no high availability, or up to 331 nodes when using both private and public IP addresses with high availability enabled. For more information, see [Network requirements for Managed Service for Kubernetes® clusters](https://docs.nebius.com/kubernetes/networking/requirements.md). # Pricing in Managed Service for Kubernetes® Source: https://docs.nebius.com/kubernetes/resources/pricing.md This article provides detailed pricing for the Managed Service for Kubernetes in Nebius AI Cloud. ## How charges and prices work Each group of chargeable items in this article has two time units associated with it: * **Billing unit**: Minimum unit of usage for which you can be charged. * **Pricing unit**: Unit of usage for which the prices are shown. Charges for units smaller than the pricing unit are calculated proportionally. > For example, for GPUs on running VMs, the **billing unit** is 1 second, and the **pricing unit** is 1 hour (3600 seconds). For 30 minutes of usage, you will be charged half the hourly price. Prices in US dollars (USD, \$) apply to all customers except for companies from Israel, where prices in Israeli shekels (ILS, ₪) apply instead. All prices are shown without any applicable taxes, including VAT. Due to rounding errors, usage costs shown in the web console and final charges may slightly differ from calculations based on the prices in this article. ## Prices ### Nodes You are charged for running nodes in your Managed Kubernetes clusters. As Managed Kubernetes nodes are Compute virtual machines, their computing resources (GPUs, vCPUs, RAM) and storage are charged according to Compute pricing. For more details, see [Compute pricing in Nebius AI Cloud](https://docs.nebius.com/compute/resources/pricing.md). ## Storage ### Object Storage # Object Storage Source: https://docs.nebius.com/object-storage/index.md Most ML/AI workloads involve large files, such as datasets and artifacts of trained models. To store, access and share them efficiently, you can use Object Storage, a simple storage service offered by Nebius AI Cloud. The service is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). > [card] [Getting started](https://docs.nebius.com/object-storage/quickstart.md) > > Create your first bucket and upload files > [card] [Buckets and objects](https://docs.nebius.com/object-storage/overview.md) > > Learn about the main service resources > [card] [Creating and modifying buckets](https://docs.nebius.com/object-storage/buckets/manage.md) > > Learn how to manage buckets and their parameters > [card] [Uploading and downloading objects](https://docs.nebius.com/object-storage/objects/upload-download.md) > > Explore how to upload files to buckets and download them > [card] [Managing objects in buckets](https://docs.nebius.com/object-storage/objects/manage.md) > > Learn how to list, rename, and delete objects > [card] [Roles and available actions](https://docs.nebius.com/object-storage/supported-actions.md) > > Learn about the actions available to different roles > [card] [Performance and cost-efficiency best practices](https://docs.nebius.com/object-storage/performance-cost-best-practices.md) > > Discover how to optimize operations on your buckets and objects > [card] [AWS CLI command reference](https://docs.nebius.com/object-storage/interfaces/aws-cli.md) > > Learn how to set up and use the AWS CLI > [card] [Monitoring buckets](https://docs.nebius.com/object-storage/monitoring.md) > > Control resource usage and monitor your bucket health > [card] [Bucket and object logs](https://docs.nebius.com/object-storage/logs.md) > > Set up and view control plane and data plane logs from your buckets # About Object Storage Source: https://docs.nebius.com/object-storage/overview.md Object Storage stores data for your ML/AI workloads. For example, you train a text-to-text model with a dataset of several petabytes. Here is how you can use Object Storage for it: 1. **Data storage**: Upload your training data to a bucket. Each object in the bucket is a file with a piece of text data for training. Set this bucket as a data source for your training scripts. 2. **Checkpoint storage**: During the model training and running experiments, set the scripts to upload each model checkpoint to the dedicated bucket. 3. **Model registry**: Use Object Storage to distribute models across your services or consumers, or to leverage autoscaling during inference. 4. **Inference results storage**: During the model inference, store the inference results in an Object Storage bucket. Your data in Object Storage is stored as *objects*: files in various formats together with their metadata. To organize the objects, you create containers called *buckets* in your [project](https://docs.nebius.com/iam/overview.md#projects) and upload objects into them. ## Buckets A bucket is a container in Object Storage for storing files. ### Naming A bucket name should be unique across the [region](https://docs.nebius.com/overview/regions.md). If you try to create a bucket with a name that is already taken by another bucket in the region, you will get a message about it. The name must be 3 to 63 characters long and may contain lowercase Latin letters, numbers, dots, and hyphens. It is used as a part of a URL for data access. ### URLs Use the following template to access a bucket: ```url https://storage..nebius.cloud/ ``` In the URL above: * `region_id`: ID of the [region](https://docs.nebius.com/overview/regions.md) where the bucket is located. * `bucket_name`: Name of the bucket you want to access. For example, the URL for the `training-artifacts` bucket located in `eu-north1` (Finland) is: ```url https://storage.eu-north1.nebius.cloud/training-artifacts ``` ## Objects An object is a file in Object Storage together with its metadata. ### Naming To avoid issues with your objects, follow these naming requirements: * Object keys can be up to 1024 bytes long, case sensitive. * Use UTF-8 alphanumeric characters, slashes (`/`), and certain [special characters](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-guidelines). ### Keys, prefixes, and object hierarchy Each Object Storage object has a *key*. The key can contain *prefixes* that act similarly to folders, organizing objects into groups. Buckets have a flat structure: they have no folders in them; all objects in a bucket are at the same level of hierarchy. However, interfaces and tools supported by Object Storage, such as the [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md), can emulate folders. When listing objects, you can specify a *delimiter* to group object keys by common prefixes. A delimiter can be any string. For example, if you use `/` as a delimiter and upload objects with the keys `training/object-1.txt` and `training/object-2.txt`, they'll be shown under the common prefix `training/`, like files in the same folder. The two uploaded objects will be accessible at `https://storage..nebius.cloud//training/object-1.txt` and `https://storage..nebius.cloud//training/object-2.txt` respectively. ### Storage classes Object Storage provides [storage classes](https://docs.nebius.com/object-storage/storage-classes.md) to control settings for stored objects. You can set the default storage class for each bucket and upload individual objects to specific classes. In addition, you can [set up lifecycle rules](https://docs.nebius.com/object-storage/objects/lifecycles.md) to transition objects between classes. ### URLs Use the following templates to access an object: * `https://storage..nebius.cloud//` * `http://.storage..nebius.cloud/` For example, the URL for the `requests.txt` object in the `training-artifacts` bucket located in `eu-north1` (Finland) is: ```url https://storage.eu-north1.nebius.cloud/training-artifacts/requests.txt ``` ### Encryption Nebius enforces strong encryption across all layers of data handling: * **At rest:** all objects in Object Storage are encrypted using AES-256 by default. * **In transit:** by default, communications use HTTPS (TLS 1.2 or higher). For selected buckets, you can request [HTTP access to the S3 API](https://docs.nebius.com/object-storage/http-access.md). For more information about encryption at rest, see [Encryption in Nebius AI Cloud](https://docs.nebius.com/security/encryption.md). ## Actions with buckets and objects In your project, you can [create buckets](https://docs.nebius.com/object-storage/buckets/manage.md), [upload objects](https://docs.nebius.com/object-storage/objects/upload-download.md#how-to-upload) to them and [download objects](https://docs.nebius.com/object-storage/objects/upload-download.md#how-to-download) from your buckets. # How to get started with Object Storage: Create your first bucket Source: https://docs.nebius.com/object-storage/quickstart.md Most ML/AI workloads involve large files, such as datasets and artifacts of trained models. To efficiently store, access, and share them, you can use Object Storage, a simple storage service offered by Nebius AI Cloud. In this guide, you will learn how to start using Object Storage. You will set up your environment to work with Object Storage, create your first *bucket* (a data container), and upload a test file. For visual guidance on creating a bucket and uploading objects in the web console, watch the video below. If you prefer other interfaces or written instructions, follow the steps further down. [YouTube video player](https://www.youtube.com/embed/Cx7BlL6PdKk) Visit [Nebius Academy](https://academy.nebius.com/trainer/nebius-ai-cloud-onboarding/lesson/b532ba82-1b87-4d8c-ae82-f99afa32d04d) for video tutorials to help you get started with Nebius AI Cloud. ## Prepare your environment Make sure that you meet the prerequisites for your preferred interface: > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Nebius AI Cloud CLI > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > In this guide, you will use the terminal in your environment, for example on your local machine, to run commands that create and manage Nebius AI Cloud resources. The commands use certain command line interfaces (CLIs) and tools that you need to install first. Here are all the installation commands in a single copy-and-paste block: > > ```bash Ubuntu > sudo apt-get install unzip jq > curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" > unzip awscliv2.zip > sudo ./aws/install > curl -sSL https://artifacts.nebius.cloud/cli/install.sh | bash > nebius profile create > ``` > > ```bash macOS > brew install jq > curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" > sudo installer -pkg AWSCLIV2.pkg -target / > curl -sSL https://artifacts.nebius.cloud/cli/install.sh | bash > nebius profile create > ``` > > These commands will install the following: > > * **AWS CLI** ([how to install](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)) manages buckets and objects: Object Storage is compatible with Amazon S3. For Linux, the AWS CLI is distributed in a ZIP archive, so the commands also install the `unzip` package. > * **jq** ([how to install](https://jqlang.github.io/jq/download/)) parses JSON outputs from the Nebius AI Cloud CLI and extracts resource IDs for other commands. > * **Nebius AI Cloud CLI** ([how to install](https://docs.nebius.com/cli/install.md)) manages all Nebius AI Cloud resources. In this guide, the CLI is used to create access-related resources. It can also be used for creating and modifying Object Storage buckets, but not for uploading objects. > > The last command, `nebius profile create`, will guide you through several prompts. After you complete the prompts, your browser will open the Nebius AI Cloud web console sign-in screen. Sign in to the web console to complete the initialization. If you have access to multiple tenants, the CLI will prompt you to choose a tenant ID. After that, save your project ID in the CLI configuration. > > If the project ID hasn't been configured during the `nebius profile create` flow, [get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id) and save it in the CLI configuration: > > ```bash > nebius config set parent-id > ``` ## Configure access, credentials, and AWS CLI settings > [!NOTE] > > If you are using the [web console](https://console.nebius.com), you can skip this step and proceed to [creating a bucket](https://docs.nebius.com/object-storage/quickstart.md#create-a-bucket-and-upload-a-file-to-it). 1. Create a service account and save its ID to an environment variable: ```bash export SA_ID=$(nebius iam service-account create \ --name object-storage-sa \ --format jsonpath='{.metadata.id}') ``` 2. Grant edit access to the service account: 1. Get the tenant ID: ```bash export PROJECT_ID=$(nebius config get parent-id) export TENANT_ID=$(nebius iam project get $PROJECT_ID --format jsonpath='{.metadata.parent_id}') ``` 2. Get the ID of the default `editors` group: ```bash export EDITORS_GROUP_ID=$(nebius iam group get-by-name \ --name editors --parent-id $TENANT_ID \ --format jsonpath='{.metadata.id}') ``` 3. Add the service account to `editors` group: ```bash nebius iam group-membership create \ --parent-id $EDITORS_GROUP_ID \ --member-id $SA_ID ``` 3. Create an [access key](https://docs.nebius.com/iam/service-accounts/access-keys.md) for the service account and get its AWS-like ID and contents: ```bash export ACCESS_KEY_ID=$(nebius iam v2 access-key create \ --account-service-account-id $SA_ID \ --description 'AWS CLI' \ --format json | jq -r '.metadata.id') export ACCESS_KEY_AWS_ID=$(nebius iam v2 access-key get \ --id $ACCESS_KEY_ID \ --format json | jq -r '.status.aws_access_key_id') export SECRET_ACCESS_KEY=$(nebius iam v2 access-key get \ --id $ACCESS_KEY_ID \ --format json | jq -r '.status.secret') ``` 4. Add the key to the AWS CLI configuration: ```bash aws configure set aws_access_key_id $ACCESS_KEY_AWS_ID aws configure set aws_secret_access_key $SECRET_ACCESS_KEY ``` 5. Depending on your project [region](https://docs.nebius.com/overview/regions.md), add the Nebius AI Cloud region ID and the Object Storage endpoint URL to the AWS CLI configuration: ```bash aws configure set region aws configure set endpoint_url https://storage..nebius.cloud ``` For example, run the following commands for a project in `eu-north1`: ```bash aws configure set region eu-north1 aws configure set endpoint_url https://storage.eu-north1.nebius.cloud ``` ## Create a bucket and upload a file to it In Object Storage, a bucket is a container for *objects*. An object, in turn, is a file together with its metadata such as the file name (it is called *object key* in Object Storage terms). You can use the [web console](https://console.nebius.com) or the AWS CLI to create buckets and upload objects. > [tab] Web console > > 1. Create a bucket: > 1. In the sidebar, go to **Storage** → **Object Storage**. > > 2. Click **Create resource** → **Bucket**. > > 3. (Optional) Specify the bucket name. > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > > 4. Set the [bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters). > > 5. Click **Create bucket**. > 2. Upload a file: > > 1. Click **Add** → **Object**. > 2. In the window that opens, select the file to upload. > 3. Click **Upload**. > 3. Check that the **Objects** tab shows the new object. > [tab] AWS CLI > > 1. Create a bucket: > > ```bash > aws s3 mb s3://quickstart-bucket > ``` > > 2. Upload an object: > > ```bash > echo 'Hello world!' > test.txt > aws s3 cp test.txt s3://quickstart-bucket/test.txt > ``` > > 3. To make sure that the object has been uploaded, list the objects in the bucket: > > ```bash > aws s3 ls s3://quickstart-bucket > ``` # How to manage Object Storage buckets Source: https://docs.nebius.com/object-storage/buckets/manage.md In Object Storage, files are stored in containers called *buckets*. You can create, modify, delete, or restore them. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] Nebius AI Cloud CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > The Nebius AI Cloud CLI supports all Object Storage features, as well as other Nebius AI Cloud resources, such as virtual machines and Managed Service for Kubernetes® clusters. > > For the commands in this guide to work, set the parent project in the CLI profile. The commands don't include `--parent-id` because they expect this value from the profile: > > ```sh > nebius config set parent-id > ``` > > You can also provide the project ID explicitly to creation commands, for example, `nebius storage bucket create --parent-id ...` > > For more information, see [How to get started with Object Storage: Create your first bucket](https://docs.nebius.com/object-storage/quickstart.md). > [tab] AWS CLI > > [Install and configure the AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md). It offers simple commands for bucket management, such as `aws s3 mb` to create buckets and `aws s3 rb` to delete them. For more advanced management, use `aws s3api` commands. > > For more information, see [How to get started with Object Storage: Create your first bucket](https://docs.nebius.com/object-storage/quickstart.md). > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to create buckets For visual guidance on creating a bucket and uploading objects in the web console, watch the video below. If you prefer other interfaces or written instructions, follow the steps further down. [YouTube video player](https://www.youtube.com/embed/Cx7BlL6PdKk) Visit [Nebius Academy](https://academy.nebius.com/trainer/nebius-ai-cloud-onboarding/lesson/b532ba82-1b87-4d8c-ae82-f99afa32d04d) for video tutorials to help you get started with Nebius AI Cloud. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > > 2. Click **Create resource** → **Bucket**. > > 3. (Optional) Specify the bucket name. > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > > 4. Set the [bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters). > > 5. Click **Create bucket**. > [tab] Nebius AI Cloud CLI > > To create a bucket, run the following command: > > ```bash > nebius storage bucket create --name > ``` > > You can extend this command with more parameters. See [Bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters-nebius-ai-cloud-cli) and [Examples](https://docs.nebius.com/object-storage/buckets/manage.md#examples-nebius-ai-cloud-cli). > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > [tab] AWS CLI > > ```bash > aws s3 mb s3:// > ``` > > The `mb` in the command stands for "make bucket." > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > [tab] Go SDK > > Create a bucket: > > ```go > createSvc := sdk.Services().Storage().V1().Bucket() > createOp, err := createSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = createOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Metadata.Name` to the bucket name. > > You can extend this request with more parameters. See [Examples](https://docs.nebius.com/object-storage/buckets/manage.md#examples-go-sdk). > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > [tab] Python SDK > > Create a bucket: > > ```python > create_service = BucketServiceClient(sdk) > create_operation = await create_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > ), > ) > await create_operation.wait() > ``` > > In the code, set `metadata.name` to the bucket name. > > You can extend this request with more parameters. See [Examples](https://docs.nebius.com/object-storage/buckets/manage.md#examples-python-sdk). > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > [tab] JavaScript SDK > > Create a bucket: > > ```ts > const createService = new BucketService(sdk); > const createOperation = await createService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > }), > ).result; > await createOperation.wait(); > ``` > > In the code, set `metadata.name` to the bucket name. > > You can extend this request with more parameters. See [Examples](https://docs.nebius.com/object-storage/buckets/manage.md#examples-javascript-sdk). > > The bucket name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). ## How to modify buckets > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the page of the required bucket. > 3. Go to the **Settings** tab. > 4. Modify the [bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters-web-console). > 5. Click **Save changes**. > [tab] Nebius AI Cloud CLI > > To modify a bucket and change its [parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters-nebius-ai-cloud-cli), run the following command: > > ```bash > nebius storage bucket update --id $BUCKET_ID --max-size-bytes 268435456000 > ``` > > The bucket is patched by default. Only the parameters specified in the CLI command are changed. To perform a full update, add `--full` to the command. This will update all parameters with the values specified in the command or the default values. > [tab] Go SDK > > Update the bucket's maximum size: > > ```go > sizeSvc := sdk.Services().Storage().V1().Bucket() > sizeBucket, err := sizeSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > sizeBucket.Spec.MaxSizeBytes = 268435456000 > sizeOp, err := sizeSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: sizeBucket.Metadata, > Spec: sizeBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = sizeOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `MaxSizeBytes`: Maximum total size of objects in the bucket, in bytes. The example sets `268435456000`. > [tab] Python SDK > > Update the bucket's maximum size: > > ```python > size_service = BucketServiceClient(sdk) > size_bucket = await size_service.get( > GetBucketRequest(id=""), > ) > size_bucket.spec.max_size_bytes = 268435456000 > size_operation = await size_service.update( > UpdateBucketRequest( > metadata=size_bucket.metadata, > spec=size_bucket.spec, > ), > ) > await size_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `max_size_bytes`: Maximum total size of objects in the bucket, in bytes. The example sets `268435456000`. > [tab] JavaScript SDK > > Update the bucket's maximum size: > > ```ts > const sizeService = new BucketService(sdk); > const sizeBucket = await sizeService.get( > GetBucketRequest.create({ id: "" }), > ).result; > sizeBucket.spec.maxSizeBytes = BigInt(268435456000); > const sizeOperation = await sizeService.update( > UpdateBucketRequest.create({ > metadata: sizeBucket.metadata, > spec: sizeBucket.spec, > }), > ).result; > await sizeOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `maxSizeBytes`: Maximum total size of objects in the bucket, in bytes. The example sets `268435456000`. ## Bucket parameters When creating or modifying a bucket, you can set the following parameters for it: > [tab] Web console > > * **Bucket size**: Specify the bucket's maximum size or select **Unlimited** to have an unlimited capacity. > * **Storage class**: Select **Standard** for low-cost unlimited capacity or **Enhanced Throughput** for storage that requires high bandwidth and low latency access. For more information, see [Storage classes in Object Storage](https://docs.nebius.com/object-storage/storage-classes.md). > * **Force storage class**: Overrides the storage class specified explicitly when you upload an object to this bucket. > * **Versioning**: Allows you to track and record all object changes. For more information, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md). > * **Data plane Audit Logs**: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant. > [tab] Nebius AI Cloud CLI > > * `--versioning-policy enabled`: Allows versioning of objects in the bucket. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md). > > * `--max-size-bytes 107374182400`: Limits the total size of objects in the bucket. > > * `--default-storage-class`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket. > > * `--force-storage-class`: Makes the default storage class override storage classes that you specify explicitly when uploading objects to the bucket. > > * `--lifecycle-configuration-rules '[{...}, {...}]'`: Adds object lifecycle rules to the bucket. For more information, see an [example below](https://docs.nebius.com/object-storage/buckets/manage.md#examples-nebius-ai-cloud-cli) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md). > > * `--object-audit-logging `: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant. > [tab] Go SDK > > * `VersioningPolicy`: Allows versioning of objects in the bucket. Set `VersioningPolicy_ENABLED` to enable it. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md). > > * `MaxSizeBytes`: Limits the total size of objects in the bucket, in bytes. > > * `DefaultStorageClass`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket. > > * `ForceStorageClass`: Set `true` to make the default storage class override storage classes that you specify explicitly when uploading objects to the bucket. > > * `LifecycleConfiguration`: Adds object lifecycle rules to the bucket. For more information, see an [example below](https://docs.nebius.com/object-storage/buckets/manage.md#examples-go-sdk) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md). > > * `ObjectAuditLogging`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant. > [tab] Python SDK > > * `versioning_policy`: Allows versioning of objects in the bucket. Set `VersioningPolicy.ENABLED` to enable it. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md). > > * `max_size_bytes`: Limits the total size of objects in the bucket, in bytes. > > * `default_storage_class`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket. > > * `force_storage_class`: Set `True` to make the default storage class override storage classes that you specify explicitly when uploading objects to the bucket. > > * `lifecycle_configuration`: Adds object lifecycle rules to the bucket. For more information, see an [example below](https://docs.nebius.com/object-storage/buckets/manage.md#examples-python-sdk) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md). > > * `object_audit_logging`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant. > [tab] JavaScript SDK > > * `versioningPolicy`: Allows versioning of objects in the bucket. Set `VersioningPolicy.ENABLED` to enable it. For more details, see [Managing bucket versioning](https://docs.nebius.com/object-storage/buckets/versioning.md). > > * `maxSizeBytes`: Limits the total size of objects in the bucket, in bytes. > > * `defaultStorageClass`: Sets the default [storage class](https://docs.nebius.com/object-storage/storage-classes.md) for the objects uploaded to the bucket. > > * `forceStorageClass`: Set `true` to make the default storage class override storage classes that you specify explicitly when uploading objects to the bucket. > > * `lifecycleConfiguration`: Adds object lifecycle rules to the bucket. For more information, see an [example below](https://docs.nebius.com/object-storage/buckets/manage.md#examples-javascript-sdk) and [Lifecycle rules for objects in Object Storage](https://docs.nebius.com/object-storage/objects/lifecycles.md). > > * `objectAuditLogging`: Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md) for the bucket, in addition to always-on control plane logging. To manage this setting, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant. > [!NOTE] > > After you enable versioning for an *existing* bucket for the first time, it may take up to 15 minutes to come into effect. We recommend waiting 15 minutes before performing any write operations (`PUT` or `DELETE`) to avoid issues with object visibility and version tracking. If you enable or suspend versioning when *creating* a bucket, it is available immediately with no waiting period. ## How to delete buckets You can delete a bucket immediately or schedule its deletion. If a bucket is scheduled for deletion, you can [restore the bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-restore-buckets) until it's deleted. After a bucket is deleted, you can't restore it. Whether you can schedule the deletion depends on the interface and the bucket's contents: * In the web console, you can schedule the deletion of a non-empty bucket. An empty bucket is deleted immediately. * In the Nebius AI Cloud CLI and SDKs, you can schedule the deletion of an empty or a non-empty bucket. * In the AWS CLI, you can't schedule the deletion of any bucket. > [tab] Web console > > To delete a bucket: > > 1. In the sidebar, go to  **Storage** → **Object Storage**. > 2. Find the bucket and then click  → **Delete**. > 3. In the window that opens: > > 1. If the bucket contains objects, select either **Delete now** or **Delete later**. For the **Delete later** option, specify for how long Object Storage should postpone the bucket deletion. > 2. Confirm the bucket deletion. > > If you select **Delete later**, you can't use or modify the bucket while it's scheduled for deletion. The bucket is not visible in the AWS CLI. > > > [!NOTE] > > > > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket scheduled for deletion. > [tab] Nebius AI Cloud CLI > > To delete a bucket: > > 1. Get the bucket ID: > > ```bash > export BUCKET_ID=$(nebius storage bucket get-by-name \ > --name --format jsonpath='{.metadata.id}') > ``` > > The command uses [jq](https://jqlang.github.io/jq/download/) to extract the bucket ID from the JSON output and pass it to the next commands. > > 2. Run one of the following commands: > > * Immediately delete an empty bucket: > > > [!WARNING] > > > > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this command. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md). > > ```bash > nebius storage bucket delete --id $BUCKET_ID > ``` > > * Immediately delete a non-empty bucket: > > ```bash > nebius storage bucket delete --id $BUCKET_ID --ttl 0s > ``` > > `--ttl 0s` specifies bucket deletion after 0 seconds. > > * Schedule bucket deletion: > > * With a delay time: > > ```bash > nebius storage bucket delete --id $BUCKET_ID --ttl > ``` > > `--ttl ` specifies the time after which the bucket is deleted along with its objects (if any). For example, `--ttl 1h20m30s`. > > * With a timestamp: > > ```bash > nebius storage bucket delete --id $BUCKET_ID --purge-at > ``` > > `--purge-at ` specifies a future timestamp when the bucket is deleted along with its objects (if any). For example, `--purge-at 2027-01-01T02:30:59Z`. > > If you schedule bucket deletion, the bucket status changes to `SCHEDULED_FOR_DELETION`. You can't use or modify the bucket in this status. The bucket is not visible in the AWS CLI. > > > [!NOTE] > > > > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status. > [tab] AWS CLI > > * To delete an empty bucket, run the following command: > > ```bash > aws s3 rb s3:// > ``` > > * To delete a bucket that contains objects, use the `--force` parameter: > > ```bash > aws s3 rb s3:// --force > ``` > > The command deletes the objects and then the bucket. > > > [!WARNING] > > > > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Both commands fail until you delete those versions. The command with the `--force` parameter deletes current objects only. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md). > [tab] Go SDK > > * Delete an empty bucket: > > ```go > deleteSvc := sdk.Services().Storage().V1().Bucket() > deleteBucket, err := deleteSvc.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > deleteBucketID := deleteBucket.GetMetadata().GetId() > deleteOp, err := deleteSvc.Delete( > ctx, > &storage.DeleteBucketRequest{ > Id: deleteBucketID, > }, > ) > if err != nil { > return err > } > if _, err = deleteOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Name` to the bucket name. > > > [!WARNING] > > > > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this code. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md). > > * Schedule deletion after a delay: > > ```go > ttl, err := time.ParseDuration("") > if err != nil { > return err > } > ttlSvc := sdk.Services().Storage().V1().Bucket() > ttlOp, err := ttlSvc.Delete( > ctx, > &storage.DeleteBucketRequest{ > Id: "", > Purge: &storage.DeleteBucketRequest_Ttl{ > Ttl: durationpb.New(ttl), > }, > }, > ) > if err != nil { > return err > } > if _, err = ttlOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `Ttl`: Delay after which the bucket and all objects in it are deleted. The code parses `` as a Go duration, for example `1h20m30s`. > > * Schedule deletion at a timestamp: > > ```go > purgeAt, err := time.Parse(time.RFC3339, "") > if err != nil { > return err > } > scheduledSvc := sdk.Services().Storage().V1().Bucket() > scheduledOp, err := scheduledSvc.Delete( > ctx, > &storage.DeleteBucketRequest{ > Id: "", > Purge: &storage.DeleteBucketRequest_PurgeAt{ > PurgeAt: timestamppb.New(purgeAt), > }, > }, > ) > if err != nil { > return err > } > if _, err = scheduledOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `PurgeAt`: Timestamp when the bucket and all objects in it are deleted. The code parses `` as RFC 3339, for example `2025-01-01T18:33:31Z`. > > The bucket is put into the `SCHEDULED_FOR_DELETION` status, and after the specified time passes, it is deleted. When the bucket is in this status, you cannot use or update it, but you can [restore it](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-restore-buckets-go-sdk). > > > [!NOTE] > > > > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status. > [tab] Python SDK > > * Delete an empty bucket: > > ```python > delete_service = BucketServiceClient(sdk) > delete_bucket = await delete_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > delete_bucket_id = delete_bucket.metadata.id > delete_operation = await delete_service.delete( > DeleteBucketRequest(id=delete_bucket_id), > ) > await delete_operation.wait() > ``` > > In the code, set `name` to the bucket name. > > > [!WARNING] > > > > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this code. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md). > > * Schedule deletion after a delay: > > ```python > delay = "" > ttl = timedelta(hours=int(delay.removesuffix("h"))) > ttl_service = BucketServiceClient(sdk) > ttl_operation = await ttl_service.delete( > DeleteBucketRequest( > id="", > ttl=ttl, > ), > ) > await ttl_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `ttl`: Delay after which the bucket and all objects in it are deleted. The code reads `` as a number of hours followed by `h`, for example `2h`. > > * Schedule deletion at a timestamp: > > ```python > purge_at = datetime.fromisoformat( > "".replace("Z", "+00:00"), > ) > scheduled_service = BucketServiceClient(sdk) > scheduled_operation = await scheduled_service.delete( > DeleteBucketRequest( > id="", > purge_at=purge_at, > ), > ) > await scheduled_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `purge_at`: Timestamp when the bucket and all objects in it are deleted. The code reads `` as an ISO 8601 time, for example `2025-01-01T18:33:31Z`. > > The bucket is put into the `SCHEDULED_FOR_DELETION` status, and after the specified time passes, it is deleted. When the bucket is in this status, you cannot use or update it, but you can [restore it](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-restore-buckets-python-sdk). > > > [!NOTE] > > > > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status. > [tab] JavaScript SDK > > * Delete an empty bucket: > > ```ts > const deleteService = new BucketService(sdk); > const deleteBucket = await deleteService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > const deleteBucketId = deleteBucket.metadata.id; > const deleteOperation = await deleteService.delete( > DeleteBucketRequest.create({ id: deleteBucketId }), > ).result; > await deleteOperation.wait(); > ``` > > In the code, set `name` to the bucket name. > > > [!WARNING] > > > > If the bucket has versioning enabled, it may appear empty but still contain old versions of some objects. Make sure that you delete all versions of all objects in the bucket before you run this code. For more details, see [Managing objects in Object Storage buckets](https://docs.nebius.com/object-storage/objects/manage.md). > > * Schedule deletion after a delay: > > ```ts > dayjs.extend(duration); > const ttlSeconds = Number( > "".slice(0, -1), > ) * 3600; > const ttlDuration = dayjs.duration(ttlSeconds, "seconds"); > const ttlService = new BucketService(sdk); > const ttlOperation = await ttlService.delete( > DeleteBucketRequest.create({ > id: "", > purge: { > $case: "ttl", > ttl: ttlDuration, > }, > }), > ).result; > await ttlOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `purge.ttl`: Delay after which the bucket and all objects in it are deleted. The code reads `` as a number of hours with a one-character suffix, for example `2h`. > > * Schedule deletion at a timestamp: > > ```ts > const scheduledService = new BucketService(sdk); > const scheduledOperation = await scheduledService.delete( > DeleteBucketRequest.create({ > id: "", > purge: { > $case: "purgeAt", > purgeAt: dayjs(""), > }, > }), > ).result; > await scheduledOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `purge.purgeAt`: Timestamp when the bucket and all objects in it are deleted. The code reads `` as an ISO 8601 time, for example `2025-01-01T18:33:31Z`. > > The bucket is put into the `SCHEDULED_FOR_DELETION` status, and after the specified time passes, it is deleted. When the bucket is in this status, you cannot use or update it, but you can [restore it](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-restore-buckets-javascript-sdk). > > > [!NOTE] > > > > Nebius AI Cloud still [charges](https://docs.nebius.com/object-storage/resources/pricing.md) you for the bucket in the `SCHEDULED_FOR_DELETION` status. ### How to immediately delete a bucket scheduled for deletion To delete a bucket before its scheduled deletion time: > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Object Storage**. > 2. Go to the **Deleted** tab. > 3. Locate the bucket and then click  → **Delete now**. > 4. Confirm the bucket deletion. > [tab] Nebius AI Cloud CLI > > Run the following command: > > ```bash > nebius storage bucket purge --id $BUCKET_ID > ``` > [tab] Go SDK > > Delete the bucket immediately: > > ```go > purgeSvc := sdk.Services().Storage().V1().Bucket() > purgeOp, err := purgeSvc.Purge( > ctx, > &storage.PurgeBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = purgeOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Id` to the bucket ID. > [tab] Python SDK > > Delete the bucket immediately: > > ```python > purge_service = BucketServiceClient(sdk) > purge_operation = await purge_service.purge( > PurgeBucketRequest(id=""), > ) > await purge_operation.wait() > ``` > > In the code, set `id` to the bucket ID. > [tab] JavaScript SDK > > Delete the bucket immediately: > > ```ts > const purgeService = new BucketService(sdk); > const purgeOperation = await purgeService.purge( > PurgeBucketRequest.create({ id: "" }), > ).result; > await purgeOperation.wait(); > ``` > > In the code, set `id` to the bucket ID. ## How to restore buckets You can restore a bucket until its scheduled deletion time. To restore the bucket: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Object Storage**. > 2. Go to the **Deleted** tab. > 3. Locate the bucket and then click **Restore**. > 4. Confirm the bucket restoration. > [tab] Nebius AI Cloud CLI > > Run the following command: > > ```bash > nebius storage bucket undelete --id $BUCKET_ID > ``` > [tab] Go SDK > > Restore the bucket: > > ```go > undeleteSvc := sdk.Services().Storage().V1().Bucket() > undeleteOp, err := undeleteSvc.Undelete( > ctx, > &storage.UndeleteBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = undeleteOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Id` to the bucket ID. > [tab] Python SDK > > Restore the bucket: > > ```python > undelete_service = BucketServiceClient(sdk) > undelete_operation = await undelete_service.undelete( > UndeleteBucketRequest(id=""), > ) > await undelete_operation.wait() > ``` > > In the code, set `id` to the bucket ID. > [tab] JavaScript SDK > > Restore the bucket: > > ```ts > const undeleteService = new BucketService(sdk); > const undeleteOperation = await undeleteService.undelete( > UndeleteBucketRequest.create({ id: "" }), > ).result; > await undeleteOperation.wait(); > ``` > > In the code, set `id` to the bucket ID. ## Examples > [tab] Nebius AI Cloud CLI > > * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes): > > ```bash > nebius storage bucket create --name \ > --max-size-bytes 268435456000 > ``` > > * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation: > > ```bash > nebius storage bucket create --name \ > --lifecycle-configuration-rules '[{ > "id": "lifecycle-delete-90-days-objects", > "status": "ENABLED", > "filter": { > "prefix": "" > }, > "expiration": { > "days": 90 > } > }]' > ``` > > * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket: > > ```bash > nebius storage bucket create --name \ > --default-storage-class standard \ > --force-storage-class > ``` > [tab] Go SDK > > * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes): > > ```go > maxSvc := sdk.Services().Storage().V1().Bucket() > maxOp, err := maxSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &storage.BucketSpec{ > MaxSizeBytes: 268435456000, > }, > }, > ) > if err != nil { > return err > } > if _, err = maxOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Metadata.Name` to the bucket name and `MaxSizeBytes` to `268435456000`. > > * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation: > > ```go > lifecycleSvc := sdk.Services().Storage().V1().Bucket() > lifecycleOp, err := lifecycleSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &storage.BucketSpec{ > LifecycleConfiguration: &storage.LifecycleConfiguration{ > Rules: []*storage.LifecycleRule{ > { > Id: "lifecycle-delete-90-days-objects", > Status: storage.LifecycleRule_ENABLED, > Filter: &storage.LifecycleFilter{ > Prefix: "", > }, > Expiration: &storage.LifecycleExpiration{ > ExpiredWith: &storage. > LifecycleExpiration_Days{ > Days: 90, > }, > }, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = lifecycleOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Bucket name. > * `Id`: Rule ID. The example uses `lifecycle-delete-90-days-objects`. > * `Status`: `LifecycleRule_ENABLED`. > * `Filter.Prefix`: Object key prefix. The example uses an empty prefix, so the rule applies to all objects. > * `Expiration.Days`: `90`. > > * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket: > > ```go > classSvc := sdk.Services().Storage().V1().Bucket() > classOp, err := classSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &storage.BucketSpec{ > DefaultStorageClass: storage.StorageClass_STANDARD, > ForceStorageClass: true, > }, > }, > ) > if err != nil { > return err > } > if _, err = classOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Bucket name. > * `DefaultStorageClass`: `StorageClass_STANDARD`. > * `ForceStorageClass`: `true`. > [tab] Python SDK > > * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes): > > ```python > max_service = BucketServiceClient(sdk) > max_operation = await max_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > spec=BucketSpec(max_size_bytes=268435456000), > ), > ) > await max_operation.wait() > ``` > > In the code, set `metadata.name` to the bucket name and `max_size_bytes` to `268435456000`. > > * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation: > > ```python > lifecycle_service = BucketServiceClient(sdk) > lifecycle_operation = await lifecycle_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > spec=BucketSpec( > lifecycle_configuration=LifecycleConfiguration( > rules=[ > LifecycleRule( > id="lifecycle-delete-90-days-objects", > status=LifecycleRule.Status.ENABLED, > filter=LifecycleFilter(prefix=""), > expiration=LifecycleExpiration(days=90), > ), > ], > ), > ), > ), > ) > await lifecycle_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.name`: Bucket name. > * `id`: Rule ID. The example uses `lifecycle-delete-90-days-objects`. > * `status`: `LifecycleRule.Status.ENABLED`. > * `filter.prefix`: Object key prefix. The example uses an empty prefix, so the rule applies to all objects. > * `expiration.days`: `90`. > > * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket: > > ```python > class_service = BucketServiceClient(sdk) > class_operation = await class_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > spec=BucketSpec( > default_storage_class=StorageClass.STANDARD, > force_storage_class=True, > ), > ), > ) > await class_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.name`: Bucket name. > * `default_storage_class`: `StorageClass.STANDARD`. > * `force_storage_class`: `True`. > [tab] JavaScript SDK > > * Creating a bucket with total objects size limited to 250 GiB (268,435,456,000 bytes): > > ```ts > const maxService = new BucketService(sdk); > const maxOperation = await maxService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: BucketSpec.create({ > maxSizeBytes: BigInt(268435456000), > }), > }), > ).result; > await maxOperation.wait(); > ``` > > In the code, set `metadata.name` to the bucket name and `maxSizeBytes` to `268435456000`. > > * Creating a bucket with an object lifecycle rule that deletes objects 90 days after their creation: > > ```ts > const lifecycleService = new BucketService(sdk); > const lifecycleOperation = await lifecycleService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: BucketSpec.create({ > lifecycleConfiguration: LifecycleConfiguration.create({ > rules: [ > LifecycleRule.create({ > id: "lifecycle-delete-90-days-objects", > status: LifecycleRule_Status.ENABLED, > filter: LifecycleFilter.create({ prefix: "" }), > expiration: LifecycleExpiration.create({ > expiredWith: { > $case: "days", > days: 90, > }, > }), > }), > ], > }), > }), > }), > ).result; > await lifecycleOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.name`: Bucket name. > * `id`: Rule ID. The example uses `lifecycle-delete-90-days-objects`. > * `status`: `LifecycleRule_Status.ENABLED`. > * `filter.prefix`: Object key prefix. The example uses an empty prefix, so the rule applies to all objects. > * `expiration.expiredWith.days`: `90`. > > * Creating a bucket with a forced Standard default storage class that overrides the storage class that you select explicitly for any individual object uploaded to the bucket: > > ```ts > const classService = new BucketService(sdk); > const classOperation = await classService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: BucketSpec.create({ > defaultStorageClass: StorageClass.STANDARD, > forceStorageClass: true, > }), > }), > ).result; > await classOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.name`: Bucket name. > * `defaultStorageClass`: `StorageClass.STANDARD`. > * `forceStorageClass`: `true`. # How to manage filesystem buckets Source: https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md A *filesystem bucket* adds the Object Storage interface to an existing shared filesystem. You can attach a bucket to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems) to read or write data by using an S3-compatible API, or copy data from S3-compatible storage to the filesystem by using a data transfer or S3-compatible tools, such as [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md) or [s5cmd](https://github.com/peak/s5cmd). Files from the filesystem are immediately visible as S3 objects when a filesystem bucket is attached. Objects in the filesystem bucket are also stored in the filesystem as files. > [!WARNING] > > Filesystem buckets are excluded from the [Object Storage service level policy](https://docs.nebius.com/legal/sla-levels/storage.md) and are not covered by the Object Storage SLA. Filesystem buckets in Object Storage are [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages). Filesystem buckets count toward your bucket quota in Object Storage. For more information, see [Quotas and limits in Object Storage](https://docs.nebius.com/object-storage/resources/quotas-limits.md). ## Prerequisites > [tab] Web console > > 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > Instead of the `editor` role, you can have the [compute.use-via-object-storage role](https://docs.nebius.com/iam/authorization/roles.md#compute), which gives access to shared filesystems through Object Storage. > > 2. If you don't have a shared filesystem yet, [create one](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-shared-filesystem-web-console). > [tab] Nebius AI Cloud CLI > > 1. [Install and configure the Nebius AI Cloud CLI](https://docs.nebius.com/cli/quickstart.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > Instead of the `editor` role, you can have the [compute.use-via-object-storage role](https://docs.nebius.com/iam/authorization/roles.md#compute), which gives access to shared filesystems through Object Storage. > > 3. If you don't have a shared filesystem yet, [create one](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-shared-filesystem-cli). > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > Instead of the `editor` role, you can have the [compute.use-via-object-storage role](https://docs.nebius.com/iam/authorization/roles.md#compute), which gives access to shared filesystems through Object Storage. > > 3. If you don't have a shared filesystem yet, [create one](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-shared-filesystem-go-sdk). > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > Instead of the `editor` role, you can have the [compute.use-via-object-storage role](https://docs.nebius.com/iam/authorization/roles.md#compute), which gives access to shared filesystems through Object Storage. > > 3. If you don't have a shared filesystem yet, [create one](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-shared-filesystem-python-sdk). > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > Instead of the `editor` role, you can have the [compute.use-via-object-storage role](https://docs.nebius.com/iam/authorization/roles.md#compute), which gives access to shared filesystems through Object Storage. > > 3. If you don't have a shared filesystem yet, [create one](https://docs.nebius.com/compute/storage/manage.md#how-to-create-a-shared-filesystem-javascript-sdk). ## How to create a filesystem bucket > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Click **Create resource** → **Filesystem bucket**. > 3. Specify the filesystem bucket parameters: > > * **Filesystem**: From the list, select the shared filesystem that you want to attach the bucket to. > * **Bucket name**: Specify the name of the filesystem bucket. By default, the web console generates a name automatically, and you can keep it or replace it with your own name. The name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > * (Optional) **Directory path**: Specify the directory inside the filesystem that should back this filesystem bucket. Only files in this directory are accessible via the S3 endpoint. If you leave the field empty or specify `/`, the filesystem bucket is attached at the filesystem root. If you specify a directory that doesn't exist yet, it will be created. > * (Optional) **Data plane audit logs**: Enable this option if you want to [log](https://docs.nebius.com/object-storage/logs.md) data plane operations for the filesystem bucket. > 4. (Optional) Configure **Advanced settings**. > > Files and folders in the attached filesystem will have POSIX ownership and permission attributes according to the values set in the following settings. The configured attributes do not affect how the bucket reads files and folders from the attached filesystem. > > * **Write UID**: User ID assigned to files and directories. The default value is `0`. > * **Write GID**: Group ID assigned to files and directories. The default value is `0`. > * **File permissions**: Permissions assigned to files. Specify the permissions as a four-digit octal value. The default value is `0644` (`rw-r--r--`), which means that the owner can read and write the file, and the group and others can only read it. > * **Folder permissions**: Permissions assigned to folders. Specify the permissions as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. On a folder, the sticky bit restricts deletion and renaming of its contents to the content owner, folder owner and `root`. The default value is `0755` (`rwxr-xr-x`), which means that the owner can read, write and access the directory, and the group and others can only read and access it. > 5. Click **Create bucket**. > > The filesystem bucket becomes available immediately after creation. You can find it in one of the following ways: > > * Go to **Storage** → **Shared filesystems**, open the shared filesystem and then switch to the **Attached buckets** tab. > * Go to **Storage** → **Object Storage** and then open the **Filesystem buckets** tab. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the filesystem you want to attach a bucket to: > > ```bash > nebius compute filesystem list --parent-id > ``` > > In the `--parent-id` parameter, specify the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli). > > 2. Create a filesystem bucket: > > ```bash > nebius storage bucket create \ > --parent-id \ > --name \ > --filesystem-bucket-filesystem-id \ > --filesystem-bucket-directory \ > --filesystem-bucket-gid \ > --filesystem-bucket-uid \ > --filesystem-bucket-file-mode \ > --filesystem-bucket-directory-mode \ > --object-audit-logging > ``` > > The command contains the following parameters: > > * `--parent-id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) of the project where you create the filesystem bucket. > * `--name`: Name of the filesystem bucket. The name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > * `--filesystem-bucket-filesystem-id`: ID of the shared filesystem that you want to attach to the filesystem bucket. > * `--filesystem-bucket-directory` (optional): Directory inside the shared filesystem that serves as the filesystem bucket root. The path must be absolute and normalized, without `.`, `..`, or repeated `/` characters. If omitted or empty, the filesystem root (`/`) is used. > * `--filesystem-bucket-gid` (optional): Group ID assigned to files and directories written through S3. The default value is `0`. > * `--filesystem-bucket-uid` (optional): User ID assigned to files and directories written through S3. The default value is `0`. > * `--filesystem-bucket-file-mode` (optional): POSIX permissions assigned to files uploaded through S3. Specify the permissions as a four-digit octal value. The default value is `0644` (`rw-r--r--`), which means that the owner can read and write the file, and the group and others can only read it. > * `--filesystem-bucket-directory-mode` (optional): POSIX permissions assigned to directories created through S3 operations. Specify the permissions as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. On a directory, the sticky bit restricts deletion and renaming of its contents to the content owner, directory owner and `root`. The default value is `0755` (`rwxr-xr-x`), which means that the owner can read, write and access the directory, and the group and others can only read and access it. > * `--object-audit-logging` (optional): Configures data plane [logging](https://docs.nebius.com/object-storage/logs.md#how-to-configure-data-plane-logs-nebius-ai-cloud-cli) for the filesystem bucket. > > In both interfaces, specify permissions as four-digit octal values. The defaults are `0644` for files and `0755` for directories. > > 3. Verify that the filesystem bucket was created: > > ```bash > nebius storage bucket get-by-name \ > --parent-id \ > --name > ``` > > The command output includes the ID of the filesystem bucket in `metadata.id`. > [tab] Go SDK > > 1. List shared filesystems in the project: > > ```go > filesystemService := sdk.Services().Compute().V1(). > Filesystem() > filesystems, err := filesystemService.List( > ctx, > &compute.ListFilesystemsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(filesystems) > ``` > > In the code, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). The code prints the list. > > 2. Create a filesystem bucket: > > ```go > createService := sdk.Services().Storage().V1().Bucket() > createOperation, err := createService.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &storage.BucketSpec{ > ObjectAuditLogging: storage. > BucketSpec_NONE, > BucketType: &storage.BucketSpec_FilesystemBucket{ > FilesystemBucket: &storage. > BucketSpec_FilesystemBucketType{ > FilesystemId: "", > Directory: "", > Uid: 0, > Gid: 0, > FileMode: "", > DirectoryMode: "", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = createOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Metadata.ParentId`: Project ID of the project where you create the filesystem bucket. > * `Metadata.Name`: Filesystem bucket name. The name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > * `ObjectAuditLogging`: Data plane [logging](https://docs.nebius.com/object-storage/logs.md#how-to-configure-data-plane-logs-go-sdk) mode. The example sets `BucketSpec_NONE`. > * `FilesystemId`: ID of the shared filesystem that you want to attach to the filesystem bucket. > * `Directory`: Directory inside the shared filesystem that serves as the filesystem bucket root. The path must be absolute and normalized, without `.`, `..`, or repeated `/` characters. If omitted or empty, the filesystem root (`/`) is used. > * `Uid`: User ID assigned to files and directories written through S3. The example sets `0`. > * `Gid`: Group ID assigned to files and directories written through S3. The example sets `0`. > * `FileMode`: POSIX permissions assigned to files uploaded through S3, as a four-digit octal value. > * `DirectoryMode`: POSIX permissions assigned to directories created through S3 operations, as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. > > 3. Verify that the filesystem bucket was created: > > ```go > getService := sdk.Services().Storage().V1().Bucket() > filesystemBucket, err := getService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(filesystemBucket) > ``` > > In the code, set `ParentId` to the project ID and `Name` to the filesystem bucket name. The response includes the filesystem bucket ID in `Metadata.Id`. > [tab] Python SDK > > 1. List shared filesystems in the project: > > ```python > filesystem_service = FilesystemServiceClient(sdk) > filesystems = await filesystem_service.list( > ListFilesystemsRequest(parent_id=""), > ) > print(filesystems) > ``` > > In the code, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). The code prints the list. > > 2. Create a filesystem bucket: > > ```python > create_service = BucketServiceClient(sdk) > create_operation = await create_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=BucketSpec( > object_audit_logging=( > BucketSpec.ObjectAuditLogging. > NONE > ), > filesystem_bucket=BucketSpec.FilesystemBucketType( > filesystem_id="", > directory="", > uid=0, > gid=0, > file_mode="", > directory_mode="", > ), > ), > ), > ) > await create_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.parent_id`: Project ID of the project where you create the filesystem bucket. > * `metadata.name`: Filesystem bucket name. The name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > * `object_audit_logging`: Data plane [logging](https://docs.nebius.com/object-storage/logs.md#how-to-configure-data-plane-logs-python-sdk) mode. The example sets `BucketSpec.ObjectAuditLogging.NONE`. > * `filesystem_id`: ID of the shared filesystem that you want to attach to the filesystem bucket. > * `directory`: Directory inside the shared filesystem that serves as the filesystem bucket root. The path must be absolute and normalized, without `.`, `..`, or repeated `/` characters. If omitted or empty, the filesystem root (`/`) is used. > * `uid`: User ID assigned to files and directories written through S3. The example sets `0`. > * `gid`: Group ID assigned to files and directories written through S3. The example sets `0`. > * `file_mode`: POSIX permissions assigned to files uploaded through S3, as a four-digit octal value. > * `directory_mode`: POSIX permissions assigned to directories created through S3 operations, as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. > > 3. Verify that the filesystem bucket was created: > > ```python > get_service = BucketServiceClient(sdk) > filesystem_bucket = await get_service.get_by_name( > GetBucketByNameRequest( > parent_id="", > name="", > ), > ) > print(filesystem_bucket) > ``` > > In the code, set `parent_id` to the project ID and `name` to the filesystem bucket name. The response includes the filesystem bucket ID in `metadata.id`. > [tab] JavaScript SDK > > 1. List shared filesystems in the project: > > ```ts > const filesystemService = new FilesystemService(sdk); > const filesystems = await filesystemService.list( > ListFilesystemsRequest.create({ > parentId: "", > }), > ).result; > console.log(filesystems); > ``` > > In the code, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). The code prints the list. > > 2. Create a filesystem bucket: > > ```ts > const createService = new BucketService(sdk); > const createOperation = await createService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > name: "", > }), > spec: BucketSpec.create({ > objectAuditLogging: BucketSpec_ObjectAuditLogging. > NONE, > bucketType: { > $case: "filesystemBucket", > filesystemBucket: BucketSpec_FilesystemBucketType. > create({ > filesystemId: "", > directory: "", > uid: 0, > gid: 0, > fileMode: "", > directoryMode: "", > }), > }, > }), > }), > ).result; > await createOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.parentId`: Project ID of the project where you create the filesystem bucket. > * `metadata.name`: Filesystem bucket name. The name must be unique across the region. For more information, see [Naming](https://docs.nebius.com/object-storage/overview.md#naming). > * `objectAuditLogging`: Data plane [logging](https://docs.nebius.com/object-storage/logs.md#how-to-configure-data-plane-logs-javascript-sdk) mode. The example sets `BucketSpec_ObjectAuditLogging.NONE`. > * `filesystemId`: ID of the shared filesystem that you want to attach to the filesystem bucket. > * `directory`: Directory inside the shared filesystem that serves as the filesystem bucket root. The path must be absolute and normalized, without `.`, `..`, or repeated `/` characters. If omitted or empty, the filesystem root (`/`) is used. > * `uid`: User ID assigned to files and directories written through S3. The example sets `0`. > * `gid`: Group ID assigned to files and directories written through S3. The example sets `0`. > * `fileMode`: POSIX permissions assigned to files uploaded through S3, as a four-digit octal value. > * `directoryMode`: POSIX permissions assigned to directories created through S3 operations, as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. > > 3. Verify that the filesystem bucket was created: > > ```ts > const getService = new BucketService(sdk); > const filesystemBucket = await getService.getByName( > GetBucketByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log(filesystemBucket); > ``` > > In the code, set `parentId` to the project ID and `name` to the filesystem bucket name. The response includes the filesystem bucket ID in `metadata.id`. ## How to use a filesystem bucket After you create a filesystem bucket, you can use it to access data stored in the filesystem. The data uploaded to the filesystem bucket is also stored in the filesystem. You can [upload and download objects](https://docs.nebius.com/object-storage/objects/upload-download.md) as well as [manage objects](https://docs.nebius.com/object-storage/objects/manage.md) as you do in regular Object Storage buckets that are not attached to a filesystem. ### Data transfers You can transfer data from S3-compatible storage to the attached filesystem in one of the following ways: * Create a [data transfer](https://docs.nebius.com/object-storage/transfer/overview.md) from the S3-compatible storage to the filesystem bucket. * Use an S3-compatible tool, such as [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md), [rclone](https://rclone.org/docs/) or [s5cmd](https://github.com/peak/s5cmd), to upload objects to the filesystem bucket. ## How to update a filesystem bucket > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > > 2. Open the **Filesystem buckets** tab and select the filesystem bucket. > > 3. Go to the **Settings** tab. > > 4. Update the settings: > > * **Data plane audit logs**: Enable or disable logging. If logging is enabled, select **Log all events** or **Log only changes in objects**. For details, see [Logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). > * **Advanced settings**: Change the **Write UID**, **Write GID**, **File permissions** or **Folder permissions** values assigned to files that are uploaded to the filesystem bucket. For file and folder permissions, specify a four-digit octal value. To enable the sticky bit for folders, use `1` as the first digit, for example, `1777`. > > 5. Click **Save changes**. > [tab] Nebius AI Cloud CLI > > To update data plane audit logging, POSIX ownership, or permissions, run: > > ```bash > nebius storage bucket update \ > --id \ > --filesystem-bucket-gid \ > --filesystem-bucket-uid \ > --filesystem-bucket-file-mode \ > --filesystem-bucket-directory-mode \ > --object-audit-logging > ``` > > In the command, specify the parameters that you want to update: > > * `--filesystem-bucket-gid`: Group ID assigned to files and directories written through S3. > * `--filesystem-bucket-uid`: User ID assigned to files and directories written through S3. > * `--filesystem-bucket-file-mode`: POSIX permissions assigned to files uploaded through S3. Specify the permissions as a four-digit octal value. > * `--filesystem-bucket-directory-mode`: POSIX permissions assigned to directories created through S3 operations. Specify the permissions as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. > * `--object-audit-logging`: Data plane logging mode. Specify `all` to log all data plane events, `mutate_only` to log only events that change objects or `none` to disable logging. > [tab] Go SDK > > Update data plane audit logging, POSIX ownership, or permissions: > > ```go > updateService := sdk.Services().Storage().V1().Bucket() > updateBucket, err := updateService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > updateBucket.Spec.ObjectAuditLogging = storage. > BucketSpec_MUTATE_ONLY > updateBucket.Spec.GetFilesystemBucket().Uid = 1000 > updateBucket.Spec.GetFilesystemBucket().Gid = 1000 > updateBucket.Spec.GetFilesystemBucket().FileMode = > "" > updateBucket.Spec.GetFilesystemBucket().DirectoryMode = > "" > updateOperation, err := updateService.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: updateBucket.Metadata, > Spec: updateBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updateOperation.Wait(ctx); err != nil { > return err > } > ``` > > The sample gets the filesystem bucket by `ParentId` and `Name`, then sets the following parameters: > > * `ObjectAuditLogging`: Data plane logging mode. The example sets `BucketSpec_MUTATE_ONLY`. > * `Uid`: User ID assigned to files and directories written through S3. The example sets `1000`. > * `Gid`: Group ID assigned to files and directories written through S3. The example sets `1000`. > * `FileMode`: POSIX permissions assigned to files uploaded through S3, as a four-digit octal value. > * `DirectoryMode`: POSIX permissions assigned to directories created through S3 operations, as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. > [tab] Python SDK > > Update data plane audit logging, POSIX ownership, or permissions: > > ```python > update_service = BucketServiceClient(sdk) > update_bucket = await update_service.get_by_name( > GetBucketByNameRequest( > parent_id="", > name="", > ), > ) > update_bucket.spec.object_audit_logging = ( > BucketSpec.ObjectAuditLogging.MUTATE_ONLY > ) > update_bucket.spec.filesystem_bucket.uid = 1000 > update_bucket.spec.filesystem_bucket.gid = 1000 > update_bucket.spec.filesystem_bucket.file_mode = ( > "" > ) > update_bucket.spec.filesystem_bucket.directory_mode = ( > "" > ) > update_operation = await update_service.update( > UpdateBucketRequest( > metadata=update_bucket.metadata, > spec=update_bucket.spec, > ), > ) > await update_operation.wait() > ``` > > The sample gets the filesystem bucket by `parent_id` and `name`, then sets the following parameters: > > * `object_audit_logging`: Data plane logging mode. The example sets `BucketSpec.ObjectAuditLogging.MUTATE_ONLY`. > * `uid`: User ID assigned to files and directories written through S3. The example sets `1000`. > * `gid`: Group ID assigned to files and directories written through S3. The example sets `1000`. > * `file_mode`: POSIX permissions assigned to files uploaded through S3, as a four-digit octal value. > * `directory_mode`: POSIX permissions assigned to directories created through S3 operations, as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. > [tab] JavaScript SDK > > Update data plane audit logging, POSIX ownership, or permissions: > > ```ts > const updateService = new BucketService(sdk); > const updateBucket = await updateService.getByName( > GetBucketByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > updateBucket.spec.objectAuditLogging = > BucketSpec_ObjectAuditLogging.MUTATE_ONLY; > const filesystemType = updateBucket.spec.bucketType. > filesystemBucket; > filesystemType.uid = 1000; > filesystemType.gid = 1000; > filesystemType.fileMode = ""; > filesystemType.directoryMode = ""; > const updateOperation = await updateService.update( > UpdateBucketRequest.create({ > metadata: updateBucket.metadata, > spec: updateBucket.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > The sample gets the filesystem bucket by `parentId` and `name`, then sets the following parameters: > > * `objectAuditLogging`: Data plane logging mode. The example sets `BucketSpec_ObjectAuditLogging.MUTATE_ONLY`. > * `uid`: User ID assigned to files and directories written through S3. The example sets `1000`. > * `gid`: Group ID assigned to files and directories written through S3. The example sets `1000`. > * `fileMode`: POSIX permissions assigned to files uploaded through S3, as a four-digit octal value. > * `directoryMode`: POSIX permissions assigned to directories created through S3 operations, as a four-digit octal value. To enable the sticky bit, use `1` as the first digit, for example, `1777`. ## How to delete a filesystem bucket > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the **Filesystem buckets** tab. > 3. Find the filesystem bucket and then click → **Delete**. > 4. Confirm the deletion. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the filesystem bucket: > > ```bash > nebius storage bucket list --parent-id > ``` > > In the `--parent-id` parameter, specify the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli). > > In the output, filesystem buckets include the `spec.filesystem_bucket` field. Find the filesystem bucket by its name. The filesystem bucket ID is shown in `metadata.id`. > > 2. Delete the filesystem bucket: > > ```bash > nebius storage bucket delete --id > ``` > > 3. Wait until the delete operation is complete. > [tab] Go SDK > > 1. List filesystem buckets in the project: > > ```go > listService := sdk.Services().Storage().V1().Bucket() > buckets, err := listService.List( > ctx, > &storage.ListBucketsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(buckets) > ``` > > In the code, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). The code prints the list. Filesystem buckets include `Spec.FilesystemBucket`. > > 2. Delete the filesystem bucket: > > ```go > deleteService := sdk.Services().Storage().V1().Bucket() > deleteBucket, err := deleteService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > deleteOperation, err := deleteService.Delete( > ctx, > &storage.DeleteBucketRequest{ > Id: deleteBucket.GetMetadata().GetId(), > }, > ) > if err != nil { > return err > } > if _, err = deleteOperation.Wait(ctx); err != nil { > return err > } > ``` > > The sample gets the filesystem bucket by `ParentId` and `Name`, then deletes it by the ID from that response. > [tab] Python SDK > > 1. List filesystem buckets in the project: > > ```python > list_service = BucketServiceClient(sdk) > buckets = await list_service.list( > ListBucketsRequest(parent_id=""), > ) > print(buckets) > ``` > > In the code, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). The code prints the list. Filesystem buckets include `spec.filesystem_bucket`. > > 2. Delete the filesystem bucket: > > ```python > delete_service = BucketServiceClient(sdk) > delete_bucket = await delete_service.get_by_name( > GetBucketByNameRequest( > parent_id="", > name="", > ), > ) > delete_operation = await delete_service.delete( > DeleteBucketRequest(id=delete_bucket.metadata.id), > ) > await delete_operation.wait() > ``` > > The sample gets the filesystem bucket by `parent_id` and `name`, then deletes it by the ID from that response. > [tab] JavaScript SDK > > 1. List filesystem buckets in the project: > > ```ts > const listService = new BucketService(sdk); > const buckets = await listService.list( > ListBucketsRequest.create({ > parentId: "", > }), > ).result; > console.log(buckets); > ``` > > In the code, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). The code prints the list. Filesystem buckets include `spec.filesystemBucket`. > > 2. Delete the filesystem bucket: > > ```ts > const deleteService = new BucketService(sdk); > const deleteBucket = await deleteService.getByName( > GetBucketByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > const deleteOperation = await deleteService.delete( > DeleteBucketRequest.create({ > id: deleteBucket.metadata.id, > }), > ).result; > await deleteOperation.wait(); > ``` > > The sample gets the filesystem bucket by `parentId` and `name`, then deletes it by the ID from that response. Deleting a filesystem bucket removes only the Object Storage bucket interface. It does not delete the data stored on the attached filesystem. ## Limitations Filesystem buckets have the following limitations: * Temporary files with the `.tmp` suffix can be visible in `ListObjectsV2` results. Filesystem buckets use these files for atomic writes and clean them up on a best-effort basis. * Bucket management has the following limitations: * After you create a bucket, you cannot change its type from regular to filesystem or from filesystem to regular. * [Bucket policies](https://docs.nebius.com/object-storage/buckets/bucket-policy.md) cannot be used to grant [anonymous access](https://docs.nebius.com/object-storage/buckets/bucket-policy.md#anonymous-access) to a filesystem bucket. * Delayed deletion and [bucket restoration](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-restore-buckets) are not supported. * Object integrity checksums are not supported. For integrity checks in regular buckets, see [How to verify object integrity](https://docs.nebius.com/object-storage/objects/manage.md#how-to-verify-object-integrity). * Object keys such as `a/b` and `a/b/c` cannot both exist as files, because `b` must be either a file or a directory on a filesystem. This can cause conflicts when migrating data from S3-compatible storage to a filesystem bucket. * Some [S3 API methods and parameters](https://docs.nebius.com/object-storage/interfaces/s3-api-compatibility.md#supported-s3-api-methods) and [S3-compatible headers](https://docs.nebius.com/object-storage/interfaces/s3-api-compatibility.md#supported-s3-headers) have limited support or are not supported. # How to manage object versioning in a bucket Source: https://docs.nebius.com/object-storage/buckets/versioning.md Object versioning allows you to keep multiple versions of the same object in a bucket. When versioning is enabled, each update to an object creates a new version instead of replacing the existing one. Versioning helps protect data from accidental deletion, overwriting or application errors and allows you to restore previous versions of objects. When versioning is enabled for a bucket: * Each object version receives a unique version ID * Uploading an object with the same key creates a new version * Previous versions remain stored in the bucket If multiple write operations for the same object occur simultaneously, Object Storage stores all of the resulting object versions. By default, versioning is disabled on buckets. After you enable versioning, you cannot fully disable it and can only suspend it. > [!NOTE] > > For lower latency and higher throughput in high-load scenarios, we recommend using buckets with versioning disabled. > [!WARNING] > > If your bucket has expiration lifecycle rules that permanently delete objects and you want to maintain the same behavior after enabling versioning, configure expiration for non-current object versions. Non-current version expiration rules manage the deletion of non-current object versions in a versioning-enabled bucket. For more information, see [Configure expiration lifecycle rules](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. To use the AWS CLI with Object Storage, see [Working with Object Storage buckets and objects using the AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md). > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to enable bucket versioning > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Object Storage**. > 2. Open the page of the required bucket. > 3. Go to the **Settings** tab. > 4. In the **Versioning** field, select **Enabled**. > 5. Click **Save changes**. > [tab] Nebius AI Cloud CLI > > 1. Get the bucket ID: > ```bash > export BUCKET_ID=$(nebius storage bucket get-by-name \ > --name --format jsonpath='{.metadata.id}') > ``` > 2. Enable versioning for the bucket: > ```bash > nebius storage bucket update --id $BUCKET_ID --versioning-policy enabled > ``` > [tab] AWS CLI > > Run the following command: > > ```bash > aws s3api put-bucket-versioning \ > --bucket \ > --versioning-configuration Status=Enabled \ > --endpoint-url https://storage..nebius.cloud > ``` > [tab] Go SDK > > ```go > enableSvc := sdk.Services().Storage().V1().Bucket() > enableBucket, err := enableSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > enableBucket.Spec.VersioningPolicy = storage.VersioningPolicy_ENABLED > enableOp, err := enableSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: enableBucket.Metadata, > Spec: enableBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = enableOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `VersioningPolicy`: `VersioningPolicy_ENABLED`. > [tab] Python SDK > > ```python > enable_service = BucketServiceClient(sdk) > enable_bucket = await enable_service.get( > GetBucketRequest(id=""), > ) > enable_bucket.spec.versioning_policy = VersioningPolicy.ENABLED > enable_operation = await enable_service.update( > UpdateBucketRequest( > metadata=enable_bucket.metadata, > spec=enable_bucket.spec, > ), > ) > await enable_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `versioning_policy`: `VersioningPolicy.ENABLED`. > [tab] JavaScript SDK > > ```ts > const enableService = new BucketService(sdk); > const enableBucket = await enableService.get( > GetBucketRequest.create({ id: "" }), > ).result; > enableBucket.spec.versioningPolicy = VersioningPolicy.ENABLED; > const enableOperation = await enableService.update( > UpdateBucketRequest.create({ > metadata: enableBucket.metadata, > spec: enableBucket.spec, > }), > ).result; > await enableOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `versioningPolicy`: `VersioningPolicy.ENABLED`. After versioning is enabled, all subsequent object uploads and modifications create new versions. > [!NOTE] > > After you enable versioning for an *existing* bucket for the first time, it may take up to 15 minutes to come into effect. We recommend waiting 15 minutes before performing any write operations (`PUT` or `DELETE`) to avoid issues with object visibility and version tracking. If you enable or suspend versioning when [*creating* a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets), it is available immediately with no waiting period. ## How to suspend bucket versioning If needed, you can suspend versioning for a bucket: > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Object Storage**. > 2. Open the page of the required bucket. > 3. Go to the **Settings** tab. > 4. In the **Versioning** field, enable the **Suspend** option. > 5. Click **Save changes**. > [tab] Nebius AI Cloud CLI > > 1. Get the bucket ID: > ```bash > export BUCKET_ID=$(nebius storage bucket get-by-name \ > --name --format jsonpath='{.metadata.id}') > ``` > 2. Suspend versioning for the bucket: > ```bash > nebius storage bucket update --id $BUCKET_ID --versioning-policy suspended > ``` > [tab] AWS CLI > > Run the following command: > > ```bash > aws s3api put-bucket-versioning \ > --bucket \ > --versioning-configuration Status=Suspended \ > --endpoint-url https://storage..nebius.cloud > ``` > [tab] Go SDK > > Suspend versioning for the bucket: > > ```go > suspendSvc := sdk.Services().Storage().V1().Bucket() > suspendBucket, err := suspendSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > suspendBucket.Spec.VersioningPolicy = > storage.VersioningPolicy_SUSPENDED > suspendOp, err := suspendSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: suspendBucket.Metadata, > Spec: suspendBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = suspendOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `VersioningPolicy`: `VersioningPolicy_SUSPENDED`. > [tab] Python SDK > > Suspend versioning for the bucket: > > ```python > suspend_service = BucketServiceClient(sdk) > suspend_bucket = await suspend_service.get( > GetBucketRequest(id=""), > ) > suspend_bucket.spec.versioning_policy = VersioningPolicy.SUSPENDED > suspend_operation = await suspend_service.update( > UpdateBucketRequest( > metadata=suspend_bucket.metadata, > spec=suspend_bucket.spec, > ), > ) > await suspend_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `versioning_policy`: `VersioningPolicy.SUSPENDED`. > [tab] JavaScript SDK > > Suspend versioning for the bucket: > > ```ts > const suspendService = new BucketService(sdk); > const suspendBucket = await suspendService.get( > GetBucketRequest.create({ id: "" }), > ).result; > suspendBucket.spec.versioningPolicy = VersioningPolicy.SUSPENDED; > const suspendOperation = await suspendService.update( > UpdateBucketRequest.create({ > metadata: suspendBucket.metadata, > spec: suspendBucket.spec, > }), > ).result; > await suspendOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `versioningPolicy`: `VersioningPolicy.SUSPENDED`. # Bucket inventory in Object Storage Source: https://docs.nebius.com/object-storage/buckets/inventory.md *Bucket inventory* generates scheduled reports that list the contents of a bucket. Object Storage delivers every report to the destination bucket of your choice as a set of objects in compressed CSV or [Apache Parquet](https://parquet.apache.org/) format. Use bucket inventory reports to audit stored objects, review object metadata, and prepare data for analytics or compliance workflows. > [!NOTE] > > Bucket inventory is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). Object Storage prepares reports asynchronously in the background, so they don't add to the bucket request rate. You can create up to five inventory configurations for the same bucket. For example, you can generate a daily report on the current versions of objects and a weekly report that includes all versions. Object Storage processes the configurations of a single bucket one after another. For details on how to set up scheduled reports, see [How to configure bucket inventory in Object Storage](https://docs.nebius.com/object-storage/buckets/configure-inventory.md). ## How Object Storage generates reports Object Storage creates reports according to the schedule of the configuration: **Daily** or **Weekly**. The exact time when a report is generated is not guaranteed. Objects in a report come in no particular order. A report is a snapshot of the bucket at the moment when Object Storage creates it. Because of this, it may not reflect the objects that were created, deleted or replaced with a new version while the report was being generated. ## What a report contains Every row of a report describes one object. The following fields are always included: | Field | Description | | - | - | | Bucket name | Name of the bucket. | | Key | Object key. | | ETag | Object entity tag. For more information on how Object Storage computes it, see [Behavioral differences](https://docs.nebius.com/object-storage/interfaces/s3-api-compatibility.md#behavioral-differences). | | Last modified date | Date and time of the last object change. | | Size | Object size in bytes. | | Storage class | [Storage class](https://docs.nebius.com/object-storage/storage-classes.md) that the object is stored in. | You can also include the following optional fields in a report: | Field | Description | | - | - | | Last access time | Date and time of the last access to the object. | | Checksum algorithms | Algorithms that Object Storage used to compute the object checksum. | | Intelligent storage class tier | Tier of the object if it is stored in the Intelligent [storage class](https://docs.nebius.com/object-storage/storage-classes.md). | | Multipart upload flag | `True` if the object was uploaded as a multipart upload. | | Lifecycle expiration date | Date when an expiration [lifecycle rule](https://docs.nebius.com/object-storage/objects/lifecycles.md) deletes the object. | | Tags | Tags assigned to the object. | | Version ID | ID of the object version. | | IsLatest | `True` if this version is the current version of the object. | | Delete marker | `True` if this version is a delete marker. | The Version ID, IsLatest and Delete marker fields only contain data if the configuration includes all object versions. ## How last access time tracking works Object Storage starts tracking last access time for a bucket when you configure an inventory report that includes the **Last access time** optional field or a [last-access lifecycle rule](https://docs.nebius.com/object-storage/objects/lifecycles.md#last-access-lifecycle-rules). Tracking starts on the day you create such a configuration or rule (or the next day). Reports don't include object access events that happened before tracking started. For example, if an object was accessed yesterday and you enable a report with the **Last access time** field today, the report won't show yesterday's access time. Object Storage stops tracking last access time when the bucket has no inventory configurations with the **Last access time** field and no last-access lifecycle rules. ## Where Object Storage delivers reports Object Storage writes every report to the destination bucket as a separate set of objects, so a new report never overwrites the previous one: ```text ///data/ ////manifest.json ////manifest.checksum ///hive/dt=/symlink.txt ``` The keys consist of the following parts: * ``: Prefix that you set in the configuration. Use it to keep inventory reports separate from other objects in the destination bucket. * ``: Name of the bucket. * ``: Name of the inventory configuration. * ``: Name of the report object. * ``: Moment when Object Storage created the report. Along with the report itself, Object Storage delivers the following files: * `manifest.json`: Metadata of the report, including the output format, the list of report objects and their checksums: ```json { "sourceBucket": "", "destinationBucket": "", "version": "2016-11-30", "creationTimestamp": "1781830800000", "fileFormat": "CSV", "fileSchema": "Bucket, Key, VersionId, IsLatest, IsDeleteMarker, Size, LastModifiedDate, ETag, StorageClass, IsMultipartUploaded, ChecksumAlgorithm", "files": [ { "key": "///data/", "size": 2997, "MD5checksum": "d25aa73bd27695113232a479d925278b" } ] } ``` * `manifest.checksum`: MD5 checksum of `manifest.json`. * `symlink.txt`: [Apache Hive](https://hive.apache.org)-compatible symlink that contains the key of the report object, so that query engines can read the report as a partitioned table. ## Limitations > [!WARNING] > > Bucket inventory fully manages the report objects in the destination bucket. If you create an object whose key matches the key of a report, Object Storage overwrites this object. * The destination bucket must be an Object Storage bucket in the same [region](https://docs.nebius.com/overview/regions.md) as the bucket where you want to create an inventory configuration. * Object Storage builds every report as a multipart upload. If the process restarts, the report starts from scratch, and an incomplete multipart upload can remain in the destination bucket. To clean up any incomplete uploads, configure an [expiration lifecycle rule](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules) that aborts them. * The S3 API actions that manage inventory configurations are not supported. For details, see [Compatibility of Amazon S3 API with Object Storage](https://docs.nebius.com/object-storage/interfaces/s3-api-compatibility.md). # How to configure and manage a bucket inventory in Object Storage Source: https://docs.nebius.com/object-storage/buckets/configure-inventory.md Create a [bucket inventory](https://docs.nebius.com/object-storage/buckets/inventory.md) configuration to get scheduled reports on the contents of a bucket. You can create up to five configurations for the same bucket and temporarily disable report generation without deleting the configuration when needed. ## Prerequisites > [tab] Web console > > Make sure that you have at least the following [roles](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant: > > * `storage.editor` to create, modify, or delete inventory configurations. > * `storage.uploader` for the destination bucket, its parent project, or tenant, to use another bucket as the destination for reports. > * `storage.viewer` to view inventory configurations. > [tab] Nebius AI Cloud CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > * Make sure that you have at least the following [roles](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant: > * `storage.editor` to create, modify, or delete inventory configurations. > * `storage.uploader` for the destination bucket, its parent project, or tenant, to use another bucket as the destination for reports. > * `storage.viewer` to view inventory configurations. > [tab] Terraform > > * [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > * Make sure that you have at least the following [roles](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant: > * `storage.editor` to create, modify, or delete inventory configurations. > * `storage.uploader` for the destination bucket, its parent project, or tenant, to use another bucket as the destination for reports. > * `storage.viewer` to view inventory configurations. > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > * Make sure that you have at least the following [roles](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant: > * `storage.editor` to create, modify, or delete inventory configurations. > * `storage.uploader` for the destination bucket, its parent project, or tenant, to use another bucket as the destination for reports. > * `storage.viewer` to view inventory configurations. > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > * Make sure that you have at least the following [roles](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant: > * `storage.editor` to create, modify, or delete inventory configurations. > * `storage.uploader` for the destination bucket, its parent project, or tenant, to use another bucket as the destination for reports. > * `storage.viewer` to view inventory configurations. > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > * Make sure that you have at least the following [roles](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant: > * `storage.editor` to create, modify, or delete inventory configurations. > * `storage.uploader` for the destination bucket, its parent project, or tenant, to use another bucket as the destination for reports. > * `storage.viewer` to view inventory configurations. ## How to create an inventory configuration > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > > 2. Open the page of the bucket where you want to create an inventory configuration. > > 3. Click **Add** → **Inventory configuration**. > > 4. Set the inventory configuration parameters: > > * **Name**: Name of the configuration. Object Storage uses it both in the list of configurations and in the [keys of report objects](https://docs.nebius.com/object-storage/buckets/inventory.md#where-object-storage-delivers-reports). > > * (Optional) **Source prefix**: Prefix that filters source objects included in the report. The report only contains objects whose keys start with this prefix. > > * **Project**: Project that contains the bucket where Object Storage delivers the reports. > > * **Bucket**: Bucket where Object Storage delivers the reports. You can select the current bucket or a different one in the same [region](https://docs.nebius.com/overview/regions.md). > > * (Optional) **Destination prefix**: Prefix that Object Storage adds to the keys of report objects. For example, `test_dir/`. Use it to keep reports separate from other objects in the destination bucket. > > * **Schedule**: How often Object Storage generates a report — **Daily** or **Weekly**. For details, see [How Object Storage generates reports](https://docs.nebius.com/object-storage/buckets/inventory.md#how-object-storage-generates-reports). > > * **Output format**: Format and compression of report objects: > > * **CSV compressed with GZIP** > * **Apache Parquet compressed with Snappy** > > * **Object versions**: Whether a report lists only the current version of every object (**Current version only**) or all its versions (**Include all versions**). > > * **Optional metadata fields to export**: Additional object metadata that Object Storage can include in a report. For more information, see [What a report contains](https://docs.nebius.com/object-storage/buckets/inventory.md#what-a-report-contains). > > 5. Click **Create**. > > The configuration will appear on the **Inventory configuration** tab of the bucket and become active. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the bucket where you want to create an inventory configuration: > > ```bash > export SOURCE_BUCKET_ID=$(nebius storage bucket get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 2. Get the ID of the bucket where Object Storage will deliver reports: > > ```bash > export DESTINATION_BUCKET_ID=$(nebius storage bucket get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Create an inventory configuration: > > ```bash > nebius storage inventory create \ > --parent-id $SOURCE_BUCKET_ID \ > --name \ > --destination-bucket-id $DESTINATION_BUCKET_ID \ > --destination-prefix \ > --source-prefix \ > --schedule daily \ > --output-format csv_gzip \ > --enabled=true \ > --noncurrent-versions=true \ > --optional-fields "last_access,checksum_algorithms" > ``` > > The command contains the following parameters: > > * `--parent-id`: ID of the bucket where you create the inventory configuration. > * `--destination-bucket-id`: ID of the bucket where Object Storage delivers reports. The bucket must be in the same [region](https://docs.nebius.com/overview/regions.md) as the source bucket. > * `--destination-prefix` (optional): Prefix that Object Storage adds to the keys of report objects. > * `--source-prefix` (optional): Prefix that filters source objects included in the report. > * `--schedule`: How often Object Storage generates a report: `daily` or `weekly`. > * `--output-format`: Format and compression of report objects: `csv_gzip` or `parquet_snappy`. > * `--enabled`: Enables report generation for the inventory configuration. Set it to `true` when you create a configuration that should start generating reports. > * `--noncurrent-versions` (optional): Includes noncurrent object versions in the report. Set it to `true` if you want the report to include all object versions. The bucket must have [versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) enabled. > * `--optional-fields` (optional): Additional object metadata fields to include in the report. The example exports the last access time and checksum algorithms. > [tab] Terraform > > 1. Add an inventory configuration to your Terraform configuration: > > ```hcl > resource "nebius_storage_v1_inventory" "inventory" { > parent_id = "" > name = "" > destination_bucket_id = "" > destination_prefix = "" > source_prefix = "" > schedule = "DAILY" > output_format = "CSV_GZIP" > enabled = true > noncurrent_versions = true > optional_fields = ["LAST_ACCESS", "CHECKSUM_ALGORITHMS"] > } > ``` > > The configuration contains the following arguments: > > * `parent_id`: ID of the bucket where you create the inventory configuration. > * `destination_bucket_id`: ID of the bucket where Object Storage delivers reports. The bucket must be in the same [region](https://docs.nebius.com/overview/regions.md) as the source bucket. > * `destination_prefix` (optional): Prefix that Object Storage adds to the keys of report objects. > * `source_prefix` (optional): Prefix that filters source objects included in the report. > * `schedule`: How often Object Storage generates a report: `DAILY` or `WEEKLY`. > * `output_format`: Format and compression of report objects: `CSV_GZIP` or `PARQUET_SNAPPY`. > * `enabled`: Enables report generation for the inventory configuration. Set it to `true` when you create a configuration that should start generating reports. > * `noncurrent_versions` (optional): Includes noncurrent object versions in the report. Set it to `true` if you want the report to include all object versions. The bucket must have [versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) enabled. > * `optional_fields` (optional): Additional object metadata fields to include in the report. The example exports the last access time and checksum algorithms. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the bucket where you want to create an inventory configuration: > > ```go > sourceService := sdk.Services().Storage().V1().Bucket() > sourceBucket, err := sourceService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(sourceBucket.GetMetadata().GetId()) > ``` > > In the code, set `Name` to the bucket name. The code prints the bucket ID. > > 2. Get the ID of the bucket where Object Storage will deliver reports: > > ```go > destinationService := sdk.Services().Storage().V1(). > Bucket() > destinationBucket, err := destinationService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(destinationBucket.GetMetadata().GetId()) > ``` > > In the code, set `Name` to the bucket name. The code prints the bucket ID. > > 3. Create an inventory configuration: > > ```go > createService := sdk.Services().Storage().V1(). > Inventory() > createOperation, err := createService.Create( > ctx, > &storage.CreateInventoryRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &storage.InventorySpec{ > Enabled: true, > SourcePrefix: "", > DestinationBucketId: "", > DestinationPrefix: "", > OutputFormat: storage.InventorySpec_CSV_GZIP, > NoncurrentVersions: true, > OptionalFields: []storage.InventorySpec_OptionalField{ > storage.InventorySpec_LAST_ACCESS, > storage.InventorySpec_CHECKSUM_ALGORITHMS, > }, > Schedule: storage.InventorySpec_DAILY, > }, > }, > ) > if err != nil { > return err > } > if _, err = createOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Configuration name. > * `Metadata.ParentId`: ID of the bucket where you create the inventory configuration. > * `SourcePrefix`: Prefix that filters source objects included in the report. > * `DestinationBucketId`: ID of the bucket where Object Storage delivers reports. The bucket must be in the same [region](https://docs.nebius.com/overview/regions.md) as the source bucket. > * `DestinationPrefix`: Prefix that Object Storage adds to the keys of report objects. > > The example sets `Enabled` to `true`, `OutputFormat` to `InventorySpec_CSV_GZIP`, `NoncurrentVersions` to `true`, `OptionalFields` to `InventorySpec_LAST_ACCESS` and `InventorySpec_CHECKSUM_ALGORITHMS`, and `Schedule` to `InventorySpec_DAILY`. > [tab] Python SDK > > 1. Get the ID of the bucket where you want to create an inventory configuration: > > ```python > source_service = BucketServiceClient(sdk) > source_bucket = await source_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(source_bucket.metadata.id) > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. Get the ID of the bucket where Object Storage will deliver reports: > > ```python > destination_service = BucketServiceClient(sdk) > destination_bucket = await destination_service.get_by_name( > GetBucketByNameRequest( > name="", > ), > ) > print(destination_bucket.metadata.id) > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 3. Create an inventory configuration: > > ```python > create_service = InventoryServiceClient(sdk) > create_operation = await create_service.create( > CreateInventoryRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=InventorySpec( > enabled=True, > source_prefix="", > destination_bucket_id="", > destination_prefix="", > output_format=InventorySpec.OutputFormat.CSV_GZIP, > noncurrent_versions=True, > optional_fields=[ > InventorySpec.OptionalField.LAST_ACCESS, > InventorySpec.OptionalField.CHECKSUM_ALGORITHMS, > ], > schedule=InventorySpec.Schedule.DAILY, > ), > ), > ) > await create_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.name`: Configuration name. > * `metadata.parent_id`: ID of the bucket where you create the inventory configuration. > * `source_prefix`: Prefix that filters source objects included in the report. > * `destination_bucket_id`: ID of the bucket where Object Storage delivers reports. The bucket must be in the same [region](https://docs.nebius.com/overview/regions.md) as the source bucket. > * `destination_prefix`: Prefix that Object Storage adds to the keys of report objects. > > The example sets `enabled` to `True`, `output_format` to `InventorySpec.OutputFormat.CSV_GZIP`, `noncurrent_versions` to `True`, `optional_fields` to `InventorySpec.OptionalField.LAST_ACCESS` and `InventorySpec.OptionalField.CHECKSUM_ALGORITHMS`, and `schedule` to `InventorySpec.Schedule.DAILY`. > [tab] JavaScript SDK > > 1. Get the ID of the bucket where you want to create an inventory configuration: > > ```ts > const sourceService = new BucketService(sdk); > const sourceBucket = await sourceService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(sourceBucket.metadata?.id); > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. Get the ID of the bucket where Object Storage will deliver reports: > > ```ts > const destinationService = new BucketService(sdk); > const destinationBucket = await destinationService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(destinationBucket.metadata?.id); > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 3. Create an inventory configuration: > > ```ts > const createService = new InventoryService(sdk); > const createOperation = await createService.create( > CreateInventoryRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > parentId: "", > }), > spec: InventorySpec.create({ > enabled: true, > sourcePrefix: "", > destinationBucketId: "", > destinationPrefix: "", > outputFormat: InventorySpec_OutputFormat.CSV_GZIP, > noncurrentVersions: true, > optionalFields: [ > InventorySpec_OptionalField.LAST_ACCESS, > InventorySpec_OptionalField.CHECKSUM_ALGORITHMS, > ], > schedule: InventorySpec_Schedule.DAILY, > }), > }), > ).result; > await createOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.name`: Configuration name. > * `metadata.parentId`: ID of the bucket where you create the inventory configuration. > * `sourcePrefix`: Prefix that filters source objects included in the report. > * `destinationBucketId`: ID of the bucket where Object Storage delivers reports. The bucket must be in the same [region](https://docs.nebius.com/overview/regions.md) as the source bucket. > * `destinationPrefix`: Prefix that Object Storage adds to the keys of report objects. > > The example sets `enabled` to `true`, `outputFormat` to `InventorySpec_OutputFormat.CSV_GZIP`, `noncurrentVersions` to `true`, `optionalFields` to `InventorySpec_OptionalField.LAST_ACCESS` and `InventorySpec_OptionalField.CHECKSUM_ALGORITHMS`, and `schedule` to `InventorySpec_Schedule.DAILY`. > [!NOTE] > > To report on all object versions, [enable versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) in the bucket where you want to create an inventory configuration. Otherwise, the report will only list current versions. ## How to view inventory configurations > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the page of the bucket where you want to view inventory configurations. > 3. Go to the **Inventory configuration** tab. > 4. To see all parameters of a specific configuration, open its page. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the bucket whose inventory configurations you want to view: > > ```bash > export SOURCE_BUCKET_ID=$(nebius storage bucket get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 2. List inventory configurations: > > ```bash > nebius storage inventory list --parent-id $SOURCE_BUCKET_ID > ``` > > 3. To see all parameters of a specific configuration, get it by name: > > ```bash > nebius storage inventory get-by-name \ > --parent-id $SOURCE_BUCKET_ID \ > --name > ``` > [tab] Terraform > > With Terraform, you can retrieve a specific inventory configuration by name or ID. The following example shows how to retrieve it by name. > > 1. Add a data source for the inventory configuration: > > ```hcl > data "nebius_storage_v1_inventory" "inventory" { > parent_id = "" > name = "" > } > > output "inventory_configuration" { > value = data.nebius_storage_v1_inventory.inventory > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the bucket whose inventory configurations you want to view: > > ```go > sourceService := sdk.Services().Storage().V1().Bucket() > sourceBucket, err := sourceService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(sourceBucket.GetMetadata().GetId()) > ``` > > In the code, set `Name` to the bucket name. The code prints the bucket ID. > > 2. List inventory configurations: > > ```go > listService := sdk.Services().Storage().V1().Inventory() > inventories, err := listService.List( > ctx, > &storage.ListInventoriesRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(inventories) > ``` > > In the code, set `ParentId` to the bucket ID. The code prints the list. > > 3. To see all parameters of a specific configuration, get it by name: > > ```go > getService := sdk.Services().Storage().V1().Inventory() > inventory, err := getService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(inventory) > ``` > > In the code, set `ParentId` to the bucket ID and `Name` to the configuration name. `Name` is the name you gave the configuration when you created it. The list from the previous step also shows this name. The code prints the configuration. > [tab] Python SDK > > 1. Get the ID of the bucket whose inventory configurations you want to view: > > ```python > source_service = BucketServiceClient(sdk) > source_bucket = await source_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(source_bucket.metadata.id) > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. List inventory configurations: > > ```python > list_service = InventoryServiceClient(sdk) > inventories = await list_service.list( > ListInventoriesRequest(parent_id=""), > ) > print(inventories) > ``` > > In the code, set `parent_id` to the bucket ID. The code prints the list. > > 3. To see all parameters of a specific configuration, get it by name: > > ```python > get_service = InventoryServiceClient(sdk) > inventory = await get_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > print(inventory) > ``` > > In the code, set `parent_id` to the bucket ID and `name` to the configuration name. `name` is the name you gave the configuration when you created it. The list from the previous step also shows this name. The code prints the configuration. > [tab] JavaScript SDK > > 1. Get the ID of the bucket whose inventory configurations you want to view: > > ```ts > const sourceService = new BucketService(sdk); > const sourceBucket = await sourceService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(sourceBucket.metadata?.id); > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. List inventory configurations: > > ```ts > const listService = new InventoryService(sdk); > const inventories = await listService.list( > ListInventoriesRequest.create({ > parentId: "", > }), > ).result; > console.log(inventories); > ``` > > In the code, set `parentId` to the bucket ID. The code prints the list. > > 3. To see all parameters of a specific configuration, get it by name: > > ```ts > const getService = new InventoryService(sdk); > const inventory = await getService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log(inventory); > ``` > > In the code, set `parentId` to the bucket ID and `name` to the configuration name. `name` is the name you gave the configuration when you created it. The list from the previous step also shows this name. The code prints the configuration. ## How to get a report Object Storage delivers reports as regular objects, so you work with them as with any other objects in a bucket. Reports are always compressed. > [!NOTE] > > A complete report can consist of multiple objects. To get the complete report, download every object listed in the `files` array of the `manifest.json` file. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the page of the destination bucket that you set in the configuration. > 3. Find the report objects you need. Object Storage stores them under the `///data/` prefix, where `` is the bucket that you analyze. For more information, see [Where Object Storage delivers reports](https://docs.nebius.com/object-storage/buckets/inventory.md#where-object-storage-delivers-reports). > 4. [Download](https://docs.nebius.com/object-storage/objects/upload-download.md#how-to-download-web-console) the report objects. > [tab] AWS CLI > > 1. Make sure that the [AWS CLI is configured](https://docs.nebius.com/object-storage/interfaces/aws-cli.md#configuring-aws-cli) to work with Object Storage. > 2. Download a report object: > > ```sh > aws s3 cp \ > s3://////data/ \ > > ``` > > Repeat this command for every object listed in the `files` array of the `manifest.json` file. > > For more information about downloading objects, see [Uploading and downloading objects in Object Storage](https://docs.nebius.com/object-storage/objects/upload-download.md#how-to-download-aws-cli). > [!TIP] > > To make sure that the report is complete, compare each report object's checksum with the corresponding checksum in the `manifest.json` file. ## How to modify an inventory configuration > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the page of the bucket where you want to modify an inventory configuration. > 3. Go to the **Inventory configuration** tab. > 4. Next to the configuration that you want to modify, click → **Edit**. > 5. Change the inventory configuration parameters and click **Save changes**. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```bash > export SOURCE_BUCKET_ID=$(nebius storage bucket get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 2. Get the inventory configuration ID: > > ```bash > export INVENTORY_ID=$(nebius storage inventory get-by-name \ > --parent-id $SOURCE_BUCKET_ID \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Update the inventory configuration: > > ```bash > nebius storage inventory update \ > --id $INVENTORY_ID \ > --destination-prefix \ > --schedule weekly \ > --output-format parquet_snappy > ``` > > In the command, add only the parameters that you want to change. > [tab] Terraform > > 1. In your Terraform configuration, change the arguments of the corresponding `nebius_storage_v1_inventory` resource. For example: > > ```hcl > resource "nebius_storage_v1_inventory" "inventory" { > parent_id = "" > name = "" > destination_bucket_id = "" > destination_prefix = "" > source_prefix = "" > schedule = "WEEKLY" > output_format = "PARQUET_SNAPPY" > enabled = true > noncurrent_versions = true > optional_fields = ["LAST_ACCESS", "CHECKSUM_ALGORITHMS"] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```go > sourceService := sdk.Services().Storage().V1().Bucket() > sourceBucket, err := sourceService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(sourceBucket.GetMetadata().GetId()) > ``` > > In the code, set `Name` to the bucket name. The code prints the bucket ID. > > 2. Update the inventory configuration: > > ```go > updateService := sdk.Services().Storage().V1(). > Inventory() > updateInventory, err := updateService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > updateInventory.Spec.DestinationPrefix = > "" > updateInventory.Spec.Schedule = storage.InventorySpec_WEEKLY > updateInventory.Spec.OutputFormat = > storage.InventorySpec_PARQUET_SNAPPY > updateOperation, err := updateService.Update( > ctx, > &storage.UpdateInventoryRequest{ > Metadata: updateInventory.Metadata, > Spec: updateInventory.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updateOperation.Wait(ctx); err != nil { > return err > } > ``` > > The sample gets the configuration by `ParentId` and `Name`, then changes `DestinationPrefix`, `Schedule`, and `OutputFormat`. `Name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-go-sdk) also shows this name. The example sets `Schedule` to `InventorySpec_WEEKLY` and `OutputFormat` to `InventorySpec_PARQUET_SNAPPY`. Other settings stay as they are on the configuration. > [tab] Python SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```python > source_service = BucketServiceClient(sdk) > source_bucket = await source_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(source_bucket.metadata.id) > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. Update the inventory configuration: > > ```python > update_service = InventoryServiceClient(sdk) > update_inventory = await update_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > update_inventory.spec.destination_prefix = ( > "" > ) > update_inventory.spec.schedule = InventorySpec.Schedule.WEEKLY > update_inventory.spec.output_format = ( > InventorySpec.OutputFormat.PARQUET_SNAPPY > ) > update_operation = await update_service.update( > UpdateInventoryRequest( > metadata=update_inventory.metadata, > spec=update_inventory.spec, > ), > ) > await update_operation.wait() > ``` > > The sample gets the configuration by `parent_id` and `name`, then changes `destination_prefix`, `schedule`, and `output_format`. `name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-python-sdk) also shows this name. The example sets `schedule` to `InventorySpec.Schedule.WEEKLY` and `output_format` to `InventorySpec.OutputFormat.PARQUET_SNAPPY`. Other settings stay as they are on the configuration. > [tab] JavaScript SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```ts > const sourceService = new BucketService(sdk); > const sourceBucket = await sourceService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(sourceBucket.metadata?.id); > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. Update the inventory configuration: > > ```ts > const updateService = new InventoryService(sdk); > const updateInventory = await updateService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > updateInventory.spec.destinationPrefix = > ""; > updateInventory.spec.schedule = InventorySpec_Schedule.WEEKLY; > updateInventory.spec.outputFormat = > InventorySpec_OutputFormat.PARQUET_SNAPPY; > const updateOperation = await updateService.update( > UpdateInventoryRequest.create({ > metadata: updateInventory.metadata, > spec: updateInventory.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > The sample gets the configuration by `parentId` and `name`, then changes `destinationPrefix`, `schedule`, and `outputFormat`. `name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-javascript-sdk) also shows this name. The example sets `schedule` to `InventorySpec_Schedule.WEEKLY` and `outputFormat` to `InventorySpec_OutputFormat.PARQUET_SNAPPY`. Other settings stay as they are on the configuration. Your changes will apply to the reports generated after the configuration change. Reports delivered earlier remain unchanged. ## How to stop or resume an inventory configuration Stop a configuration when you no longer need new reports but want to keep the configuration. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the page of the bucket where you want to stop or resume an inventory configuration. > 3. Go to the **Inventory configuration** tab. > 4. Next to the configuration you want to stop or resume, click and then select one of the following: > > * **Stop**: Object Storage stops generating reports, and the configuration status changes to **Stopped**. > * **Resume**: Object Storage resumes report generation according to the configuration schedule. It doesn't generate a report immediately. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```bash > export SOURCE_BUCKET_ID=$(nebius storage bucket get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 2. Get the inventory configuration ID: > > ```bash > export INVENTORY_ID=$(nebius storage inventory get-by-name \ > --parent-id $SOURCE_BUCKET_ID \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Run one of the following commands: > > * To stop generating reports: > > ```bash > nebius storage inventory update \ > --id $INVENTORY_ID \ > --enabled=false > ``` > > * To resume generating reports: > > ```bash > nebius storage inventory update \ > --id $INVENTORY_ID \ > --enabled=true > ``` > [tab] Terraform > > 1. In the corresponding `nebius_storage_v1_inventory` resource, change the `enabled` argument: > > * To stop generating reports, set `enabled` to `false`: > > ```hcl > resource "nebius_storage_v1_inventory" "inventory" { > parent_id = "" > name = "" > destination_bucket_id = "" > destination_prefix = "" > source_prefix = "" > schedule = "DAILY" > output_format = "CSV_GZIP" > enabled = false > noncurrent_versions = true > optional_fields = ["LAST_ACCESS", "CHECKSUM_ALGORITHMS"] > } > ``` > > * To resume generating reports, set `enabled` to `true`: > > ```hcl > resource "nebius_storage_v1_inventory" "inventory" { > parent_id = "" > name = "" > destination_bucket_id = "" > destination_prefix = "" > source_prefix = "" > schedule = "DAILY" > output_format = "CSV_GZIP" > enabled = true > noncurrent_versions = true > optional_fields = ["LAST_ACCESS", "CHECKSUM_ALGORITHMS"] > } > ``` > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```go > sourceService := sdk.Services().Storage().V1().Bucket() > sourceBucket, err := sourceService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(sourceBucket.GetMetadata().GetId()) > ``` > > In the code, set `Name` to the bucket name. The code prints the bucket ID. > > The samples get the configuration by `ParentId` and `Name`. `Name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-go-sdk) also shows this name. > > * To stop generating reports, set `Enabled` to `false`: > > ```go > stopService := sdk.Services().Storage().V1().Inventory() > stopInventory, err := stopService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > stopInventory.Spec.Enabled = false > stopOperation, err := stopService.Update( > ctx, > &storage.UpdateInventoryRequest{ > Metadata: stopInventory.Metadata, > Spec: stopInventory.Spec, > }, > ) > if err != nil { > return err > } > if _, err = stopOperation.Wait(ctx); err != nil { > return err > } > ``` > > * To resume generating reports, set `Enabled` to `true`: > > ```go > resumeService := sdk.Services().Storage().V1().Inventory() > resumeInventory, err := resumeService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > resumeInventory.Spec.Enabled = true > resumeOperation, err := resumeService.Update( > ctx, > &storage.UpdateInventoryRequest{ > Metadata: resumeInventory.Metadata, > Spec: resumeInventory.Spec, > }, > ) > if err != nil { > return err > } > if _, err = resumeOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```python > source_service = BucketServiceClient(sdk) > source_bucket = await source_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(source_bucket.metadata.id) > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > The samples get the configuration by `parent_id` and `name`. `name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-python-sdk) also shows this name. > > * To stop generating reports, set `enabled` to `False`: > > ```python > stop_service = InventoryServiceClient(sdk) > stop_inventory = await stop_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > stop_inventory.spec.enabled = False > stop_operation = await stop_service.update( > UpdateInventoryRequest( > metadata=stop_inventory.metadata, > spec=stop_inventory.spec, > ), > ) > await stop_operation.wait() > ``` > > * To resume generating reports, set `enabled` to `True`: > > ```python > resume_service = InventoryServiceClient(sdk) > resume_inventory = await resume_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > resume_inventory.spec.enabled = True > resume_operation = await resume_service.update( > UpdateInventoryRequest( > metadata=resume_inventory.metadata, > spec=resume_inventory.spec, > ), > ) > await resume_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```ts > const sourceService = new BucketService(sdk); > const sourceBucket = await sourceService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(sourceBucket.metadata?.id); > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > The samples get the configuration by `parentId` and `name`. `name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-javascript-sdk) also shows this name. > > * To stop generating reports, set `enabled` to `false`: > > ```ts > const stopService = new InventoryService(sdk); > const stopInventory = await stopService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > stopInventory.spec.enabled = false; > const stopOperation = await stopService.update( > UpdateInventoryRequest.create({ > metadata: stopInventory.metadata, > spec: stopInventory.spec, > }), > ).result; > await stopOperation.wait(); > ``` > > * To resume generating reports, set `enabled` to `true`: > > ```ts > const resumeService = new InventoryService(sdk); > const resumeInventory = await resumeService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > resumeInventory.spec.enabled = true; > const resumeOperation = await resumeService.update( > UpdateInventoryRequest.create({ > metadata: resumeInventory.metadata, > spec: resumeInventory.spec, > }), > ).result; > await resumeOperation.wait(); > ``` ## How to delete an inventory configuration > [!WARNING] > > Deleting an inventory configuration is permanent. To keep a configuration but stop generating new reports, [stop it](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-stop-or-resume-an-inventory-configuration) instead. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Open the page of the bucket where you want to delete an inventory configuration. > 3. Go to the **Inventory configuration** tab. > 4. Next to the configuration you want to delete, click → **Delete**. > 5. Enter the inventory configuration name and click **Delete inventory configuration**. > [tab] Nebius AI Cloud CLI > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```bash > export SOURCE_BUCKET_ID=$(nebius storage bucket get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 2. Get the inventory configuration ID: > > ```bash > export INVENTORY_ID=$(nebius storage inventory get-by-name \ > --parent-id $SOURCE_BUCKET_ID \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Delete the inventory configuration: > > ```bash > nebius storage inventory delete --id $INVENTORY_ID > ``` > [tab] Terraform > > 1. Remove the corresponding `nebius_storage_v1_inventory` resource from the Terraform configuration. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```go > sourceService := sdk.Services().Storage().V1().Bucket() > sourceBucket, err := sourceService.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(sourceBucket.GetMetadata().GetId()) > ``` > > In the code, set `Name` to the bucket name. The code prints the bucket ID. > > 2. Delete the inventory configuration: > > ```go > deleteService := sdk.Services().Storage().V1().Inventory() > deleteInventory, err := deleteService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > deleteOperation, err := deleteService.Delete( > ctx, > &storage.DeleteInventoryRequest{ > Id: deleteInventory.GetMetadata().GetId(), > }, > ) > if err != nil { > return err > } > if _, err = deleteOperation.Wait(ctx); err != nil { > return err > } > ``` > > The sample gets the configuration by `ParentId` and `Name`, then deletes it by the ID from that response. `Name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-go-sdk) also shows this name. > [tab] Python SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```python > source_service = BucketServiceClient(sdk) > source_bucket = await source_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(source_bucket.metadata.id) > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. Delete the inventory configuration: > > ```python > delete_service = InventoryServiceClient(sdk) > delete_inventory = await delete_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > delete_operation = await delete_service.delete( > DeleteInventoryRequest(id=delete_inventory.metadata.id), > ) > await delete_operation.wait() > ``` > > The sample gets the configuration by `parent_id` and `name`, then deletes it by the ID from that response. `name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-python-sdk) also shows this name. > [tab] JavaScript SDK > > 1. Get the ID of the bucket where the inventory configuration is created: > > ```ts > const sourceService = new BucketService(sdk); > const sourceBucket = await sourceService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(sourceBucket.metadata?.id); > ``` > > In the code, set `name` to the bucket name. The code prints the bucket ID. > > 2. Delete the inventory configuration: > > ```ts > const deleteService = new InventoryService(sdk); > const deleteInventory = await deleteService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > const deleteOperation = await deleteService.delete( > DeleteInventoryRequest.create({ > id: deleteInventory.metadata.id, > }), > ).result; > await deleteOperation.wait(); > ``` > > The sample gets the configuration by `parentId` and `name`, then deletes it by the ID from that response. `name` is the name you gave the configuration when you created it. [Listing the configurations](https://docs.nebius.com/object-storage/buckets/configure-inventory.md#how-to-view-inventory-configurations-javascript-sdk) also shows this name. Object Storage doesn't delete the reports that it has already delivered to the destination bucket. To remove them, [delete these objects](https://docs.nebius.com/object-storage/objects/manage.md#how-to-delete-objects) or [configure lifecycle rules](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md) for them. # Uploading and downloading objects in Object Storage Source: https://docs.nebius.com/object-storage/objects/upload-download.md In Object Storage, you work with files and folders called objects and place them in containers called buckets. This guide will help you upload files to buckets and download them. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] AWS CLI > > Install and configure the AWS CLI. It provides simple commands for object management, like `aws s3 cp` to move objects between a bucket and a local computer and `aws s3 rm` to delete them. > > For more details on installing and configuring, see [How to get started with Object Storage: Create your first bucket](https://docs.nebius.com/object-storage/quickstart.md) and the guide on the [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md). ### Object naming requirements Each Object Storage object has a *key*. This key can contain [prefixes](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html) — they act similarly to folders, organizing objects into groups. To avoid issues with your objects, follow these requirements: * Object keys can be up to 1024 bytes long, case sensitive. * Use UTF-8 alphanumeric characters, slashes (`/`) and certain [special characters](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-guidelines). For more information on character usage and which characters to avoid, see the [AWS object naming guidelines](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-guidelines). ## How to upload ### Uploading a single file > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > > 2. Select the bucket where you want to upload a file. > > 3. Upload a file: > > 1. Click **Add** → **Object**. > 2. In the window that opens, select the file to upload. > 3. Click **Upload**. > > 4. Check that the **Objects** tab shows the new object. > [tab] AWS CLI > > > [!WARNING] > > > > The [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md) does not support uploading objects to a storage class that differs from the bucket's default. To do that, use [s5cmd](https://github.com/peak/s5cmd). > > This command uploads a specified local file to your Object Storage bucket with a specified prefix: > > ```sh > aws s3 cp s3:/// > ``` > > The object is uploaded to the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) that is set as default for the bucket. > > You can find more information on the `cp` command in the [AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html). > [tab] s5cmd > > This command uploads a specified local file to your Object Storage bucket with a specified prefix: > > ```sh > s5cmd cp s3:/// > ``` > > The object is uploaded to the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) that is set as default for the bucket. If you need a different class, add the `--storage-class ` parameter to this command. ### Uploading a single file in parts Object Storage supports [multipart uploads](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html). For detailed instructions, see the [Amazon S3 documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html#clisupportformpu). > [!NOTE] > > For buckets created on or after November 9, 2026, Object Storage automatically deletes incomplete multipart uploads after 30 days. To change this behavior, [create an expiration lifecycle rule](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules) to abort incomplete multipart uploads according to your preferred pattern. Creating such a rule disables the default automatic deletion, even if you set the rule status to disabled. ### Uploading a folder You can use the web console to create a folder in a bucket and [upload files to it](https://docs.nebius.com/object-storage/objects/upload-download.md#uploading-a-single-file). With the AWS CLI, you can upload an entire local folder including its contents. > [tab] Web console > > To create a folder: > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Select the bucket where you want to create the folder. > 3. Click **Add** → **Folder**. > 4. In the **Create folder** window, enter a name and click **Create**. > > After you create the folder, you can [add files to it](https://docs.nebius.com/object-storage/objects/upload-download.md#uploading-a-single-file-web-console). > [tab] AWS CLI > > There are two ways to upload the contents of a specified local folder to your Object Storage bucket with a specified prefix: > > * `cp` command copies all the files from the source: > > ```sh > aws s3 cp --recursive \ > s3:///[]/ > ``` > > * `sync` command only copies new and updated files compared to the target: > > ```sh > aws s3 sync s3:///[]/ > ``` > > You can find more information on these commands in the AWS CLI reference: > > * [cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) > * [sync](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) > > If the name of your local folder contains spaces, put it in single quotation marks. For example: `Documents/'My ML configurations'/`. ## How to download You can download a single object from an Object Storage bucket with the web console or AWS CLI. The AWS CLI also lets you download all objects with a specified prefix. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Select the bucket that contains the object. > 3. In the row of the object to download, click → **Download**. > [tab] AWS CLI > > To download a single object with a specified prefix from your Object Storage bucket to a destination on your local machine: > > ```sh > aws s3 cp s3:/// > ``` > > To download all the objects with a specified prefix, use one of the following commands: > > * `cp` command: > > ```sh > aws s3 cp --recursive \ > s3:///[] > ``` > > * `sync` command: > > ```sh > aws s3 sync s3:///[] > ``` > > You can find more information on these commands in the AWS CLI reference: > > * [cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) > * [sync](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) > > If the name of your local folder contains spaces, put it in single quotation marks. For example: `Documents/'My ML configurations'/`. ## Example with the AWS CLI Assume that you already have an Object Storage bucket named `quickstart-bucket`. The example below shows how to upload objects to your bucket and download them using the AWS CLI. 1. Create a local folder from which you'll upload files to your bucket: ```sh mkdir lorem-ipsum ``` 2. Create the files to upload. Run the commands from the code block below: ```sh echo 'Lorem ipsum odor amet, consectetuer adipiscing elit. Posuere ullamcorper hendrerit faucibus pellentesque sociosqu montes. Tempus ut sit rutrum etiam sodales, porttitor congue condimentum nulla. Facilisis sodales habitant mi justo duis. Hendrerit praesent sit facilisi congue felis primis lobortis mattis nibh. Augue netus laoreet magna class enim fringilla molestie ipsum. Quisque natoque ligula lobortis accumsan potenti? Convallis pellentesque magna enim suscipit risus mauris molestie parturient quam.' > lorem-ipsum/lorem.txt echo 'Euismod porta phasellus bibendum urna dolor tincidunt dapibus eu maecenas. Aliquet eget gravida; tempus curae potenti class. Lectus nibh nam donec sagittis donec felis posuere libero. Suspendisse accumsan suscipit blandit orci platea iaculis ac. Suspendisse egestas aptent aliquam sapien ut maximus. Litora ridiculus augue mi, ut aliquam amet. Fusce dignissim nulla venenatis dis himenaeos habitasse. Blandit primis massa eros gravida rhoncus nascetur nulla' > lorem-ipsum/euismod.txt echo 'Litora integer iaculis libero dui pretium porta scelerisque. Dis laoreet ipsum porta viverra ipsum sem feugiat. Arcu ex natoque commodo faucibus facilisis vivamus sagittis; ultricies quis. Senectus vivamus nec cras porttitor penatibus. Ipsum vitae integer elementum; sem gravida etiam. Vivamus purus nunc nunc et aenean class. Tempor sagittis sociosqu erat class laoreet iaculis nec. Tempus ligula pellentesque a molestie fames elit vivamus.' > lorem-ipsum/litora.txt ``` This creates three text files in your new `lorem-ipsum/` folder: * `lorem.txt` * `euismod.txt` * `litora.txt` 3. Upload all the files from your `lorem-ipsum/` folder to your Object Storage bucket with the `lorem-ipsum` prefix: ```sh aws s3 cp lorem-ipsum/ s3://quickstart-bucket/lorem-ipsum/ --recursive ``` > [accordion] Output > > ```sh > upload: lorem-ipsum/lorem.txt to s3://quickstart-bucket/lorem-ipsum/lorem.txt > upload: lorem-ipsum/litora.txt to s3://quickstart-bucket/lorem-ipsum/litora.txt > upload: lorem-ipsum/euismod.txt to s3://quickstart-bucket/lorem-ipsum/euismod.txt > ``` 4. [List](https://docs.nebius.com/object-storage/objects/manage.md#how-to-view-objects) the objects with the `lorem-ipsum` prefix in your bucket: ```sh aws s3 ls s3://quickstart-bucket/lorem-ipsum --recursive --human-readable --summarize ``` > [accordion] Output > > ```sh > YYYY-MM-DD HH:MM:SS 458 Bytes lorem-ipsum/euismod.txt > YYYY-MM-DD HH:MM:SS 442 Bytes lorem-ipsum/litora.txt > YYYY-MM-DD HH:MM:SS 505 Bytes lorem-ipsum/lorem.txt > > Total Objects: 3 > Total Size: 1.4 KiB > ``` 5. Download the `lorem.txt` file from your bucket to the local `lorem-ipsum/` folder as `lorem-download.txt`: ```sh aws s3 cp s3://quickstart-bucket/lorem-ipsum/lorem.txt lorem-ipsum/lorem-download.txt ``` > [accordion] Output > > ```sh > download: s3://quickstart-bucket/lorem-ipsum/lorem.txt to lorem-ipsum/lorem-download.txt > ``` 6. Check if the downloaded file is there: ```sh ls lorem-ipsum/ ``` > [accordion] Output > > ```sh > euismod.txt litora.txt lorem-download.txt lorem.txt > ``` 7. [Delete](https://docs.nebius.com/object-storage/objects/manage.md#how-to-delete-objects) all the files with the `lorem-ipsum` prefix from your Object Storage bucket: ```sh aws s3 rm s3://quickstart-bucket/lorem-ipsum --recursive ``` > [accordion] Output > > ```sh > delete: s3://quickstart-bucket/lorem-ipsum/litora.txt > delete: s3://quickstart-bucket/lorem-ipsum/euismod.txt > delete: s3://quickstart-bucket/lorem-ipsum/lorem.txt > ``` 8. Remove the `lorem-ipsum/` folder from your computer: ```sh rm -r lorem-ipsum/ ``` # Managing objects in Object Storage buckets Source: https://docs.nebius.com/object-storage/objects/manage.md In Object Storage, you work with files and folders called *objects* and place them in containers called buckets. This guide will help you manage objects in buckets. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] AWS CLI > > Install and configure the AWS CLI. It provides simple commands for object management, like `aws s3 cp` to move objects between a bucket and a local computer and `aws s3 rm` to delete them. > > For more details on installing and configuring, see [How to get started with Object Storage: Create your first bucket](https://docs.nebius.com/object-storage/quickstart.md) and the guide on the [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md). ### Object naming requirements Each Object Storage object has a *key*. This key can contain [prefixes](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html) — they act similarly to folders, organizing objects into groups. To avoid issues with your objects, follow these requirements: * Object keys can be up to 1024 bytes long, case sensitive. * Use UTF-8 alphanumeric characters, slashes (`/`) and certain [special characters](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-guidelines). For more information on character usage and which characters to avoid, see the [AWS object naming guidelines](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-guidelines). ## How to view objects > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Select the bucket to view the objects in. The page shows a table with the following columns: **Key**, **Size**, **Storage class**, and **Last modified**. > 3. To see the contents of a folder, click the folder name in the **Key** column. > [tab] AWS CLI > > * To list all the prefixes and all the first-level objects in your Object Storage bucket: > > ```sh > aws s3 ls s3:///[] > ``` > > * To list all the objects with a specific prefix in your Object Storage bucket: > > ```sh > aws s3 ls s3:///[] --recursive --human-readable --summarize > ``` > > * To list all the objects arranged alphabetically by prefix in your Object Storage bucket: > > ```sh > aws s3 ls s3:/// --recursive --human-readable --summarize > ``` > > You can find more information on the `ls` command in the [AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/ls.html). ## How to share an object with a pre-signed URL A *pre-signed URL* grants temporary access to an object without requiring the recipient to have Nebius AI Cloud credentials. The URL is signed with the credentials of the account that creates it, and anyone with the URL can download the object until the URL expires. > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Select the bucket that contains the object. > 3. In the object's row, click → **Get link**. The pre-signed URL is copied to the clipboard. The URL is valid for one hour. > [tab] AWS CLI > > Pre-signed URLs must be created by accounts with [Object Storage roles](https://docs.nebius.com/object-storage/supported-actions.md) that support the `GetObject` action, because the URL uses the permissions of the creator. > > To generate a pre-signed URL for downloading an object, use the `presign` command: > > ```sh > aws s3 presign s3:/// > ``` > > By default, the URL is valid for 3600 seconds (1 hour). To set a different expiration time, add the `--expires-in` parameter with a value in seconds, up to 604800 seconds (7 days): > > ```sh > aws s3 presign s3:/// --expires-in > ``` > > The command uses the Object Storage [credentials](https://docs.nebius.com/object-storage/quickstart.md#configure-access-credentials-and-aws-cli-settings) from your AWS CLI configuration, so the resulting URL can be opened in a browser or passed to a tool like `curl` or `wget`. > > For more information on the `presign` command, see [AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/presign.html). ## How to verify object integrity > [!NOTE] > > The web console does not show checksum metadata. Use the AWS CLI to upload objects with a checksum and to retrieve the checksum of stored objects. Object Storage supports end-to-end integrity checks for the objects you upload. When you upload an object, you can provide its checksum along with the upload request. Object Storage then calculates the checksum of the stored object and compares it with the one you provided. If the checksums match, both the object and its checksum are stored, and the checksum can be retrieved later through `HeadObject` or `GetObject` requests. If the checksums don't match, the upload fails with an error. Both simple and multipart uploads support integrity checks. If no checksum is sent with the upload, Object Storage still calculates and stores one for the object, but this checksum is not validated during the upload. The AWS CLI v2 automatically calculates and sends a checksum on every upload, using `CRC64NVME` by default, and verifies the checksum on every download. You only need to specify `--checksum-algorithm` if you want to use a different algorithm. ### Supported checksum algorithms * `CRC64NVME` (default) * `CRC32` * `CRC32C` * `SHA1` * `SHA256` ### Uploading an object with a checksum To use a specific checksum algorithm, set the `--checksum-algorithm` parameter: ```sh aws s3 cp s3:/// --checksum-algorithm SHA256 ``` Object Storage recalculates the checksum on receipt. If it doesn't match the one sent by the AWS CLI, the upload fails. ### Retrieving the checksum of an object To retrieve the stored checksum of an existing object, use the `head-object` command with the `--checksum-mode` parameter set to `ENABLED`: ```sh aws s3api head-object \ --bucket \ --key \ --checksum-mode ENABLED ``` The output includes a checksum field, where the field name indicates the checksum algorithm and the value is a Base64-encoded checksum. For example: ```json { "ChecksumSHA256": "" } ``` ## How to rename an object > [!NOTE] > > Renaming objects is not supported in the web console. You can rename an object in your Object Storage bucket by using the following sequence: 1. Copy the object in question with a new name. You can also update an object's prefix: ```sh aws s3 cp \ s3:///[] \ # prefix and name of the object to rename s3:///[] # desired prefix and name of the object ``` 2. Remove the old copy of the renamed object: ```sh aws s3 rm s3:///[] ``` ## How to delete objects ### Deleting a single object > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Select the bucket that contains the object. > 3. Next to the object, click → **Delete**. > 4. In the **Delete object** window, type the object name in the confirmation field and click **Delete object**. > [tab] AWS CLI > > To remove the object with a specified key: > > ```sh > aws s3 rm s3:/// > ``` > > You can find more information on the `rm` command in the [AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rm.html). ### Deleting multiple objects > [tab] Web console > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Select the bucket that contains the objects. > 3. In the **Select** column, select the checkbox next to each object to delete. To select all the objects in the bucket, use the checkbox in the column header. > 4. In the banner that appears, click **Delete**. > 5. In the **Delete objects** window, type the bucket name in the confirmation field and click **Delete objects**. > [tab] AWS CLI > > To delete all the objects with a specified prefix: > > ```sh > aws s3 rm --recursive s3:///[] > ``` > > You can find more information on the `rm` command in the [AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rm.html). ### Deleting all objects > [tab] Web console > > To remove all the objects from a bucket, delete this bucket and create a new one in its place: > > 1. In the sidebar, go to **Storage** → **Object Storage**. > 2. Remove the existing bucket: > 1. Save the name and parameters of the bucket from which you want to remove all the objects. > 2. Next to the bucket, click  → **Delete**. > 3. Confirm the bucket deletion. Allow some time for your bucket to be deleted. You can monitor the status of your deleted bucket by selecting **Deleted** in the panel. > 3. Recreate your bucket: > 1. Click **Create bucket**. > 2. Under **Bucket name**, specify the bucket name you copied from the deleted bucket. > 3. Set the [bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters). > 4. Click **Create bucket**. > [tab] s5cmd > > To delete all the objects from the bucket: > > 1. Prepare the Object Storage endpoint URL (`endpoint-url`) for the bucket in question. It should follow this pattern: > > ```url > https://storage..nebius.cloud > ``` > > You can find your project's Region ID on the [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md#available-regions) page. > > 2. Run the following command: > > ```sh > s5cmd \ > --endpoint-url \ > rm --all-versions "s3:///*" > ``` > [tab] AWS CLI > > > [!TIP] > > > > The AWS API limit per `delete-objects` call is 1000 keys. The `--max-items` flag value meets that constraint. If your bucket contains more than 1000 objects or delete markers, run each command again as needed until all of them are removed. > > * To delete all the objects from the bucket, run the following command: > > ```sh > aws s3api delete-objects \ > --bucket \ > --delete \ > "$(aws s3api list-object-versions \ > --bucket \ > --query '{Objects: Versions[].{Key: Key, VersionId: VersionId}}' \ > --max-items 1000)" > ``` > > * If your bucket has [versioning](https://docs.nebius.com/object-storage/buckets/versioning.mdx) enabled, also remove all delete markers: > > ```sh > aws s3api delete-objects \ > --bucket \ > --delete \ > "$(aws s3api list-object-versions \ > --bucket \ > --query '{Objects: DeleteMarkers[].{Key: Key, VersionId: VersionId}}' \ > --max-items 1000)" > ``` > > You can find more information on the `delete-objects` S3 API command in the [AWS CLI reference](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). When an object is deleted from a bucket in Object Storage, it becomes immediately inaccessible and cannot be restored. The actual object data is then physically deleted from Nebius AI Cloud servers within 4 days. ## See also * [Working with Object Storage buckets and objects using the AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md) * [Sharing objects with presigned URLs in Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html) * [cp in AWS CLI reference](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) * [ls in AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/ls.html) * [rm in AWS CLI reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rm.html) * [Checksum validation in AWS CLI](https://docs.aws.amazon.com/cli/latest/topic/s3-faq.html#q-does-the-aws-cli-validate-checksums) * [Checking object integrity in Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) # Actions supported by Object Storage roles Source: https://docs.nebius.com/object-storage/supported-actions.md Actions available to Object Storage users with specific [roles](https://docs.nebius.com/iam/authorization/roles.md) are based on the [Amazon S3 API methods](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html). ## Available actions per role Object Storage roles support the following actions: | Action | `storage.object-viewer` | `storage.object-lister` | `storage.editor` | `storage.viewer` | `storage.uploader` | `storage.object-editor` | | - | - | - | - | - | - | - | | `GetObject` | ✓ | — | ✓ | ✓ | — | ✓ | | `HeadObject` | ✓ | — | ✓ | ✓ | — | ✓ | | `PutObject` | — | — | ✓ | — | ✓ | ✓ | | `DeleteObject` | — | — | ✓ | — | — | ✓ | | `DeleteObjects` | — | — | ✓ | — | — | ✓ | | `ListObjectsV2` | — | ✓ | ✓ | ✓ | — | ✓ | | `ListObjects` | — | ✓ | ✓ | ✓ | — | ✓ | | `ListObjectVersions` | — | ✓ | ✓ | ✓ | — | ✓ | | `CreateMultipartUpload` | — | — | ✓ | — | ✓ | ✓ | | `CompleteMultipartUpload` | — | — | ✓ | — | ✓ | ✓ | | `AbortMultipartUpload` | — | — | ✓ | — | ✓ | ✓ | | `ListMultipartUploads` | — | — | ✓ | ✓ | ✓ | ✓ | | `UploadPart` | — | — | ✓ | — | ✓ | ✓ | | `UploadPartCopy` | — | — | ✓ | — | ✓ | ✓ | | `CopyObject` | — | — | ✓ | — | ✓ | ✓ | | `PostObject` | — | — | ✓ | — | ✓ | ✓ | | `HeadBucket` | — | — | ✓ | ✓ | ✓ | — | | `CreateBucket` | — | — | ✓ | — | — | — | | `GetBucketLifecycleConfiguration` | — | — | ✓ | ✓ | ✓ | — | | `PutBucketLifecycleConfiguration` | — | — | ✓ | — | — | — | | `PutBucketCORS` | — | — | ✓ | — | — | — | | `PutBucketVersioning` | — | — | ✓ | — | — | — | | `GetBucketVersioning` | — | — | ✓ | ✓ | ✓ | — | | `GetBucketLocation` | — | — | ✓ | ✓ | ✓ | — | | `GetObjectTagging` | ✓ | — | ✓ | ✓ | — | ✓ | | `PutObjectTagging` | — | — | ✓ | — | ✓ | ✓ | | `DeleteObjectTagging` | — | — | ✓ | — | — | ✓ | Note that the `CopyObject` and `UploadPartCopy` actions require roles that have both Download and Upload [permissions](https://docs.nebius.com/iam/authorization/roles.md#object-storage). > For example, to be able to copy an object, the user needs to have one of the following roles or combinations of roles: > > * `storage.viewer` + `storage.uploader` > * `storage.object-viewer` + `storage.uploader` > * `storage.editor` > * `storage.object-editor` # Bucket policies in Object Storage Source: https://docs.nebius.com/object-storage/buckets/bucket-policy.md A *bucket policy* enables you to configure fine-grained access to objects within a bucket. In particular, you can allow access to objects with certain [prefixes or keys](https://docs.nebius.com/object-storage/overview.md#keys-prefixes-and-object-hierarchy) for a certain [IAM group](https://docs.nebius.com/iam/authorization/groups/index.md). In a policy, you specify what permissions the group obtains and what objects it can access. ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to configure a bucket policy Before you begin, make sure that you have a bucket. If you do not have one, [create a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets). > [tab] CLI > > To configure a list of rules in a bucket policy, run the following command: > > ```bash > nebius storage bucket update \ > --id \ > --bucket-policy-rules "[{\"paths\": [\"\"], \"roles\": [\"\"], \"group_id\": \"\"}]" > ``` > > > [!WARNING] > > > > In the command, specify all the rules that the bucket should have. If you add a new rule to a list of existing rules, specify the existing rules as well. Otherwise, they will be deleted. > > The `--bucket-policy-rules` parameter contains a list of rules for a bucket policy. Every rule has the following parameters: > > * `paths`: Paths to objects that the rule applies to. Each path is either a full object key or a prefix ending with a single `*` wildcard character. If you use `*`, the rule provides access to all objects. A path may also contain one or more `?` placeholders. Each `?` character matches a single character at that position in the string. > > Examples of supported paths: > > * `prefix_1/key_1`: Rule applies to the object with the set prefix and key. > * `prefix_1/*`: Rule applies to any object with the `prefix_1` prefix. > * `allowed?/*`: Rule applies to objects with prefixes like `allowed1/`, `allowed2/` or `allowedA/`. A single `?` matches exactly one character, so neither `allowed/` nor `allowed10/` matches. > * `key_1`: Rule applies to the object with the `key_1` key. > * `*`: Rule applies to all objects in a bucket. > > You can use the `*` symbol only at the end of the path and only once in a path. For example, you can specify `prefix_1/*`, but you cannot use `prefix*1` or `pre*fix*`. > > * `roles`: [Object Storage roles](https://docs.nebius.com/iam/authorization/roles.md#object-storage) granted to the specified IAM group to access objects in a bucket. You can grant read-only roles or editor roles. > > * `group_id`: ID of the IAM group to which the rule applies. > > To get the group ID, go to the  [Administration → IAM](https://console.nebius.com/iam/groups) page in the web console. The list of groups and their IDs is displayed on the **Groups** tab. > [tab] Terraform > > To configure a list of rules in a bucket policy, use the `bucket_policy` parameter in a bucket configuration: > > ```hcl > resource nebius_storage_v1_bucket "" { > bucket_policy = { > rules = [ > { > paths = [] > roles = [] > group_id = "" > } > ] > } > ... > } > ``` > > The `rules` parameter contains a list of rules for the bucket policy. Every rule has the following parameters: > > * `paths`: Paths to objects that the rule applies to. Each path is either a full object key or a prefix ending with a single `*` wildcard character. If you use `*`, the rule provides access to all objects. A path may also contain one or more `?` placeholders. Each `?` character matches a single character at that position in the string. > > Examples of supported paths: > > * `prefix_1/key_1`: Rule applies to the object with the set prefix and key. > * `prefix_1/*`: Rule applies to any object with the `prefix_1` prefix. > * `allowed?/*`: Rule applies to objects with prefixes like `allowed1/`, `allowed2/` or `allowedA/`. A single `?` matches exactly one character, so neither `allowed/` nor `allowed10/` matches. > * `key_1`: Rule applies to the object with the `key_1` key. > * `*`: Rule applies to all objects in a bucket. > > You can use the `*` symbol only at the end of the path and only once in a path. For example, you can specify `prefix_1/*`, but you cannot use `prefix*1` or `pre*fix*`. > > * `roles`: [Object Storage roles](https://docs.nebius.com/iam/authorization/roles.md#object-storage) granted to the specified IAM group to access objects in a bucket. You can grant read-only roles or editor roles. > > * `group_id`: ID of the IAM group to which the rule applies. > > To get the group ID, go to the  [Administration → IAM](https://console.nebius.com/iam/groups) page in the web console. The list of groups and their IDs is displayed on the **Groups** tab. > [tab] Go SDK > > Configure a list of rules in a bucket policy: > > ```go > policySvc := sdk.Services().Storage().V1().Bucket() > policyBucket, err := policySvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > policyBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{""}, > Roles: []string{""}, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "", > }, > }, > }, > } > policyOp, err := policySvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: policyBucket.Metadata, > Spec: policyBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = policyOp.Wait(ctx); err != nil { > return err > } > ``` > > > [!WARNING] > > > > In the code, specify all the rules that the bucket should have. If you add a new rule to a list of existing rules, specify the existing rules as well. Otherwise, they will be deleted. > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `Paths`: Paths to objects that the rule applies to. Each path is an object key, a prefix ending with `*`, or a pattern with `?` placeholders. `*` matches all objects and can appear only once, at the end of a path. > * `Roles`: [Object Storage roles](https://docs.nebius.com/iam/authorization/roles.md#object-storage) granted for those objects. > * `GroupId`: ID of the IAM group that receives the roles. > [tab] Python SDK > > Configure a list of rules in a bucket policy: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id=""), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=[""], > roles=[""], > group_id="", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > > [!WARNING] > > > > In the code, specify all the rules that the bucket should have. If you add a new rule to a list of existing rules, specify the existing rules as well. Otherwise, they will be deleted. > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `paths`: Paths to objects that the rule applies to. Each path is an object key, a prefix ending with `*`, or a pattern with `?` placeholders. `*` matches all objects and can appear only once, at the end of a path. > * `roles`: [Object Storage roles](https://docs.nebius.com/iam/authorization/roles.md#object-storage) granted for those objects. > * `group_id`: ID of the IAM group that receives the roles. > [tab] JavaScript SDK > > Configure a list of rules in a bucket policy: > > ```ts > const policyService = new BucketService(sdk); > const policyBucket = await policyService.get( > GetBucketRequest.create({ id: "" }), > ).result; > policyBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: [""], > roles: [""], > subject: { > $case: "groupId", > groupId: "", > }, > }), > ], > }); > const policyOperation = await policyService.update( > UpdateBucketRequest.create({ > metadata: policyBucket.metadata, > spec: policyBucket.spec, > }), > ).result; > await policyOperation.wait(); > ``` > > > [!WARNING] > > > > In the code, specify all the rules that the bucket should have. If you add a new rule to a list of existing rules, specify the existing rules as well. Otherwise, they will be deleted. > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `paths`: Paths to objects that the rule applies to. Each path is an object key, a prefix ending with `*`, or a pattern with `?` placeholders. `*` matches all objects and can appear only once, at the end of a path. > * `roles`: [Object Storage roles](https://docs.nebius.com/iam/authorization/roles.md#object-storage) granted for those objects. > * `groupId`: ID of the IAM group that receives the roles. Rules within a single policy don't conflict with each other. All of them apply with an equal priority. For more information about how to configure a bucket policy, see [Examples](https://docs.nebius.com/object-storage/buckets/bucket-policy.md#examples). ### Anonymous access Anonymous access allows you to access a bucket without authentication. For instance, you can use a `curl` command without any authentication data. To configure anonymous access: * Don't set a group ID. Grant access without an IAM group instead. The examples below show the parameter for each interface. * Only use the `storage.viewer`, `storage.object-viewer` and `storage.object-lister` roles in the rule, as anonymous access only works for read-only permissions. For more information, see the examples below. ### Examples > [tab] CLI > > * Allow access to all objects in a bucket: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"*\"], \"roles\": [\"storage.viewer\"], \"group_id\": \"group-e00***\"}]" > ``` > > The `storage.viewer` role enables one to view buckets, and to list and download objects. > > * Allow full read access (including multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"allowed1/*\", \"allowed2/*\"], \"roles\": [\"storage.viewer\"], \"group_id\": \"group-e00***\"}]" > ``` > > * Allow partial read access (without multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"allowed1/*\", \"allowed2/*\"], \"roles\": [\"storage.object-lister\", \"storage.object-viewer\"], \"group_id\": \"group-e00***\"}]" > ``` > > * Allow access to objects with prefixes like `allowed1/`, `allowed2/`, `allowedA/`, and so on, by using a placeholder: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"allowed?/*\"], \"roles\": [\"storage.object-lister\", \"storage.object-viewer\"], \"group_id\": \"group-e00***\"}]" > ``` > > * Allow access to the object with the `allowed_key` key: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"allowed_key\"], \"roles\": [\"storage.viewer\"], \"group_id\": \"group-e00***\"}]" > ``` > > * Allow anonymous access to all objects in a bucket: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"*\"], \"roles\": [\"storage.viewer\"], \"anonymous\": {} }]" > ``` > > * Apply two rules simultaneously: > > * Assign the `storage.viewer` role to the `prefix_1/key_1` object. > * Assign the `storage.editor` role to objects with the `prefix_2` prefix. > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules "[{\"paths\": [\"prefix_1/key_1\"], \"roles\": [\"storage.viewer\"], \"group_id\": \"group-e00***\"}, > {\"paths\": [\"prefix_2/*\"], \"roles\": [\"storage.editor\"], \"group_id\": \"group-e00***\"}]" > ``` > [tab] Terraform > > * Allow access to all objects in a bucket: > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["*"] > roles = ["storage.viewer"] > group_id = "group-e00***" > } > ] > } > ... > } > ``` > > * Allow full read access (including multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["allowed1/*", "allowed2/*"] > roles = ["storage.viewer"] > group_id = "group-e00***" > } > ] > } > ... > } > ``` > > * Allow partial read access (without multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["allowed1/*", "allowed2/*"] > roles = ["storage.object-lister", "storage.object-viewer"] > group_id = "group-e00***" > } > ] > } > ... > } > ``` > > * Allow access to objects with prefixes like `allowed1/`, `allowed2/`, `allowedA/`, and so on, by using a placeholder. A single `?` matches exactly one character, so neither `allowed/` nor `allowed10/` matches this rule: > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["allowed?/*"] > roles = ["storage.viewer"] > group_id = "group-e00***" > } > ] > } > ... > } > ``` > > * Allow access to the object with the `allowed_key` key: > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["allowed_key"] > roles = ["storage.viewer"] > group_id = "group-e00***" > } > ] > } > ... > } > ``` > > * Allow anonymous access to all objects in a bucket: > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["*"] > roles = ["storage.viewer"] > anonymous = {} > } > ] > } > ... > } > ``` > > * Apply two rules simultaneously: > > * Assign the `storage.viewer` role to the `prefix_1/key_1` object. > * Assign the `storage.editor` role to objects with the `prefix_2` prefix. > > ```hcl > resource nebius_storage_v1_bucket "bucket1" { > bucket_policy = { > rules = [ > { > paths = ["prefix_1/key_1"] > roles = ["storage.viewer"] > group_id = "group-e00***" > }, > { > paths = ["prefix_2/*"] > roles = ["storage.editor"] > group_id = "group-e00***" > } > ] > } > ... > } > ``` > [tab] Go SDK > > * Allow access to all objects in a bucket: > > ```go > allSvc := sdk.Services().Storage().V1().Bucket() > allBucket, err := allSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > allBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"*"}, > Roles: []string{"storage.viewer"}, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > }, > } > allOp, err := allSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: allBucket.Metadata, > Spec: allBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = allOp.Wait(ctx); err != nil { > return err > } > ``` > > The `storage.viewer` role enables one to view buckets, and to list and download objects. > > * Allow full read access (including multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```go > prefixSvc := sdk.Services().Storage().V1().Bucket() > prefixBucket, err := prefixSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > prefixBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"allowed1/*", "allowed2/*"}, > Roles: []string{"storage.viewer"}, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > }, > } > prefixOp, err := prefixSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: prefixBucket.Metadata, > Spec: prefixBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = prefixOp.Wait(ctx); err != nil { > return err > } > ``` > > * Allow partial read access (without multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```go > listSvc := sdk.Services().Storage().V1().Bucket() > listBucket, err := listSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > listBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"allowed1/*", "allowed2/*"}, > Roles: []string{ > "storage.object-lister", > "storage.object-viewer", > }, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > }, > } > listOp, err := listSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: listBucket.Metadata, > Spec: listBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = listOp.Wait(ctx); err != nil { > return err > } > ``` > > * Allow access to objects with prefixes like `allowed1/`, `allowed2/`, `allowedA/`, and so on, by using a placeholder: > > ```go > placeholderSvc := sdk.Services().Storage().V1().Bucket() > placeholderBucket, err := placeholderSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > placeholderBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"allowed?/*"}, > Roles: []string{ > "storage.object-lister", > "storage.object-viewer", > }, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > }, > } > placeholderOp, err := placeholderSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: placeholderBucket.Metadata, > Spec: placeholderBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = placeholderOp.Wait(ctx); err != nil { > return err > } > ``` > > * Allow access to the object with the `allowed_key` key: > > ```go > keySvc := sdk.Services().Storage().V1().Bucket() > keyBucket, err := keySvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > keyBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"allowed_key"}, > Roles: []string{"storage.viewer"}, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > }, > } > keyOp, err := keySvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: keyBucket.Metadata, > Spec: keyBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = keyOp.Wait(ctx); err != nil { > return err > } > ``` > > * Allow anonymous access to all objects in a bucket: > > ```go > anonymousSvc := sdk.Services().Storage().V1().Bucket() > anonymousBucket, err := anonymousSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > anonymousBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"*"}, > Roles: []string{"storage.viewer"}, > Subject: &storage.BucketPolicy_Rule_Anonymous{ > Anonymous: &storage.BucketPolicy_Rule_AnonymousAccess{ > }, > }, > }, > }, > } > anonymousOp, err := anonymousSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: anonymousBucket.Metadata, > Spec: anonymousBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = anonymousOp.Wait(ctx); err != nil { > return err > } > ``` > > * Apply two rules simultaneously: > > * Assign the `storage.viewer` role to the `prefix_1/key_1` object. > * Assign the `storage.editor` role to objects with the `prefix_2` prefix. > > ```go > twoRulesSvc := sdk.Services().Storage().V1().Bucket() > twoRulesBucket, err := twoRulesSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > twoRulesBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{ > { > Paths: []string{"prefix_1/key_1"}, > Roles: []string{"storage.viewer"}, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > { > Paths: []string{"prefix_2/*"}, > Roles: []string{"storage.editor"}, > Subject: &storage.BucketPolicy_Rule_GroupId{ > GroupId: "group-e00***", > }, > }, > }, > } > twoRulesOp, err := twoRulesSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: twoRulesBucket.Metadata, > Spec: twoRulesBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = twoRulesOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > * Allow access to all objects in a bucket: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["*"], > roles=["storage.viewer"], > group_id="group-e00***", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > The `storage.viewer` role enables one to view buckets, and to list and download objects. > > * Allow full read access (including multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["allowed1/*", "allowed2/*"], > roles=["storage.viewer"], > group_id="group-e00***", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > * Allow partial read access (without multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["allowed1/*", "allowed2/*"], > roles=[ > "storage.object-lister", > "storage.object-viewer", > ], > group_id="group-e00***", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > * Allow access to objects with prefixes like `allowed1/`, `allowed2/`, `allowedA/`, and so on, by using a placeholder: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["allowed?/*"], > roles=[ > "storage.object-lister", > "storage.object-viewer", > ], > group_id="group-e00***", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > * Allow access to the object with the `allowed_key` key: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["allowed_key"], > roles=["storage.viewer"], > group_id="group-e00***", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > * Allow anonymous access to all objects in a bucket: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["*"], > roles=["storage.viewer"], > anonymous=BucketPolicy__Rule__AnonymousAccess(), > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > * Apply two rules simultaneously: > > * Assign the `storage.viewer` role to the `prefix_1/key_1` object. > * Assign the `storage.editor` role to objects with the `prefix_2` prefix. > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy( > rules=[ > BucketPolicy__Rule( > paths=["prefix_1/key_1"], > roles=["storage.viewer"], > group_id="group-e00***", > ), > BucketPolicy__Rule( > paths=["prefix_2/*"], > roles=["storage.editor"], > group_id="group-e00***", > ), > ], > ) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > [tab] JavaScript SDK > > * Allow access to all objects in a bucket: > > ```ts > const allService = new BucketService(sdk); > const allBucket = await allService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > allBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["*"], > roles: ["storage.viewer"], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > ], > }); > const allOperation = await allService.update( > UpdateBucketRequest.create({ > metadata: allBucket.metadata, > spec: allBucket.spec, > }), > ).result; > await allOperation.wait(); > ``` > > The `storage.viewer` role enables one to view buckets, and to list and download objects. > > * Allow full read access (including multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```ts > const prefixService = new BucketService(sdk); > const prefixBucket = await prefixService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > prefixBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["allowed1/*", "allowed2/*"], > roles: ["storage.viewer"], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > ], > }); > const prefixOperation = await prefixService.update( > UpdateBucketRequest.create({ > metadata: prefixBucket.metadata, > spec: prefixBucket.spec, > }), > ).result; > await prefixOperation.wait(); > ``` > > * Allow partial read access (without multipart uploads) to objects with the `allowed1` and `allowed2` prefixes: > > ```ts > const listService = new BucketService(sdk); > const listBucket = await listService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > listBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["allowed1/*", "allowed2/*"], > roles: [ > "storage.object-lister", > "storage.object-viewer", > ], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > ], > }); > const listOperation = await listService.update( > UpdateBucketRequest.create({ > metadata: listBucket.metadata, > spec: listBucket.spec, > }), > ).result; > await listOperation.wait(); > ``` > > * Allow access to objects with prefixes like `allowed1/`, `allowed2/`, `allowedA/`, and so on, by using a placeholder: > > ```ts > const placeholderService = new BucketService(sdk); > const placeholderBucket = await placeholderService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > placeholderBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["allowed?/*"], > roles: [ > "storage.object-lister", > "storage.object-viewer", > ], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > ], > }); > const placeholderOperation = await placeholderService.update( > UpdateBucketRequest.create({ > metadata: placeholderBucket.metadata, > spec: placeholderBucket.spec, > }), > ).result; > await placeholderOperation.wait(); > ``` > > * Allow access to the object with the `allowed_key` key: > > ```ts > const keyService = new BucketService(sdk); > const keyBucket = await keyService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > keyBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["allowed_key"], > roles: ["storage.viewer"], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > ], > }); > const keyOperation = await keyService.update( > UpdateBucketRequest.create({ > metadata: keyBucket.metadata, > spec: keyBucket.spec, > }), > ).result; > await keyOperation.wait(); > ``` > > * Allow anonymous access to all objects in a bucket: > > ```ts > const anonymousService = new BucketService(sdk); > const anonymousBucket = await anonymousService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > anonymousBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["*"], > roles: ["storage.viewer"], > subject: { > $case: "anonymous", > anonymous: BucketPolicy_Rule_AnonymousAccess.create({}), > }, > }), > ], > }); > const anonymousOperation = await anonymousService.update( > UpdateBucketRequest.create({ > metadata: anonymousBucket.metadata, > spec: anonymousBucket.spec, > }), > ).result; > await anonymousOperation.wait(); > ``` > > * Apply two rules simultaneously: > > * Assign the `storage.viewer` role to the `prefix_1/key_1` object. > * Assign the `storage.editor` role to objects with the `prefix_2` prefix. > > ```ts > const twoRulesService = new BucketService(sdk); > const twoRulesBucket = await twoRulesService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > twoRulesBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [ > BucketPolicy_Rule.create({ > paths: ["prefix_1/key_1"], > roles: ["storage.viewer"], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > BucketPolicy_Rule.create({ > paths: ["prefix_2/*"], > roles: ["storage.editor"], > subject: { > $case: "groupId", > groupId: "group-e00***", > }, > }), > ], > }); > const twoRulesOperation = await twoRulesService.update( > UpdateBucketRequest.create({ > metadata: twoRulesBucket.metadata, > spec: twoRulesBucket.spec, > }), > ).result; > await twoRulesOperation.wait(); > ``` ## How to delete all bucket policy rules If you specify an empty list of rules for a bucket policy, no policy applies. > [tab] CLI > > To delete all rules, run the following command: > > ```bash > nebius storage bucket update \ > --id storagebucket-e00*** \ > --bucket-policy-rules '[]' > ``` > [tab] Terraform > > To delete all rules, delete the `bucket_policy` parameter from the Terraform configuration. > [tab] Go SDK > > Delete all rules: > > ```go > clearSvc := sdk.Services().Storage().V1().Bucket() > clearBucket, err := clearSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "storagebucket-e00***", > }, > ) > if err != nil { > return err > } > clearBucket.Spec.BucketPolicy = &storage.BucketPolicy{ > Rules: []*storage.BucketPolicy_Rule{}, > } > clearOp, err := clearSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: clearBucket.Metadata, > Spec: clearBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = clearOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Id` to the bucket ID and `Rules` to an empty list. > [tab] Python SDK > > Delete all rules: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id="storagebucket-e00***"), > ) > bucket.spec.bucket_policy = BucketPolicy(rules=[]) > operation = await bucket_service.update( > UpdateBucketRequest( > metadata=bucket.metadata, > spec=bucket.spec, > ), > ) > await operation.wait() > ``` > > In the code, set `id` to the bucket ID and `rules` to an empty list. > [tab] JavaScript SDK > > Delete all rules: > > ```ts > const clearService = new BucketService(sdk); > const clearBucket = await clearService.get( > GetBucketRequest.create({ id: "storagebucket-e00***" }), > ).result; > clearBucket.spec.bucketPolicy = BucketPolicy.create({ > rules: [], > }); > const clearOperation = await clearService.update( > UpdateBucketRequest.create({ > metadata: clearBucket.metadata, > spec: clearBucket.spec, > }), > ).result; > await clearOperation.wait(); > ``` > > In the code, set `id` to the bucket ID and `rules` to an empty list. ## Limitations * The IAM group and the bucket must be in the same tenant. * The maximum number of rules per bucket is 10. * The maximum number of paths per rule is 10. * The maximum path length is 1024 symbols (the same as the maximum length of an object key). ## Access permits and bucket policies If you have assigned a bucket policy or an [access permit](https://docs.nebius.com/iam/authorization/groups.md#custom-groups) to a bucket, both of them grant access to the bucket and its objects. For example: > * If a bucket policy grants the `storage.object-lister` role and an access permit grants the `storage.object-viewer` role to the same IAM group, both of the roles apply to the group. As a result, members of this group can both list objects and view them. > > * If a bucket policy grants the `storage.viewer` role and an access permit grants the `storage.editor` role to the same IAM group, members of this group have editor rights as a result although they still have rights of the `storage.viewer` role. # Storage classes in Object Storage Source: https://docs.nebius.com/object-storage/storage-classes.md Object Storage provides *storage classes* that control the cost and speed of storing and processing objects in storage, depending on desired access patterns. You can set the default storage class for each bucket and explicitly upload an object to a specific class. The following storage classes are available: * **Enhanced Throughput** (`ENHANCED_THROUGHPUT` for CLIs and tools) for storage that requires high bandwidth and low latency access. * **Intelligent** (`INTELLIGENT`) for automatic cost savings on rarely accessed data. * **Standard** (`STANDARD`) for general storage needs. Default option for new buckets. > [!TIP] > > You can set up [lifecycle rules](https://docs.nebius.com/object-storage/objects/lifecycles.md#transition-lifecycle-rules) to transition objects between classes. ## Enhanced Throughput storage class The Enhanced Throughput storage class differs from the Intelligent and Standard classes in the following ways: * Unthrottled upload and download speed for Enhanced Throughput. In contrast, the upload and download speed for objects of the Intelligent and Standard classes is limited to 20 GBps per tenant in each [region](https://docs.nebius.com/overview/regions.md). The same limit applies when a transition lifecycle rule moves objects to or from the other classes. This means that during lifecycle transitions, the upload/download speed via the S3 API may be reduced. * 2x latency improvement (on larger objects) and up to 10x throughput improvement per GiB of stored data compared to the Intelligent and Standard classes (when the bucket and the client are in the same Nebius AI Cloud region). * You pay a higher price for storage size, but all operations and data egress are free. See the detailed cost breakdown in [Pricing in Object Storage](https://docs.nebius.com/object-storage/resources/pricing.md). You may find the Enhanced Throughput storage class useful in the following scenarios: * Stream processed datasets or model weights to GPU. * Write or read checkpoints. * Provide a destination for an extract, transform and load process (ETL) that requires high throughput. ## Intelligent storage class The Intelligent storage class automatically optimizes storage costs for large datasets that haven't been accessed for a long time. Use this class when you can't predict which data you will access frequently and which rarely. This class includes two *tiers*: Warm and Cold. All data is stored under the Warm tier by default. If you don't access some objects within 30 days, Object Storage automatically switches their tier to Cold. In practice, this often happens up to 48 hours earlier. When the tier changes, the service doesn't transfer objects anywhere else. They remain in the same location, and their storage performance also stays the same. The only difference between the tiers is the [price](https://docs.nebius.com/object-storage/resources/pricing.md#storing-data) — the Cold tier costs less. Object Storage considers an object of the Intelligent class to be accessed when you: * Invoke the `CopyObject`, `UploadPartCopy` or `GetObject` [S3 methods](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html). Other methods don't affect the tier. For example, `HeadObject`, `GetObjectTagging` and `PutObjectTagging`. * Download an object. * Copy object data. * Upload a new object version. Once you access an object, the number of days for the switch is reset. For objects in the Cold tier, the tier switches to Warm once you access the object. To determine what tier an object currently has, use the `HeadObject` method in the AWS API. > [!WARNING] > > The Warm tier always applies to objects less than 180 KiB and to incomplete multipart uploads. They are not eligible for automatic tiering. # How to configure a storage class in Object Storage Source: https://docs.nebius.com/object-storage/configure-storage-classes.md A storage class is one of a bucket's characteristics. You set it when you [create a bucket](https://docs.nebius.com/object-storage/configure-storage-classes.md#for-a-new-bucket), [edit it](https://docs.nebius.com/object-storage/configure-storage-classes.md#for-an-existing-bucket), or [upload an object](https://docs.nebius.com/object-storage/configure-storage-classes.md#how-to-upload-an-object-to-a-storage-class) to this bucket. Object Storage supports three classes: Enhanced Throughput, Intelligent, and Standard. They differ in price and performance. For more information, see [Storage classes in Object Storage](https://docs.nebius.com/object-storage/storage-classes.md). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to set a default storage class for a bucket Each bucket has a default storage class. All new objects are uploaded into this class unless you [explicitly define the class](https://docs.nebius.com/object-storage/configure-storage-classes.md#how-to-upload-an-object-to-a-storage-class). By default, new buckets use the Standard storage class. You can change the default storage class both when you create a bucket and for an existing bucket. The new default storage class does not affect objects that are already in storage in the bucket. > [!NOTE] > > You can use the **Force storage class** (`--force-storage-class`) [bucket parameter](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters) to make the default storage class override the storage class that you explicitly select for any individual object uploaded to the bucket. ### For a new bucket > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Object Storage**. > 2. Click **Create resource** → **Bucket**. > 3. Select the storage class in the bucket creation form. > 4. Configure the other settings and create the bucket. > [tab] Nebius AI Cloud CLI > > When you [create a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets-nebius-ai-cloud-cli), add the `--default-storage-class` parameter to set the default storage class: > > ```bash > nebius storage bucket create \ > --default-storage-class \ > ... > ``` > [tab] Go SDK > > Create a bucket with a default storage class: > > ```go > createService := sdk.Services().Storage().V1().Bucket() > createOperation, err := createService.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &storage.BucketSpec{ > DefaultStorageClass: storage. > StorageClass_STANDARD, > }, > }, > ) > if err != nil { > return err > } > if _, err = createOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Bucket name. > * `DefaultStorageClass`: Default storage class. The example sets `StorageClass_STANDARD`. > [tab] Python SDK > > Create a bucket with a default storage class: > > ```python > create_service = BucketServiceClient(sdk) > create_operation = await create_service.create( > CreateBucketRequest( > metadata=ResourceMetadata(name=""), > spec=BucketSpec( > default_storage_class=StorageClass.STANDARD, > ), > ), > ) > await create_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.name`: Bucket name. > * `default_storage_class`: Default storage class. The example sets `StorageClass.STANDARD`. > [tab] JavaScript SDK > > Create a bucket with a default storage class: > > ```ts > const createService = new BucketService(sdk); > const createOperation = await createService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: BucketSpec.create({ > defaultStorageClass: StorageClass.STANDARD, > }), > }), > ).result; > await createOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.name`: Bucket name. > * `defaultStorageClass`: Default storage class. The example sets `StorageClass.STANDARD`. ### For an existing bucket > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Object Storage**. > 2. Select the bucket you need and switch to the **Settings** tab. > 3. Select the storage class and save the changes. > [tab] Nebius AI Cloud CLI > > When you [modify a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-modify-buckets-nebius-ai-cloud-cli), set the `--default-storage-class` parameter: > > ```bash > nebius storage bucket update \ > --default-storage-class \ > ... > ``` > [tab] Go SDK > > Update the default storage class of an existing bucket: > > ```go > updateService := sdk.Services().Storage().V1().Bucket() > updateBucket, err := updateService.GetByName( > ctx, > &storage.GetBucketByNameRequest{Name: ""}, > ) > if err != nil { > return err > } > updateBucket.Spec.DefaultStorageClass = storage. > StorageClass_STANDARD > updateOperation, err := updateService.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: updateBucket.Metadata, > Spec: updateBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updateOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Name`: Bucket name. > * `DefaultStorageClass`: Default storage class. The example sets `StorageClass_STANDARD`. > [tab] Python SDK > > Update the default storage class of an existing bucket: > > ```python > update_service = BucketServiceClient(sdk) > update_bucket = await update_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > update_bucket.spec.default_storage_class = ( > StorageClass.STANDARD > ) > update_operation = await update_service.update( > UpdateBucketRequest( > metadata=update_bucket.metadata, > spec=update_bucket.spec, > ), > ) > await update_operation.wait() > ``` > > In the code, set the following parameters: > > * `name`: Bucket name. > * `default_storage_class`: Default storage class. The example sets `StorageClass.STANDARD`. > [tab] JavaScript SDK > > Update the default storage class of an existing bucket: > > ```ts > const updateService = new BucketService(sdk); > const updateBucket = await updateService.getByName( > GetBucketByNameRequest.create({ name: "" }), > ).result; > updateBucket.spec.defaultStorageClass = > StorageClass.STANDARD; > const updateOperation = await updateService.update( > UpdateBucketRequest.create({ > metadata: updateBucket.metadata, > spec: updateBucket.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > In the code, set the following parameters: > > * `name`: Bucket name. > * `defaultStorageClass`: Default storage class. The example sets `StorageClass.STANDARD`. ## How to upload an object to a storage class If you need to store an object in a different storage class than the default one for the bucket, set the storage class during upload. > [!WARNING] > > The [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md) does not support uploading objects to a storage class that differs from the bucket's default. To do that, use [s5cmd](https://github.com/peak/s5cmd). To [upload an object](https://docs.nebius.com/object-storage/objects/upload-download.md#uploading-a-single-file) to the desired storage class, set the `--storage-class` parameter in the upload command: ```bash s5cmd s5cmd cp \ --storage-class \ ... s3:/// ``` To change the storage class of an object after you upload it, make a `copy-object` request that moves the object between storage classes: ```bash s5cmd s5cmd cp \ --storage-class \ ... s3:/// s3:/// ``` # Lifecycle rules for objects in Object Storage Source: https://docs.nebius.com/object-storage/objects/lifecycles.md Object Storage supports two types of lifecycle rules: expiration lifecycle rules and transition lifecycle rules. ## Expiration lifecycle rules When *expiration lifecycle rules* apply, Object Storage deletes objects and their versions in a bucket once they expire. For example, you can configure a rule that deletes objects a week after their upload to a bucket. Besides deleting objects, you can also use expiration rules to delete non-current versions of objects and to abort multipart uploads that remain stale for a long time. Expiration rules are the most effective method for these purposes. Use expiration rules when you want to clean up objects and versions that you do not need anymore. This can help you save bucket space, pay less for storage and stay within [quotas](https://docs.nebius.com/object-storage/resources/quotas-limits.md). If you need to operate with certain objects, you can filter them. For instance, you can only delete objects that have a certain prefix in their name, have certain tags, or that do or do not exceed the specified size limit. ### Automatic deletion of incomplete uploads For buckets created on or after November 9, 2026, Object Storage automatically deletes incomplete multipart uploads after 30 days. To change this behavior, [create an expiration lifecycle rule](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules) to abort incomplete multipart uploads according to your preferred pattern. Creating such a rule disables the default automatic deletion, even if you set the rule status to disabled. ## Transition lifecycle rules When *transition lifecycle rules* apply, Object Storage changes the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) of objects. For example, you can automatically downgrade from Enhanced Throughput to the Standard or Intelligent class when you no longer need higher bandwidth and lower latency. As a result, you pay less. One of the following conditions can trigger the storage class switch: * A specified date has arrived. * A specified number of days has passed since the *object upload*. * A specified number of days has passed since the *last access* to the object. ### Last-access lifecycle rules A *last-access lifecycle rule* is a transition lifecycle rule that triggers the switch of the storage class if a certain number of days has passed since the last access to the object. Object Storage considers an object to be accessed if data was retrieved or copied from this object by using [S3 methods](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html), such as `GetObject`, `HeadObject`, `GetObjectTagging`, `CopyObject` and `UploadPartCopy`. Object Storage considers these methods only if they were executed successfully. If there was an error, such as a permission denied or a connection broken, Object Storage doesn't detect the object access. For last-access lifecycle rules, you can filter the S3 methods and user agents to detect the timestamp of the object's last access. For example, you can configure a filter that allows Object Storage to detect the last access only if the `CopyObject` method was executed by using the `rclone` user agent. Filters apply to all last-access lifecycle rules. You configure them at the bucket level. By default, no filters apply. All S3 methods (GetObject, HeadObject, GetObjectTagging, CopyObject and UploadPartCopy.) and user agents are included. ## How Object Storage triggers a lifecycle rule After you [configure a lifecycle rule](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md), Object Storage checks every night (approximately after midnight UTC) whether a condition for expiration or transition is met. If it is, Object Storage triggers a rule. ### Limitations in triggering a last-access lifecycle rule Last-access lifecycle rules have several limitations related to triggering a rule: * The calculation precision of the last object access is 12 hours. Because of this, the transition to a different storage class may occur not the day the condition is met but the day after that. * The service may opt not to consider a too-recent access of an object that was made several hours or minutes ago. For instance, if the object data was retrieved less than an hour ago, but the previous object access was a long time ago, a lifecycle rule can still apply. * The service calculates the number of days since the moment you enable a lifecycle rule with the `days_since_last_access` [parameter](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-transition-lifecycle-rules). Imagine that an object has not been accessed within six months, and you create and enable a rule today with `days_since_last_access = 7`. In this case, the rule will apply after seven days; the rule will not consider the previous six months. * Rarely, Object Storage can switch a storage class even if an object was accessed. ## Changes in charging when lifecycle rules apply The service changes the [billing charges](https://docs.nebius.com/object-storage/resources/pricing.md) in the following way: * When an expiration rule is triggered, charging for the used space stops only after objects are deleted. The occupied space on a bucket is recalculated with each object deleted. * When a transition rule is triggered, the service starts charging for a new storage class only after the transition is finished. The charging is recalculated with each object that has the storage class switched. # How to configure lifecycle rules in Object Storage Source: https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md You can configure the following [lifecycle rules](https://docs.nebius.com/object-storage/objects/lifecycles.md): * [Expiration lifecycle rules](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules) if you want to delete unnecessary objects and versions. * [Transition lifecycle rules](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-transition-lifecycle-rules) if you want to change a [storage class](https://docs.nebius.com/object-storage/storage-classes.md) of objects. We recommend using Nebius AI Cloud interfaces: the [web console](https://console.nebius.com), the [Nebius AI Cloud CLI](https://docs.nebius.com/cli/index.md), the [provider for Terraform](https://docs.nebius.com/terraform-provider/index.md), or an SDK. The AWS CLI is supported but with limited availability of features. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] Nebius AI Cloud CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] AWS CLI > > [Install and configure the AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md). > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to configure expiration lifecycle rules > [!WARNING] > > When you configure expiration rules, make sure that only the required objects and versions fall under these rules. Otherwise, you can unintentionally delete objects that must be preserved. > [tab] Web console > > In the web console, you can only add lifecycle rules to existing buckets. You cannot create a bucket with a lifecycle rule. > > To add an expiration lifecycle rule to a bucket: > > 1. In the web console, go to  **Storage** → **Object Storage**. > > 2. Open the page of the required bucket. > > 3. Go to the **Lifecycle rules** tab. > > 4. Click  **Add rule**. > > 5. (Optional) On the page that opens, specify the rule name. It helps identify the rule in a list of lifecycle rules. > > 6. Specify which objects the rule applies to: > > * **Object key prefix**: The rule applies to objects whose names begin with a specified prefix. For instance, if you set the `expiring/` prefix, the rule applies to the `expiring/test.txt` object and doesn't apply to the `test.txt` object. > > * **Minimum size, bytes**: The rule applies to objects larger than the specified size. > > * **Maximum size, bytes**: The rule applies to objects smaller than the specified size. > > If you set both a minimum and maximum size, make sure that the maximum size is greater than or equal to the minimum one. > > * **Tags**: The rule applies to objects with the specified tags. > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > 7. Set the actions that the lifecycle rule should perform: > > * **Expiration**: Delete objects and versions several days after the object upload or on a certain date. For example, you can delete objects five days after their upload. > * **Non-current version expiration**: If you [enabled versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) in your bucket, you can delete all versions except for the current one. To make them expire several days after the object upload, specify the required number of days. > * **Abort of incomplete multipart upload**: Remove multipart uploads that fail and remain stale. If they take longer than the specified number of days, Object Storage aborts multipart uploads and deletes all the data uploaded. > > 8. Click **Add rule**. > [tab] Nebius AI Cloud CLI > > When you update the settings of a bucket, make sure to list all lifecycle rules, even the ones that you do not change. If you do not include some rules, Object Storage will delete them. > > When you reconfigure a rule, specify only the parameters that you want to change. For example, if you earlier set a filter of objects in a rule and you want to change an expiration condition, specify only the condition, and the rule name or ID. You do not need to set the filter again as it will be preserved. > > To create an expiration lifecycle rule: > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. If you update the settings of an existing bucket, get a list of its lifecycle rules: > ```bash > nebius storage bucket get-by-name --name > ``` > The rules are specified in the `spec.lifecycle_configuration.rules` parameter. If you want to preserve them when adding a new rule, duplicate those rules in the `update` command. > 3. To configure a new lifecycle rule, run one of the following commands: > > * Create a bucket with a lifecycle rule: > > ```bash > nebius storage bucket create --name \ > --lifecycle-configuration-rules '[ > { > "id": "", > "status": "enabled", > > }, > { > > }, > ... > ]' > ``` > > * Add a rule to an existing bucket: > > ```bash > nebius storage bucket update --id \ > --lifecycle-configuration-rules '[ > { > "id": "", > "status": "enabled", > > }, > { > > }, > ... > ]' > ``` > > In the `--id` parameter, specify the bucket ID. To get it, run `nebius storage bucket get-by-name --name `. > > Every rule contains the following parameters: > > * `id`: Rule ID (string). Helps identify the rule in the list of lifecycle rules. > * `status`: Whether the rule is enabled or disabled. Use the `disabled` status to turn the rule off but preserve it in the list. > > To set the rule conditions, use the examples below and insert them into the command instead of ``. You can combine and adapt these examples to your needs. > > * To delete objects five days after their upload, specify: > > ```json > "expiration": { > "days": 5 > } > ``` > > * To delete objects whose names begin with a certain prefix, specify: > > ```json > "filter": { > "prefix": "expiring/" > }, > "expiration": { > "days": 5 > } > ``` > > For instance, if you set the `expiring/` prefix, the `expiring/test.txt` object will be deleted five days after the upload, and the `test.txt` object will not. > > * To delete objects that exceed 5120 bytes: > > ```json > "filter": { > "object_size_greater_than_bytes": 5120 > }, > "expiration": { > "days": 5 > } > ``` > > The service applies the rule five days after the object upload. > > * To delete objects that are less than 128 bytes: > > ```json > "filter": { > "object_size_less_than_bytes": 128 > }, > "expiration": { > "days": 5 > } > ``` > > * To delete objects with certain tags, specify: > > ```json > "filter": { > "tags": [ > {"key": "key1", "value": "value1"}, > {"key": "key2", "value": "value2"} > ] > }, > "expiration": { > "days": 5 > } > ``` > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > * If you [enabled versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) in your bucket, you can delete outdated versions. These are often all the versions except for the current one. To make them expire five days after they are no longer current: > > ```json > "noncurrent_version_expiration": { > "noncurrent_days": 5 > } > ``` > > * To delete all versions except for the last three: > > ```json > "noncurrent_version_expiration": { > "noncurrent_days": 5, > "newer_noncurrent_versions": 3 > } > ``` > > The versions will expire five days after they are no longer current. > > * If you ran multipart uploads for large objects and they failed and remained stale, abort these uploads and delete all the data uploaded. For example, to delete stale multipart uploads seven days after you initiated them (that is, after executing the `CreateMultipartUpload` method): > > ```json > "abort_incomplete_multipart_upload": { > "days_after_initiation": 7 > } > ``` > [tab] Terraform > > To create an expiration lifecycle rule: > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > 2. Create a bucket with expiration lifecycle rules by using the following configuration file: > > ```hcl > resource "nebius_storage_v1_bucket" "" { > name = "" > parent_id = "" > default_storage_class = "" > versioning_policy = "ENABLED" > lifecycle_configuration = { > rules = [ > { > id = "" > status = "ENABLED" > > } > ] > } > } > ``` > > The file contains the following parameters: > > * `name`: Bucket name. > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > * `default_storage_class`: Default storage class. It applies to objects if a storage class isn't set for them explicitly during the upload. > * `versioning_policy`: Enables versioning of objects in the bucket. For more information, see [Object versioning in a bucket](https://docs.nebius.com/object-storage/buckets/versioning.md). > * `lifecycle_configuration.rules`: List of lifecycle rules. Every rule contains the following parameters: > > * `id`: Rule ID (string). Helps identify the rule in the list of lifecycle rules. > * `status`: Whether the rule is enabled or disabled. Use the `DISABLED` status to turn the rule off but preserve it in the list. > > To set the rule conditions, use the examples below and insert them into the configuration file instead of ``. You can combine and adapt these examples to your needs. > > * To delete objects five days after their upload, specify: > > ```hcl > expiration = { > days = 5 > } > ``` > > * To delete objects whose names begin with a certain prefix, specify: > > ```hcl > expiration = { > days = 5 > } > filter = { > prefix = "expiring/" > } > ``` > > For instance, if you set the `expiring/` prefix, the `expiring/test.txt` object will be deleted five days after the upload, and the `test.txt` object will not. > > * To delete objects that exceed 5120 bytes: > > ```hcl > expiration = { > days = 5 > } > filter = { > object_size_greater_than_bytes = 5120 > } > ``` > > The service applies the rule five days after the object upload. > > * To delete objects that are less than 128 bytes: > > ```hcl > expiration = { > days = 5 > } > filter = { > object_size_less_than_bytes = 128 > } > ``` > > * To delete objects with certain tags, specify: > > ```hcl > expiration = { > days = 5 > } > filter = { > tags = [{"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"}] > } > ``` > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > * If you enabled versioning in your bucket, you can delete outdated versions. These are often all the versions except for the current one. To make them expire five days after they are no longer current: > > ```hcl > noncurrent_version_expiration = { > noncurrent_days = 5 > } > ``` > > * To delete all the versions except for the last three: > > ```hcl > noncurrent_version_expiration = { > noncurrent_days = 5 > newer_noncurrent_versions = 3 > } > ``` > > The versions will expire five days after they are no longer current. > > * If you ran multipart uploads for large objects and they failed and remained stale, abort these uploads and delete all the data uploaded. For example, to delete stale multipart uploads seven days after you initiated them (that is, after executing the `CreateMultipartUpload` method): > > ```hcl > abort_incomplete_multipart_upload = { > days_after_initiation = 7 > } > ``` > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] AWS CLI > > When you update the lifecycle configuration of a bucket, make sure to list all lifecycle rules and their configuration details, even the ones that you don't change. If you don't include some of them, the service will remove and replace them with the last lifecycle configuration. > > To create an expiration lifecycle rule: > > 1. [Install](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions) and [configure](https://docs.nebius.com/object-storage/interfaces/aws-cli.md#configuring-aws-cli) the AWS CLI. > > 2. If you update the lifecycle configuration of an existing bucket, get its current lifecycle configuration: > > ```bash > aws s3api get-bucket-lifecycle-configuration --bucket > ``` > > The rules are specified in the `Rules` parameter. If you want to preserve them when adding a new rule, duplicate those rules in the new JSON file that you apply to the bucket. > > 3. To configure a new lifecycle rule, create the `lifecycle.json` file with lifecycle rules: > > ```json > { > "Rules": [ > { > "ID": "", > "Status": "Enabled", > "Filter": { > }, > > }, > { > > }, > ... > ] > } > ``` > > 4. Apply the lifecycle configuration to the bucket: > > ```bash > aws s3api put-bucket-lifecycle-configuration \ > --bucket \ > --lifecycle-configuration file://lifecycle.json > ``` > > Every rule contains the following parameters: > > * `ID`: Rule ID (string). Helps identify the rule in the list of lifecycle rules. > * `Status`: Whether the rule is enabled or disabled. Use the `Disabled` status to turn the rule off but preserve it in the list. > > To set the rule conditions, use the examples below and insert them into the JSON file instead of ``. You can combine and adapt these examples to your needs. > > * To delete objects five days after their upload, specify: > > ```json > "Expiration": { > "Days": 5 > } > ``` > > * To delete objects whose names begin with a certain prefix, specify: > > ```json > "Filter": { > "Prefix": "expiring/" > }, > "Expiration": { > "Days": 5 > } > ``` > > For instance, if you set the `expiring/` prefix, the `expiring/test.txt` object will be deleted five days after the upload, and the `test.txt` object will not. > > * To delete objects that exceed 5120 bytes: > > ```json > "Filter": { > "ObjectSizeGreaterThan": 5120 > }, > "Expiration": { > "Days": 5 > } > ``` > > The service applies the rule five days after the object upload. > > * To delete objects that are less than 128 bytes: > > ```json > "Filter": { > "ObjectSizeLessThan": 128 > }, > "Expiration": { > "Days": 5 > } > ``` > > * To delete objects with a certain tag, specify: > > ```json > "Filter": { > "Tag": { "Key": "key1", "Value": "value1"} > }, > "Expiration": { > "Days": 5 > } > ``` > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > If you want to set several tags, specify: > > ```json > "Filter": { > "And": { > "Tags": [{"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"}] > } > }, > "Expiration": { > "Days": 5 > } > ``` > > * If you enabled versioning in your bucket, you can delete outdated versions. These are often all the versions except for the current one. To make them expire five days after they are no longer current: > > ```json > "Filter": { > }, > "NoncurrentVersionExpiration": { > "NoncurrentDays": 5 > } > ``` > > * To delete all versions except for the last three: > > ```json > "Filter": { > }, > "NoncurrentVersionExpiration": { > "NoncurrentDays": 5, > "NewerNoncurrentVersions": 3 > } > ``` > > The versions will expire five days after they are no longer current. > > * If you ran multipart uploads for large objects and they failed and remained stale, abort these uploads and delete all the data uploaded. For example, to delete stale multipart uploads seven days after you initiated them: > > ```json > "Filter": { > }, > "AbortIncompleteMultipartUpload": { > "DaysAfterInitiation": 7 > } > ``` > [tab] Go SDK > > To create an expiration lifecycle rule: > > 1. If you update an existing bucket, get its current lifecycle rules: > > ```go > listRuleSvc := sdk.Services().Storage().V1().Bucket() > listRuleBucket, err := listRuleSvc.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(listRuleBucket) > ``` > > In the code, set `Name` to the bucket name. The response includes the rules in `Spec.LifecycleConfiguration`. > > 2. Configure the rule in one of the following ways: > > * Create a bucket with a lifecycle rule: > > ```go > createRuleConfig := &storage.LifecycleConfiguration{} > createRuleJSON := []byte(`{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "expiration": {"days": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }`) > if err := protojson.Unmarshal( > createRuleJSON, > createRuleConfig, > ); err != nil { > return err > } > createRuleSvc := sdk.Services().Storage().V1().Bucket() > createRuleOp, err := createRuleSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: &storage.BucketSpec{ > LifecycleConfiguration: createRuleConfig, > }, > }, > ) > if err != nil { > return err > } > if _, err = createRuleOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `id`: Rule ID. > * `expiration.days`: Number of days after upload before the objects expire. > * `abortIncompleteMultipartUpload.daysAfterInitiation`: Number of days after a multipart upload starts before Object Storage aborts it. > * `Metadata.Name`: Bucket name. > > The example sets `status` to `ENABLED`. > > * Add a rule to an existing bucket: > > ```go > updateRuleConfig := &storage.LifecycleConfiguration{} > updateRuleJSON := []byte(`{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "expiration": {"days": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }`) > if err := protojson.Unmarshal( > updateRuleJSON, > updateRuleConfig, > ); err != nil { > return err > } > updateRuleSvc := sdk.Services().Storage().V1().Bucket() > updateRuleBucket, err := updateRuleSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > updateRuleBucket.Spec.LifecycleConfiguration = updateRuleConfig > updateRuleOp, err := updateRuleSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: updateRuleBucket.Metadata, > Spec: updateRuleBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updateRuleOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `id`, `expiration.days`, and `abortIncompleteMultipartUpload.daysAfterInitiation` as in the create example, and set `Id` to the bucket ID. > > List every lifecycle rule in the JSON, including rules that you do not change. Otherwise, Object Storage deletes the omitted rules. > [tab] Python SDK > > To create an expiration lifecycle rule: > > 1. If you update an existing bucket, get its current lifecycle rules: > > ```python > list_rule_service = BucketServiceClient(sdk) > list_rule_bucket = await list_rule_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(list_rule_bucket) > ``` > > In the code, set `name` to the bucket name. The response includes the rules in `spec.lifecycle_configuration`. > > 2. Configure the rule in one of the following ways: > > * Create a bucket with a lifecycle rule: > > ```python > create_rule_config = LifecycleConfiguration.from_json( > """{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "expiration": {"days": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }""", > ) > create_rule_service = BucketServiceClient(sdk) > create_rule_operation = await create_rule_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > spec=BucketSpec( > lifecycle_configuration=create_rule_config, > ), > ), > ) > await create_rule_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Rule ID. > * `expiration.days`: Number of days after upload before the objects expire. > * `abortIncompleteMultipartUpload.daysAfterInitiation`: Number of days after a multipart upload starts before Object Storage aborts it. > * `metadata.name`: Bucket name. > > The example sets `status` to `ENABLED`. > > * Add a rule to an existing bucket: > > ```python > update_rule_config = LifecycleConfiguration.from_json( > """{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "expiration": {"days": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }""", > ) > update_rule_service = BucketServiceClient(sdk) > update_rule_bucket = await update_rule_service.get( > GetBucketRequest(id=""), > ) > update_rule_bucket.spec.lifecycle_configuration = update_rule_config > update_rule_operation = await update_rule_service.update( > UpdateBucketRequest( > metadata=update_rule_bucket.metadata, > spec=update_rule_bucket.spec, > ), > ) > await update_rule_operation.wait() > ``` > > In the code, set `id`, `expiration.days`, and `abortIncompleteMultipartUpload.daysAfterInitiation` in the rule JSON as in the create example. Set `id` in `GetBucketRequest` to the bucket ID. > > List every lifecycle rule in the JSON, including rules that you do not change. Otherwise, Object Storage deletes the omitted rules. > [tab] JavaScript SDK > > To create an expiration lifecycle rule: > > 1. If you update an existing bucket, get its current lifecycle rules: > > ```ts > const listRuleService = new BucketService(sdk); > const listRuleBucket = await listRuleService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(listRuleBucket); > ``` > > In the code, set `name` to the bucket name. The response includes the rules in `spec.lifecycleConfiguration`. > > 2. Configure the rule in one of the following ways: > > * Create a bucket with a lifecycle rule: > > ```ts > const createRuleConfig = LifecycleConfiguration.fromJSON( > JSON.parse(`{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "expiration": {"days": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }`), > ); > const createRuleService = new BucketService(sdk); > const createRuleOperation = await createRuleService.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: BucketSpec.create({ > lifecycleConfiguration: createRuleConfig, > }), > }), > ).result; > await createRuleOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Rule ID. > * `expiration.days`: Number of days after upload before the objects expire. > * `abortIncompleteMultipartUpload.daysAfterInitiation`: Number of days after a multipart upload starts before Object Storage aborts it. > * `metadata.name`: Bucket name. > > The example sets `status` to `ENABLED`. > > * Add a rule to an existing bucket: > > ```ts > const updateRuleConfig = LifecycleConfiguration.fromJSON( > JSON.parse(`{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "expiration": {"days": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }`), > ); > const updateRuleService = new BucketService(sdk); > const updateRuleBucket = await updateRuleService.get( > GetBucketRequest.create({ id: "" }), > ).result; > updateRuleBucket.spec.lifecycleConfiguration = updateRuleConfig; > const updateRuleOperation = await updateRuleService.update( > UpdateBucketRequest.create({ > metadata: updateRuleBucket.metadata, > spec: updateRuleBucket.spec, > }), > ).result; > await updateRuleOperation.wait(); > ``` > > In the code, set `id`, `expiration.days`, and `abortIncompleteMultipartUpload.daysAfterInitiation` in the rule JSON as in the create example. Set `id` in `GetBucketRequest` to the bucket ID. > > List every lifecycle rule in the JSON, including rules that you do not change. Otherwise, Object Storage deletes the omitted rules. ## How to configure transition lifecycle rules > [!NOTE] > > Before you configure a transition rule, check your [quotas](https://docs.nebius.com/object-storage/resources/quotas-limits.md) in the project. Make sure that they are sufficient for switching a storage class. > [tab] Web console > > In the web console, you can only add lifecycle rules to existing buckets. You cannot create a bucket with a lifecycle rule. > > To add a transition lifecycle rule to a bucket: > > 1. In the web console, go to  **Storage** → **Object Storage**. > > 2. Open the page of the required bucket. > > 3. Go to the **Lifecycle rules** tab. > > 4. Click  **Add rule**. > > 5. (Optional) On the page that opens, specify the rule name. It helps identify the rule in a list of lifecycle rules. > > 6. Specify which objects the rule applies to: > > * **Object key prefix**: The rule applies to objects whose names begin with a specified prefix. For instance, if you set the `expiring/` prefix, the rule applies to the `expiring/test.txt` object and doesn't apply to the `test.txt` object. > > * **Minimum size, bytes**: The rule applies to objects larger than the specified size. > > * **Maximum size, bytes**: The rule applies to objects smaller than the specified size. > > If you set both a minimum and maximum size, make sure that the maximum size is greater than or equal to the minimum one. > > * **Tags**: The rule applies to objects with the specified tags. > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > 7. To create a transition lifecycle rule, enable the **Modify storage class** action. > > 8. Select the rule type: > > * **Upload**: Set the number of days after the object upload. When this period expires, the storage class of the object changes. > > * **Last access**: Set the number of days after the [last access](https://docs.nebius.com/object-storage/objects/lifecycles.md#last-access-lifecycle-rules) to the object. When this period expires, the storage class changes. > > > [!TIP] > > > > You can set [filters](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#optional-filters-for-last-access-lifecycle-rules-web-console) to define what actions are considered the last access to the object. These filters apply to all last-access lifecycle rules. > > * **Date**: Set a specific date when you need to switch the storage class. > > 9. Select a new storage class that the lifecycle rule applies to. > > 10. Click **Add rule**. > [tab] Nebius AI Cloud CLI > > When you update the settings of a bucket, make sure to list all lifecycle rules, even the ones that you do not change. If you do not include some rules, Object Storage will delete them. > > When you reconfigure a rule, specify only the parameters that you want to change. For example, if you earlier set a filter of objects in a rule and you want to change an expiration condition, specify only the condition, and the rule name or ID. You do not need to set the filter again as it will be preserved. > > To create a transition lifecycle rule: > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. If you update the settings of an existing bucket, get a list of its lifecycle rules: > ```bash > nebius storage bucket get-by-name --name > ``` > The rules are specified in the `spec.lifecycle_configuration.rules` parameter. If you want to preserve them when adding a new rule, duplicate those rules in the `update` command. > 3. To configure a new transition lifecycle rule, run one of the following commands: > > * Create a bucket with a lifecycle rule: > > ```bash > nebius storage bucket create --name \ > --default-storage-class \ > --lifecycle-configuration-rules '[ > { > "id": "", > "status": "enabled", > "transition": { > "storage_class": "", > "days": > }, > "filter": { } > }, > { > > }, > ... > ]' > ``` > > * Add a rule to an existing bucket: > > ```bash > nebius storage bucket update --id \ > --lifecycle-configuration-rules '[ > { > "id": "", > "status": "enabled", > "transition": { > "storage_class": "", > "days": > }, > "filter": { } > }, > { > > }, > ... > ]' > ``` > > The commands contain the following parameters: > > * `--name`: Bucket name. > * `--id`: Bucket ID. To get it, run `nebius storage bucket get-by-name --name `. > * `--default-storage-class`: Default storage class. It applies to objects if a storage class isn't explicitly set for them during the upload. > * `--lifecycle-configuration-rules`: List of lifecycle rules. Every rule contains the following parameters: > > * `id`: Rule ID (string). Helps identify the rule in the list of lifecycle rules. > > * `status`: Whether the rule is enabled or disabled. Use the `disabled` status to turn the rule off but preserve it in the list. > > * `transition`: Conditions for a transition lifecycle rule. To change a storage class, set the `storage_class` parameter. Use either the `days` or `days_since_last_access` parameter: > > * `storage_class`: New storage class. > * `days`: The rule applies the specified number of days after the object upload. > * `days_since_last_access`: The rule applies the specified number of days after the object hasn't been accessed. > > The service considers an object to be accessed if its data was retrieved or copied by using [S3 methods](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html), such as `GetObject`, `HeadObject`, `GetObjectTagging`, `CopyObject`, or `UploadPartCopy`. You can configure the rule to refer only to some of these methods by using [last access filters](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#optional-filters-for-last-access-lifecycle-rules-nebius-ai-cloud-cli). > > * `filter` (optional): Filters of objects. By using them, you can apply a rule to certain objects only. You can combine the filters if needed. The available filters are the following: > > * To transition objects whose names begin with a certain prefix, specify: > > ```json > "filter": { > "prefix": "expiring/" > } > ``` > > For instance, if you set the `expiring/` prefix, the storage class of the `expiring/test.txt` object will be switched. However, this will not happen to the `test.txt` object. > > * To transition objects that exceed 5120 bytes: > > ```json > "filter": { > "object_size_greater_than_bytes": 5120 > } > ``` > > * To transition objects that are less than 128 bytes: > > ```json > "filter": { > "object_size_less_than_bytes": 128 > } > ``` > > * To transition objects with certain tags, specify: > > ```json > "filter": { > "tags": [ > {"key": "key1", "value": "value1"}, > {"key": "key2", "value": "value2"} > ] > } > ``` > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > [tab] Terraform > > To create a transition lifecycle rule: > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > 2. Create a bucket with transition lifecycle rules by using the following configuration file: > > ```hcl > resource "nebius_storage_v1_bucket" "" { > name = "" > parent_id = "" > default_storage_class = "" > versioning_policy = "ENABLED" > lifecycle_configuration = { > rules = [ > { > id = "" > status = "ENABLED" > transition = { > storage_class = "" > days = > days_since_last_access = > } > filter = { } > } > ] > } > } > ``` > > The file contains the following parameters: > > * `name`: Bucket name. > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > * `default_storage_class`: Default storage class. It applies to objects if a storage class isn't explicitly set for them during the upload. > * `versioning_policy`: Enables versioning of objects in the bucket. For more information, see [Object versioning in a bucket](https://docs.nebius.com/object-storage/buckets/versioning.md). > * `lifecycle_configuration.rules`: List of lifecycle rules. Every rule contains the following parameters: > > * `id`: Rule ID (string). Helps identify the rule in the list of lifecycle rules. > > * `status`: Whether the rule is enabled or disabled. Use the `DISABLED` status to turn the rule off but preserve it in the list. > > * `transition`: Conditions for a transition lifecycle rule. To change a storage class, set the `storage_class` parameter. Use either the `days` or `days_since_last_access` parameter: > > * `storage_class`: New storage class. > * `days`: The rule applies the specified number of days after the object upload. > * `days_since_last_access`: The rule applies the specified number of days after the object hasn't been accessed. > > The service considers an object to be accessed if its data was retrieved or copied by using [S3 methods](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html), such as `GetObject`, `HeadObject`, `GetObjectTagging`, `CopyObject`, or `UploadPartCopy`. You can configure the rule to refer only to some of these methods by using [last access filters](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#optional-filters-for-last-access-lifecycle-rules-terraform). > > * `filter` (optional): Filters of objects. By using them, you can apply a rule to certain objects only. You can combine the filters if needed. The available filters are the following: > > * To transition objects whose names begin with a certain prefix, specify: > > ```hcl > filter = { > prefix = "expiring/" > } > ``` > > For instance, if you set the `expiring/` prefix, the storage class of the `expiring/test.txt` object will be switched. However, this will not happen to the `test.txt` object. > > * To transition objects that exceed 5120 bytes: > > ```hcl > filter = { > object_size_greater_than_bytes = 5120 > } > ``` > > * To transition objects that are less than 128 bytes: > > ```hcl > filter = { > object_size_less_than_bytes = 128 > } > ``` > > * To transition objects with certain tags, specify: > > ```hcl > filter = { > tags = [{"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"}] > } > ``` > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] AWS CLI > > When you update the lifecycle configuration of a bucket, make sure to list all lifecycle rules and their configuration details, even the ones that you don't change. If you don't include some of them, the service will remove and replace them with the last lifecycle configuration. > > The AWS CLI only supports transition lifecycle rules that set a number of days after the object upload. If you want to set the last access time of the object or the date of the storage class switch, use the Nebius AI Cloud interfaces. > > Although the AWS CLI allows multiple transition actions in a single rule, Object Storage only supports one transition action per rule. If you need multiple transition actions, create multiple rules. > > To create a transition lifecycle rule: > > 1. [Install](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions) and [configure](https://docs.nebius.com/object-storage/interfaces/aws-cli.md#configuring-aws-cli) the AWS CLI. > > 2. If you update the lifecycle configuration of an existing bucket, get its current lifecycle configuration: > > ```bash > aws s3api get-bucket-lifecycle-configuration --bucket > ``` > > The rules are specified in the `Rules` parameter. If you want to preserve them when adding a new rule, duplicate those rules in the new JSON file that you apply to the bucket. > > 3. To configure a new transition lifecycle rule, create the `lifecycle.json` file with lifecycle rules: > > ```json > { > "Rules": [ > { > "ID": "", > "Status": "Enabled", > "Filter": {}, > "Transitions": [ > { > "StorageClass": "", > "Days": > } > ] > }, > { > > }, > ... > ] > } > ``` > > If the `Filter` element is left empty, the rule applies to all objects in the bucket. > > 4. Apply the lifecycle configuration to the bucket: > > ```bash > aws s3api put-bucket-lifecycle-configuration \ > --bucket \ > --lifecycle-configuration file://lifecycle.json > ``` > > Every rule contains the following parameters: > > * `ID`: Rule ID (string). Helps identify the rule in the list of lifecycle rules. > > * `Status`: Whether the rule is enabled or disabled. Use the `Disabled` status to turn the rule off but preserve it in the list. > > * `Transitions`: Conditions for a transition lifecycle rule. To change a storage class, set the `StorageClass` parameter. To define when the rule applies after the object upload, set the `Days` parameter. > > * `StorageClass`: New storage class. > * `Days`: The rule applies the specified number of days after the object upload. > > * `Filter` (optional): Filters of objects. By using them, you can apply a rule to certain objects only. A `Filter` can contain exactly one of `Prefix`, `ObjectSizeGreaterThan`, `ObjectSizeLessThan`, or `And`. To combine multiple conditions, use `And`. > > * To transition objects whose names begin with a certain prefix, specify: > > ```json > "Filter": { > "Prefix": "expiring/" > } > ``` > > For instance, if you set the `expiring/` prefix, the storage class of the `expiring/test.txt` object will be switched. However, this will not happen to the `test.txt` object. > > * To transition objects that exceed 5120 bytes, specify: > > ```json > "Filter": { > "ObjectSizeGreaterThan": 5120 > } > ``` > > * To transition objects that are less than 128 bytes, specify: > > ```json > "Filter": { > "ObjectSizeLessThan": 128 > } > ``` > > * To transition objects with a certain tag, specify: > > ```json > "Filter": { > "Tag": { "Key": "key1", "Value": "value1"} > } > ``` > > A *tag* represents a key-value pair that you add to existing objects or when you upload objects. For more information, see [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html). > > If you want to set several tags, specify: > > ```json > "Filter": { > "And": { > "Tags": [{"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"}] > } > } > ``` > [tab] Go SDK > > To create a transition lifecycle rule: > > 1. If you update an existing bucket, get its current lifecycle rules: > > ```go > listRuleSvc := sdk.Services().Storage().V1().Bucket() > listRuleBucket, err := listRuleSvc.GetByName( > ctx, > &storage.GetBucketByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(listRuleBucket) > ``` > > In the code, set `Name` to the bucket name. The response includes the rules in `Spec.LifecycleConfiguration`. > > 2. Configure the rule in one of the following ways: > > * Create a bucket with a transition lifecycle rule: > > ```go > transitionSpec := &storage.BucketSpec{} > transitionJSON := []byte(`{ > "defaultStorageClass": "", > "lifecycleConfiguration": { > "rules": [ > { > "id": "", > "status": "ENABLED", > "transition": { > "storageClass": "", > "days": > }, > "filter": { "objectSizeLessThanBytes": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > } > }`) > if err := protojson.Unmarshal( > transitionJSON, > transitionSpec, > ); err != nil { > return err > } > createTransitionSvc := sdk.Services().Storage().V1().Bucket() > createTransitionOp, err := createTransitionSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: transitionSpec, > }, > ) > if err != nil { > return err > } > if _, err = createTransitionOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `defaultStorageClass`: Default storage class for objects uploaded without an explicit storage class. > * `id`: Rule ID. > * `transition.storageClass`: Storage class to switch objects to. > * `transition.days`: Number of days after upload before the storage class changes. > * `filter.objectSizeLessThanBytes`: Maximum object size, in bytes. The rule applies to smaller objects. > * `abortIncompleteMultipartUpload.daysAfterInitiation`: Number of days after a multipart upload starts before Object Storage aborts it. > * `Metadata.Name`: Bucket name. > > The example sets `status` to `ENABLED`. > > * Add a rule to an existing bucket: > > ```go > addTransitionConfig := &storage.LifecycleConfiguration{} > addTransitionJSON := []byte(`{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "transition": { > "storageClass": "", > "days": > }, > "filter": { "objectSizeLessThanBytes": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }`) > if err := protojson.Unmarshal( > addTransitionJSON, > addTransitionConfig, > ); err != nil { > return err > } > addTransitionSvc := sdk.Services().Storage().V1().Bucket() > addTransitionBucket, err := addTransitionSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > addTransitionBucket.Spec.LifecycleConfiguration = > addTransitionConfig > addTransitionOp, err := addTransitionSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: addTransitionBucket.Metadata, > Spec: addTransitionBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = addTransitionOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `id`, `transition.storageClass`, `transition.days`, `filter.objectSizeLessThanBytes`, and `abortIncompleteMultipartUpload.daysAfterInitiation` as in the create example, and set `Id` to the bucket ID. > > List every lifecycle rule in the JSON, including rules that you do not change. Otherwise, Object Storage deletes the omitted rules. > [tab] Python SDK > > To create a transition lifecycle rule: > > 1. If you update an existing bucket, get its current lifecycle rules: > > ```python > list_rule_service = BucketServiceClient(sdk) > list_rule_bucket = await list_rule_service.get_by_name( > GetBucketByNameRequest(name=""), > ) > print(list_rule_bucket) > ``` > > In the code, set `name` to the bucket name. The response includes the rules in `spec.lifecycle_configuration`. > > 2. Configure the rule in one of the following ways: > > * Create a bucket with a transition lifecycle rule: > > ```python > transition_spec = BucketSpec.from_json( > """{ > "defaultStorageClass": "", > "lifecycleConfiguration": { > "rules": [ > { > "id": "", > "status": "ENABLED", > "transition": { > "storageClass": "", > "days": > }, > "filter": { "objectSizeLessThanBytes": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > } > }""", > ) > create_transition_service = BucketServiceClient(sdk) > create_transition_operation = await create_transition_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > spec=transition_spec, > ), > ) > await create_transition_operation.wait() > ``` > > In the code, set the following parameters: > > * `defaultStorageClass`: Default storage class for objects uploaded without an explicit storage class. > * `id`: Rule ID. > * `transition.storageClass`: Storage class to switch objects to. > * `transition.days`: Number of days after upload before the storage class changes. > * `filter.objectSizeLessThanBytes`: Maximum object size, in bytes. The rule applies to smaller objects. > * `abortIncompleteMultipartUpload.daysAfterInitiation`: Number of days after a multipart upload starts before Object Storage aborts it. > * `metadata.name`: Bucket name. > > The example sets `status` to `ENABLED`. > > * Add a rule to an existing bucket: > > ```python > add_transition_config = LifecycleConfiguration.from_json( > """{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "transition": { > "storageClass": "", > "days": > }, > "filter": { "objectSizeLessThanBytes": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }""", > ) > add_transition_service = BucketServiceClient(sdk) > add_transition_bucket = await add_transition_service.get( > GetBucketRequest(id=""), > ) > add_transition_bucket.spec.lifecycle_configuration = ( > add_transition_config > ) > add_transition_operation = await add_transition_service.update( > UpdateBucketRequest( > metadata=add_transition_bucket.metadata, > spec=add_transition_bucket.spec, > ), > ) > await add_transition_operation.wait() > ``` > > In the code, set `id`, `transition.storageClass`, `transition.days`, `filter.objectSizeLessThanBytes`, and `abortIncompleteMultipartUpload.daysAfterInitiation` in the rule JSON as in the create example. Set `id` in `GetBucketRequest` to the bucket ID. > > List every lifecycle rule in the JSON, including rules that you do not change. Otherwise, Object Storage deletes the omitted rules. > [tab] JavaScript SDK > > To create a transition lifecycle rule: > > 1. If you update an existing bucket, get its current lifecycle rules: > > ```ts > const listRuleService = new BucketService(sdk); > const listRuleBucket = await listRuleService.getByName( > GetBucketByNameRequest.create({ > name: "", > }), > ).result; > console.log(listRuleBucket); > ``` > > In the code, set `name` to the bucket name. The response includes the rules in `spec.lifecycleConfiguration`. > > 2. Configure the rule in one of the following ways: > > * Create a bucket with a transition lifecycle rule: > > ```ts > const transitionSpec = BucketSpec.fromJSON( > JSON.parse(`{ > "defaultStorageClass": "", > "lifecycleConfiguration": { > "rules": [ > { > "id": "", > "status": "ENABLED", > "transition": { > "storageClass": "", > "days": > }, > "filter": { "objectSizeLessThanBytes": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > } > }`), > ); > const createTransitionSvc = new BucketService(sdk); > const createTransitionOp = await createTransitionSvc.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: transitionSpec, > }), > ).result; > await createTransitionOp.wait(); > ``` > > In the code, set the following parameters: > > * `defaultStorageClass`: Default storage class for objects uploaded without an explicit storage class. > * `id`: Rule ID. > * `transition.storageClass`: Storage class to switch objects to. > * `transition.days`: Number of days after upload before the storage class changes. > * `filter.objectSizeLessThanBytes`: Maximum object size, in bytes. The rule applies to smaller objects. > * `abortIncompleteMultipartUpload.daysAfterInitiation`: Number of days after a multipart upload starts before Object Storage aborts it. > * `metadata.name`: Bucket name. > > The example sets `status` to `ENABLED`. > > * Add a rule to an existing bucket: > > ```ts > const addTransitionConfig = LifecycleConfiguration.fromJSON( > JSON.parse(`{ > "rules": [ > { > "id": "", > "status": "ENABLED", > "transition": { > "storageClass": "", > "days": > }, > "filter": { "objectSizeLessThanBytes": } > }, > { > "id": "", > "status": "ENABLED", > "abortIncompleteMultipartUpload": { > "daysAfterInitiation": > } > }, > ... > ] > }`), > ); > const addTransitionSvc = new BucketService(sdk); > const addTransitionBucket = await addTransitionSvc.get( > GetBucketRequest.create({ id: "" }), > ).result; > addTransitionBucket.spec.lifecycleConfiguration = > addTransitionConfig; > const addTransitionOp = await addTransitionSvc.update( > UpdateBucketRequest.create({ > metadata: addTransitionBucket.metadata, > spec: addTransitionBucket.spec, > }), > ).result; > await addTransitionOp.wait(); > ``` > > In the code, set `id`, `transition.storageClass`, `transition.days`, `filter.objectSizeLessThanBytes`, and `abortIncompleteMultipartUpload.daysAfterInitiation` in the rule JSON as in the create example. Set `id` in `GetBucketRequest` to the bucket ID. > > List every lifecycle rule in the JSON, including rules that you do not change. Otherwise, Object Storage deletes the omitted rules. ### (Optional) Filters for last-access lifecycle rules You can filter actions that Object Storage considers or ignores when it determines the timestamp of the object's last access. In the filters, specify S3 methods and user agents (such as `rclone`) that should be included or excluded. Filters apply to all last-access lifecycle rules. You configure them at the bucket level. By default, no filters apply. All S3 methods (GetObject, HeadObject, GetObjectTagging, CopyObject and UploadPartCopy.) and user agents are included. > [tab] Web console > > 1. In the web console, go to  **Storage** → **Object Storage**. > > 2. Open the page of the required bucket. > > 3. Go to the **Settings** tab. > > 4. In the **Filters for last-access lifecycle rules** section, click  **Add filter**. > > 5. In the **Filter type** field, select one of the following: > > * `Include`: Consider only the methods and user agents listed in the filter. > * `Exclude`: Ignore the methods and user agents listed. > > 6. Specify the S3 methods and user agents for the filter. Among the S3 methods, you can set `GetObject`, `HeadObject`, `GetObjectTagging`, `CopyObject`, and `UploadPartCopy`. > > If you don't specify methods or user agents, Object Storage considers all of them. > > 7. Click **Add filter**. > > The new filter appears in the list of filters for last-access lifecycle rules. > > 8. Click **Save changes** to confirm. > [tab] Nebius AI Cloud CLI > > When you create or update a bucket, set the filters by using the `--lifecycle-configuration-last-access-filter-conditions` parameter. > > * Create a bucket with a lifecycle rule: > > ```bash > nebius storage bucket create --name \ > --default-storage-class \ > --lifecycle-configuration-rules '[...]' \ > --lifecycle-configuration-last-access-filter-conditions '[ > { > "type": "", > "methods": [""], > "user_agents": [""] > }, > { > > }, > ... > ]' > ``` > > * Add a rule to an existing bucket: > > ```bash > nebius storage bucket update --id \ > --lifecycle-configuration-rules '[...]' \ > --lifecycle-configuration-last-access-filter-conditions '[ > { > "type": "", > "methods": [""], > "user_agents": [""] > }, > { > > }, > ... > ]' > ``` > > Apply the filtering parameter only if you use the [transition.days\_since\_last\_access](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-transition-lifecycle-rules) parameter. > > For example, the service can consider an object to be accessed only if the `GetObject` and `CopyObject` methods were executed by using the `rclone` user agent. Alternatively, the service can ignore the `GetObject` and `UploadPartCopy` methods. > > Every filter contains the following fields: > > * `type`: Whether listed S3 methods and user agents should be considered to determine if the object is accessed. Possible values are the following: > > * `INCLUDE`: Consider only the methods and user agents listed in the filter. > * `EXCLUDE`: Ignore the methods and user agents listed. > > * `methods`: List of S3 methods, such as `"GET_OBJECT"`, `"HEAD_OBJECT"`, `"GET_OBJECT_TAGGING"`, `"COPY_OBJECT"` and `"UPLOAD_PART_COPY"`. > > If you do not specify the `methods` parameter, Object Storage considers all methods. > > * `user_agents`: List of substrings that user agents (clients addressing an object) can contain. For instance, if you specify `rclone`, only the user agents with the `rclone` substring trigger the countdown of days for the rule to apply. > > If you do not specify the `user_agents` parameter, Object Storage considers all user agents. > > Specify at least `methods` or `user_agents`. You can use both of them as well, but you cannot use a filter with the `type` parameter only. > [tab] Terraform > > When you create or update a bucket, set the filters by using the `last_access_filter.conditions` parameter. > > ```hcl > resource "nebius_storage_v1_bucket" "" { > ... > lifecycle_configuration = { > rules = [...] > last_access_filter = [ > { > conditions = [ > { > type = "" > methods = [""] > user_agents = [""] > }, > { > > }, > ... > ] > } > ] > } > } > ``` > > Apply the filtering parameter only if you use the [transition.days\_since\_last\_access](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-transition-lifecycle-rules) parameter. > > For example, the service can consider an object to be accessed only if the `GetObject` and `CopyObject` methods were executed by using the `rclone` user agent. Alternatively, the service can ignore the `GetObject` and `UploadPartCopy` methods. > > Every filter contains the following fields: > > * `type`: Whether listed S3 methods and user agents should be considered to determine if the object is accessed. Possible values are the following: > > * `INCLUDE`: Consider only the methods and user agents listed in the filter. > * `EXCLUDE`: Ignore the methods and user agents listed. > > * `methods`: List of S3 methods, such as `"GET_OBJECT"`, `"HEAD_OBJECT"`, `"GET_OBJECT_TAGGING"`, `"COPY_OBJECT"` and `"UPLOAD_PART_COPY"`. > > If you do not specify the `methods` parameter, Object Storage considers all methods. > > * `user_agents`: List of substrings that user agents (clients addressing an object) can contain. For instance, if you specify `rclone`, only the user agents with the `rclone` substring trigger the countdown of days for the rule to apply. > > If you do not specify the `user_agents` parameter, Object Storage considers all user agents. > > Specify at least `methods` or `user_agents`. You can use both of them as well, but you cannot use a filter with the `type` parameter only. > [tab] Go SDK > > Create a bucket with last-access filters: > > ```go > filterSpec := &storage.BucketSpec{} > filterJSON := []byte(`{ > "defaultStorageClass": "", > "lifecycleConfiguration": { > "rules": [...], > "lastAccessFilter": { > "conditions": [ > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > ... > ] > } > } > }`) > if err := protojson.Unmarshal( > filterJSON, > filterSpec, > ); err != nil { > return err > } > createFilterSvc := sdk.Services().Storage().V1().Bucket() > createFilterOp, err := createFilterSvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: filterSpec, > }, > ) > if err != nil { > return err > } > if _, err = createFilterOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `defaultStorageClass`: Default storage class for objects uploaded without an explicit storage class. > * `type`: `INCLUDE` to count only the listed methods and user agents, or `EXCLUDE` to ignore them. > * `methods`: S3 methods that count as access, such as `GET_OBJECT`. > * `userAgents`: Substrings of user agents that count as access. > * `Metadata.Name`: Bucket name. > > Add filters to an existing bucket: > > ```go > updateFilterConfig := &storage.LifecycleConfiguration{} > updateFilterJSON := []byte(`{ > "rules": [...], > "lastAccessFilter": { > "conditions": [ > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > ... > ] > } > }`) > if err := protojson.Unmarshal( > updateFilterJSON, > updateFilterConfig, > ); err != nil { > return err > } > updateFilterSvc := sdk.Services().Storage().V1().Bucket() > updateFilterBucket, err := updateFilterSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > updateFilterBucket.Spec.LifecycleConfiguration = > updateFilterConfig > updateFilterOp, err := updateFilterSvc.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: updateFilterBucket.Metadata, > Spec: updateFilterBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updateFilterOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the same filter parameters, and set `Id` to the bucket ID. Keep the existing lifecycle rules in `rules`. > [tab] Python SDK > > Create a bucket with last-access filters: > > ```python > filter_spec = BucketSpec.from_json( > """{ > "defaultStorageClass": "", > "lifecycleConfiguration": { > "rules": [...], > "lastAccessFilter": { > "conditions": [ > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > ... > ] > } > } > }""", > ) > create_filter_service = BucketServiceClient(sdk) > create_filter_operation = await create_filter_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="", > ), > spec=filter_spec, > ), > ) > await create_filter_operation.wait() > ``` > > In the code, set the following parameters: > > * `defaultStorageClass`: Default storage class for objects uploaded without an explicit storage class. > * `type`: `INCLUDE` to count only the listed methods and user agents, or `EXCLUDE` to ignore them. > * `methods`: S3 methods that count as access, such as `GET_OBJECT`. > * `userAgents`: Substrings of user agents that count as access. > * `metadata.name`: Bucket name. > > Add filters to an existing bucket: > > ```python > update_filter_config = LifecycleConfiguration.from_json( > """{ > "rules": [...], > "lastAccessFilter": { > "conditions": [ > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > ... > ] > } > }""", > ) > update_filter_service = BucketServiceClient(sdk) > update_filter_bucket = await update_filter_service.get( > GetBucketRequest(id=""), > ) > update_filter_bucket.spec.lifecycle_configuration = ( > update_filter_config > ) > update_filter_operation = await update_filter_service.update( > UpdateBucketRequest( > metadata=update_filter_bucket.metadata, > spec=update_filter_bucket.spec, > ), > ) > await update_filter_operation.wait() > ``` > > In the code, set the same filter parameters. Set `id` in `GetBucketRequest` to the bucket ID. Keep the existing lifecycle rules in `rules`. > [tab] JavaScript SDK > > Create a bucket with last-access filters: > > ```ts > const filterSpec = BucketSpec.fromJSON( > JSON.parse(`{ > "defaultStorageClass": "", > "lifecycleConfiguration": { > "rules": [...], > "lastAccessFilter": { > "conditions": [ > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > ... > ] > } > } > }`), > ); > const createFilterSvc = new BucketService(sdk); > const createFilterOp = await createFilterSvc.create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "", > }), > spec: filterSpec, > }), > ).result; > await createFilterOp.wait(); > ``` > > In the code, set the following parameters: > > * `defaultStorageClass`: Default storage class for objects uploaded without an explicit storage class. > * `type`: `INCLUDE` to count only the listed methods and user agents, or `EXCLUDE` to ignore them. > * `methods`: S3 methods that count as access, such as `GET_OBJECT`. > * `userAgents`: Substrings of user agents that count as access. > * `metadata.name`: Bucket name. > > Add filters to an existing bucket: > > ```ts > const updateFilterConfig = LifecycleConfiguration.fromJSON( > JSON.parse(`{ > "rules": [...], > "lastAccessFilter": { > "conditions": [ > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > { > "type": "", > "methods": [""], > "userAgents": [""] > }, > ... > ] > } > }`), > ); > const updateFilterSvc = new BucketService(sdk); > const updateFilterBucket = await updateFilterSvc.get( > GetBucketRequest.create({ id: "" }), > ).result; > updateFilterBucket.spec.lifecycleConfiguration = > updateFilterConfig; > const updateFilterOp = await updateFilterSvc.update( > UpdateBucketRequest.create({ > metadata: updateFilterBucket.metadata, > spec: updateFilterBucket.spec, > }), > ).result; > await updateFilterOp.wait(); > ``` > > In the code, set the same filter parameters. Set `id` in `GetBucketRequest` to the bucket ID. Keep the existing lifecycle rules in `rules`. ### Examples of transition lifecycle rules Below are examples of how to create a bucket with a transition lifecycle rule that triggers if an object wasn't accessed for a long time. * Switch a storage class to Standard if the object hasn't been accessed in seven days. For the access, don't consider the `GetObject` and `CopyObject` methods that were made by using `rclone`. > [tab] Nebius AI Cloud CLI > > To set such a rule, run the following command: > > ```bash > nebius storage bucket create --name my-bucket \ > --default-storage-class enhanced_throughput \ > --lifecycle-configuration-rules '[ > { > "id": "switch-to-standard-in-7-days", > "status": "enabled", > "transition": { > "days_since_last_access": 7, > "storage_class": "standard" > } > } > ]' \ > --lifecycle-configuration-last-access-filter-conditions '[ > { > "type": "exclude", > "methods": ["get_object", "copy_object"], > "user_agents": ["rclone"] > } > ]' > ``` > [tab] Terraform > > To set such a rule, apply the following configuration: > > ```hcl > resource "nebius_storage_v1_bucket" "switch_to_standard_7_days" { > name = "my-bucket" > parent_id = "" > default_storage_class = "ENHANCED_THROUGHPUT" > lifecycle_configuration = { > rules = [ > { > id = "switch-to-standard-in-7-days" > status = "ENABLED" > transition = { > days_since_last_access = 7 > storage_class = "STANDARD" > } > } > ] > last_access_filter = [ > { > conditions = [ > { > type = "EXCLUDE" > methods = ["GET_OBJECT", "COPY_OBJECT"] > user_agents = ["rclone"] > } > ] > } > ] > } > } > ``` > > In the configuration, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > [tab] Go SDK > > Create the bucket: > > ```go > sevenDaySpec := &storage.BucketSpec{} > sevenDayJSON := []byte(`{ > "defaultStorageClass": "ENHANCED_THROUGHPUT", > "lifecycleConfiguration": { > "rules": [ > { > "id": "switch-to-standard-in-7-days", > "status": "ENABLED", > "transition": { > "storageClass": "STANDARD", > "daysSinceLastAccess": 7 > } > } > ], > "lastAccessFilter": { > "conditions": [ > { > "type": "EXCLUDE", > "methods": [ > "GET_OBJECT", > "COPY_OBJECT" > ], > "userAgents": ["rclone"] > } > ] > } > } > }`) > if err := protojson.Unmarshal( > sevenDayJSON, > sevenDaySpec, > ); err != nil { > return err > } > createSevenDaySvc := sdk.Services().Storage().V1(). > Bucket() > createSevenDayOp, err := createSevenDaySvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "my-bucket", > }, > Spec: sevenDaySpec, > }, > ) > if err != nil { > return err > } > if _, err = createSevenDayOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, `Metadata.Name` is the bucket name. The example uses `my-bucket`. > [tab] Python SDK > > Create the bucket: > > ```python > seven_day_spec = BucketSpec.from_json( > """{ > "defaultStorageClass": "ENHANCED_THROUGHPUT", > "lifecycleConfiguration": { > "rules": [ > { > "id": "switch-to-standard-in-7-days", > "status": "ENABLED", > "transition": { > "storageClass": "STANDARD", > "daysSinceLastAccess": 7 > } > } > ], > "lastAccessFilter": { > "conditions": [ > { > "type": "EXCLUDE", > "methods": [ > "GET_OBJECT", > "COPY_OBJECT" > ], > "userAgents": ["rclone"] > } > ] > } > } > }""", > ) > create_seven_day_service = BucketServiceClient(sdk) > create_seven_day_operation = ( > await create_seven_day_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="my-bucket", > ), > spec=seven_day_spec, > ), > ) > ) > await create_seven_day_operation.wait() > ``` > > In the code, `metadata.name` is the bucket name. The example uses `my-bucket`. > [tab] JavaScript SDK > > Create the bucket: > > ```ts > const sevenDaySpec = BucketSpec.fromJSON( > JSON.parse(`{ > "defaultStorageClass": "ENHANCED_THROUGHPUT", > "lifecycleConfiguration": { > "rules": [ > { > "id": "switch-to-standard-in-7-days", > "status": "ENABLED", > "transition": { > "storageClass": "STANDARD", > "daysSinceLastAccess": 7 > } > } > ], > "lastAccessFilter": { > "conditions": [ > { > "type": "EXCLUDE", > "methods": [ > "GET_OBJECT", > "COPY_OBJECT" > ], > "userAgents": ["rclone"] > } > ] > } > } > }`), > ); > const createSevenDaySvc = new BucketService(sdk); > const createSevenDayOp = await createSevenDaySvc. > create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "my-bucket", > }), > spec: sevenDaySpec, > }), > ).result; > await createSevenDayOp.wait(); > ``` > > In the code, `metadata.name` is the bucket name. The example uses `my-bucket`. * Switch a storage class to Standard if the object hasn't been accessed in three days. For the access, consider only the `GetObjectTagging` method. > [tab] Nebius AI Cloud CLI > > To set such a rule, run the following command: > > ```bash > nebius storage bucket create --name my-bucket \ > --default-storage-class enhanced_throughput \ > --lifecycle-configuration-rules '[ > { > "id": "switch-to-standard-in-3-days", > "status": "enabled", > "transition": { > "days_since_last_access": 3, > "storage_class": "standard" > } > } > ]' \ > --lifecycle-configuration-last-access-filter-conditions '[ > { > "type": "include", > "methods": ["get_object_tagging"] > } > ]' > ``` > [tab] Terraform > > To set such a rule, apply the following configuration: > > ```hcl > resource "nebius_storage_v1_bucket" "switch_to_standard_3_days" { > name = "my-bucket" > parent_id = "" > default_storage_class = "ENHANCED_THROUGHPUT" > lifecycle_configuration = { > rules = [ > { > id = "switch-to-standard-in-3-days" > status = "ENABLED" > transition = { > days_since_last_access = 3 > storage_class = "STANDARD" > } > } > ] > last_access_filter = [ > { > conditions = [ > { > type = "INCLUDE" > methods = ["GET_OBJECT_TAGGING"] > } > ] > } > ] > } > } > ``` > > In the configuration, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > [tab] Go SDK > > Create the bucket: > > ```go > threeDaySpec := &storage.BucketSpec{} > threeDayJSON := []byte(`{ > "defaultStorageClass": "ENHANCED_THROUGHPUT", > "lifecycleConfiguration": { > "rules": [ > { > "id": "switch-to-standard-in-3-days", > "status": "ENABLED", > "transition": { > "storageClass": "STANDARD", > "daysSinceLastAccess": 3 > } > } > ], > "lastAccessFilter": { > "conditions": [ > { > "type": "INCLUDE", > "methods": ["GET_OBJECT_TAGGING"] > } > ] > } > } > }`) > if err := protojson.Unmarshal( > threeDayJSON, > threeDaySpec, > ); err != nil { > return err > } > createThreeDaySvc := sdk.Services().Storage().V1(). > Bucket() > createThreeDayOp, err := createThreeDaySvc.Create( > ctx, > &storage.CreateBucketRequest{ > Metadata: &common.ResourceMetadata{ > Name: "my-bucket", > }, > Spec: threeDaySpec, > }, > ) > if err != nil { > return err > } > if _, err = createThreeDayOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, `Metadata.Name` is the bucket name. The example uses `my-bucket`. > [tab] Python SDK > > Create the bucket: > > ```python > three_day_spec = BucketSpec.from_json( > """{ > "defaultStorageClass": "ENHANCED_THROUGHPUT", > "lifecycleConfiguration": { > "rules": [ > { > "id": "switch-to-standard-in-3-days", > "status": "ENABLED", > "transition": { > "storageClass": "STANDARD", > "daysSinceLastAccess": 3 > } > } > ], > "lastAccessFilter": { > "conditions": [ > { > "type": "INCLUDE", > "methods": ["GET_OBJECT_TAGGING"] > } > ] > } > } > }""", > ) > create_three_day_service = BucketServiceClient(sdk) > create_three_day_operation = ( > await create_three_day_service.create( > CreateBucketRequest( > metadata=ResourceMetadata( > name="my-bucket", > ), > spec=three_day_spec, > ), > ) > ) > await create_three_day_operation.wait() > ``` > > In the code, `metadata.name` is the bucket name. The example uses `my-bucket`. > [tab] JavaScript SDK > > Create the bucket: > > ```ts > const threeDaySpec = BucketSpec.fromJSON( > JSON.parse(`{ > "defaultStorageClass": "ENHANCED_THROUGHPUT", > "lifecycleConfiguration": { > "rules": [ > { > "id": "switch-to-standard-in-3-days", > "status": "ENABLED", > "transition": { > "storageClass": "STANDARD", > "daysSinceLastAccess": 3 > } > } > ], > "lastAccessFilter": { > "conditions": [ > { > "type": "INCLUDE", > "methods": ["GET_OBJECT_TAGGING"] > } > ] > } > } > }`), > ); > const createThreeDaySvc = new BucketService(sdk); > const createThreeDayOp = await createThreeDaySvc. > create( > CreateBucketRequest.create({ > metadata: ResourceMetadata.create({ > name: "my-bucket", > }), > spec: threeDaySpec, > }), > ).result; > await createThreeDayOp.wait(); > ``` > > In the code, `metadata.name` is the bucket name. The example uses `my-bucket`. # Performance and cost-efficiency best practices in Object Storage Source: https://docs.nebius.com/object-storage/performance-cost-best-practices.md When performing operations on your Object Storage buckets and objects, you can use optimizations and approaches described in this article to ensure better performance and save costs. ## List objects without delimiter Using [ListObjects](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html), an S3 API action, with a delimiter is much slower than listing objects without a delimiter. Flat listing provides better performance, especially in buckets with a lot of objects. Consider organizing your object keys without creating multiple levels of nested folders, so that you can use flat listing without delimiters in most or all cases. If your object keys use prefixes to represent folders, you can get a flat list of objects in a leaf folder (that is, a folder that does not have nested folders) more efficiently by specifying a prefix instead of a delimiter in `ListObjects`. ## Use object versioning only if required For lower latency and higher throughput in high-load scenarios, we recommend using buckets with [versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) disabled. ## Use concurrency The S3 API and many interfaces and SDKs for it, such as the [AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md), support concurrent requests, which brings significant performance boosts if used correctly. This even applies to GET operations over single objects; the performance effect can be made stronger for large objects if you use multipart uploads and properly align the sizes of upload parts and download ranges (see [below](https://docs.nebius.com/object-storage/performance-cost-best-practices.md#optimize-the-sizes-of-upload-parts-and-download-ranges)). When experiencing performance issues, try increasing concurrency to fully utilize your bandwidth. To find the balance between performance and client machine utilization, increase the number of concurrent requests gradually, and stop as soon as there is no further performance gain. Increasing concurrency to several hundreds per client machine is not recommended. To set the number of concurrent requests in the AWS CLI, run the following command (the default concurrency is 10): ```bash aws configure set max_concurrent_requests 20 ``` ## Use HTTP only for selected workloads If encryption causes performance issues or when certificate configuration is too resource-intensive, you can request [HTTP access to the S3 API](https://docs.nebius.com/object-storage/http-access.md). HTTP access is disabled by default and can be enabled only for a specific bucket by [contacting support](https://console.nebius.com/support/create-ticket). > [!WARNING] > > Use HTTP access only for requests that are safe to send without encryption. HTTP doesn't encrypt object data, request metadata, or request headers in transit. IAM token authentication is also not allowed over HTTP. ## Avoid overwriting the same key concurrently Sending multiple concurrent `PUT` requests with the same key is supported but performs poorly and leads to occasional timeout errors, especially in versioned buckets. ## Optimize the sizes of upload parts and download ranges While the S3 API allows creating parts up to 5 GiB, it is usually more efficient to use smaller parts. Start with smaller parts, like 10–50 MiB, and only use larger parts if you need to upload very large objects or reduce the number of upload requests. The best way to choose the part size is to treat each part as a unit of download concurrency. Ideally, the part size should ensure that each download range covers one or more upload parts without overlaps. > For example, if you have a 1000 MiB object, and you want to download it using 10 threads, your part size should be at most 100 MiB. But it is often more practical to go even smaller, for example, 10 MiB. Make sure that every thread downloads a range that consists of 10 parts: 0–100 MiB (parts 1–10), 100–200 MiB (parts 11–20) and so on. In that case, you can easily increase concurrency and keep it efficient without needing to re-upload the object with more parts. To set the upload part size (also known as the chunk size) in the AWS CLI, run the following command: ```bash aws configure set s3.multipart_chunksize 50MB ``` > [!NOTE] > > Using bigger part sizes may limit your upload concurrency. For example, uploading a 100 MiB file with 50 MiB part sizes cannot be performed with a concurrency of 3 or more. ## Clean up incomplete multipart uploads The multipart upload of a very large object may be interrupted at any time (due to a network issue, machine restart or simply after being canceled manually). Until the multipart upload is complete, its parts that have already been uploaded continue to be stored in the bucket, and you are [charged for storing them](https://docs.nebius.com/object-storage/resources/pricing.md). By default, depending on when you created the bucket, Object Storage stores parts of incomplete multipart uploads for at least 30 days: * For buckets created before November 9, 2026, Object Storage doesn't automatically delete incomplete multipart uploads and stores their parts indefinitely by default. You can [configure an expiration lifecycle rule](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules) that automatically cleans up incomplete multipart uploads in your bucket. For example, the following command creates a rule that deletes incomplete uploads seven days after initiation: ```bash cat < uploads_lifecycle.json { "Rules": [ { "ID": "AbortMultipartUploads", "Status": "Enabled", "Filter": { "Prefix": "" }, "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 } } ] } EOF aws s3api put-bucket-lifecycle-configuration \ --bucket \ --lifecycle-configuration file://uploads_lifecycle.json ``` * For buckets created on or after November 9, 2026, Object Storage automatically deletes incomplete multipart uploads after 30 days. To change this behavior, [create an expiration lifecycle rule](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md#how-to-configure-expiration-lifecycle-rules) to abort incomplete multipart uploads according to your preferred pattern. Creating such a rule disables the default automatic deletion, even if you set the rule status to disabled. # Performance benchmark tests with Warp in Object Storage Source: https://docs.nebius.com/object-storage/performance/benchmark.md To test Object Storage performance, use [Warp](https://github.com/minio/warp). Warp is an open-source benchmarking utility designed to check performance of S3-compatible storage. It measures throughput and delivers reproducible, comparable results across any S3 environment. ## Prerequisites 1. Install Warp: ```bash wget https://dl.min.io/aistor/warp/release/linux-amd64/warp chmod +x warp ``` 2. [Create an access key](https://docs.nebius.com/iam/service-accounts/access-keys.md). You need its AWS-like ID and secret key to run benchmark tests. When you create the access key by using the CLI, the AWS-like ID and secret key are specified in the `.status.aws_access_key_id` and `.status.secret` parameters of the output. To create an access key, make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role. 3. [Create an Object Storage bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets) if you don't have one. ## How to run benchmark tests The example below showcases how to check the maximum single-node performance for read and write operations. Warp provides multiple tests for S3 methods. If you want to test a different use case, see the [Warp repository](https://github.com/minio/warp) for documentation or [contact technical support](https://console.nebius.com/support/create-ticket). To run benchmark tests: 1. Prepare environment variables for the tests: ```bash export S3_ENDPOINT="storage..nebius.cloud:443" export S3_BUCKET="" export S3_ACCESS_KEY="" export S3_SECRET_KEY="" ``` In the `S3_ENDPOINT` variable, specify the same [region](https://docs.nebius.com/overview/regions.md) where your bucket is located. 2. Test the read performance: ```bash ./warp get \ --host "$S3_ENDPOINT" \ --tls \ --bucket "$S3_BUCKET" \ --access-key "$S3_ACCESS_KEY" \ --secret-key "$S3_SECRET_KEY" \ --objects 5000 \ --obj.size 10MiB \ --duration 5m \ --storage-class STANDARD \ --concurrent 128 ``` Adjust the following parameters to your workload profile: * `--objects`: Number of objects to upload. The default value is `2500` but for better test results, specify at least `5000`. * `--obj.size`: Size of each generated object. Specify the value as `nKiB`, `nMiB` or `nGiB`, for example, `100KiB`. The default value is `10MiB`. * `--duration` (optional): Duration of the test. Specify the value as `Nm`, for example, `7m`. The default value is 5 minutes. Run the test for at least 5–10 minutes to see how stable the performance is. * `--storage-class` (optional): [Storage class](https://docs.nebius.com/object-storage/storage-classes.md) to use. Set `STANDARD` or `ENHANCED_THROUGHPUT`. If not specified, the default storage class of the bucket is applied. * `--concurrent`: Runs multiple concurrent operations per Warp client and sets the number of these operations. The default value is `20`. Adjust the value, according to the following recommendations: * The value range should be within 32–200. * For small objects, run the test with a higher concurrency. For large objects, run it with a lower concurrency. Try changing the number to find an optimal value. It depends on a selected storage class and on the machine where you run the test (for example, [Compute virtual machine](https://docs.nebius.com/compute/index.md), your local machine or the internet). 3. Test the write performance: ```bash ./warp put \ --host "$S3_ENDPOINT" \ --tls \ --bucket "$S3_BUCKET" \ --access-key "$S3_ACCESS_KEY" \ --secret-key "$S3_SECRET_KEY" \ --obj.size 10MiB \ --concurrent 128 ``` Adjust the `--obj.size` and `--concurrent` parameters in the same way as in the read performance test. # How data transfers work in Nebius AI Cloud Source: https://docs.nebius.com/object-storage/transfer/overview.md *Data transfers* allow you to move data between buckets. You can use a data transfer, for example, when you need to replicate and back up your data in a bucket, or when you want to migrate from a different region or third-party storage service. Data transfers support both Object Storage in Nebius AI Cloud and S3-compatible third-party services as sources and destinations. For more information, see [Bucket requirements for data transfers](https://docs.nebius.com/object-storage/transfer/requirements.md). You can manage data transfers in the web console or by using the CLI or the provider for Terraform. For instructions, see [Launching transfers](https://docs.nebius.com/object-storage/transfer/launch.md) and [Managing transfers](https://docs.nebius.com/object-storage/transfer/manage.md). ## Iterations Data transfers consist of consecutive *iterations*. Each iteration passes the source and destination buckets once. At each iteration, Object Storage performs the following operations in parallel: * Lists objects in the source bucket by making a `ListObjects` request for every 1000 objects. For every listed source object, Object Storage makes `HeadObject` requests to both the source and destination buckets, and then determines which objects need to be transferred: * If you allow [overwriting destination objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#overwriting-destination-objects), a source object that is newer than its destination pair (based on the `Last-Modified` header) overwrites it. If you also allow [overwriting unmanaged objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#unmanaged-destination-objects), the same applies to objects in the destination that weren't copied from the source bucket during the current or past transfers. * After the first successful iteration, source objects that were last modified before the last successful iteration are skipped to reduce synchronization costs. * If the source and destination objects have identical data but different metadata, Object Storage doesn't transfer the object data again. Instead, it updates the destination object's metadata by making a `CopyObject` request with `MetadataDirective` set to `REPLACE`. * If [deleting destination objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#deleting-destination-objects) is enabled, Object Storage lists objects in the destination bucket by making a `ListObjects` request for every 1000 objects. Object Storage compares source and destination object lists, determines which destination objects don't have pairs in the source, and deletes them using `DeleteObject`. If [overwriting and deleting unmanaged objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#unmanaged-destination-objects) is disabled, Object Storage doesn't delete destination objects that weren't copied from the source bucket during the current or past transfers. * For every object that needs to be transferred: * If the object is less than 100 MB, it makes a single `GetObject` request to the source bucket and a single `PutObject` request to the destination bucket. * For larger objects, it makes the following requests: 1. `CreateMultipartUpload` to the destination bucket. 2. `GetObject` to the source bucket and `UploadPart` to the destination bucket for every approximately 50 MB of the object. 3. `CompleteMultipartUpload` to the destination bucket after uploading all parts. The same logic applies to [blobs](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction#blobs) in Azure Blob Storage containers, regardless of the type of blob. ### Number of iterations and empty iterations You can configure a data transfer to stop after one iteration or after a number of consecutive empty iterations or to continue indefinitely. An *empty iteration* is an iteration where no data is transferred or deleted. To configure the number of iterations, choose a data transfer type in the web console or define a stop condition in the developer tools, such as the CLI. For transfers with more than one iteration, you can also set the interval between iterations. For more information, see [Data transfer types and stop conditions](https://docs.nebius.com/object-storage/transfer/stop-condition.md). ## Costs The cost of a data transfer consists of the costs for the source and destination buckets. The data transfer itself doesn't incur additional costs. | | **Destination: Nebius** | **Destination: external** | | - | - | - | | **Source: Nebius** |
  • [HTTP requests](https://docs.nebius.com/object-storage/resources/pricing.md#http-requests-on-data) on source data: class B (GET, HEAD) operations, as described in [Iterations](https://docs.nebius.com/object-storage/transfer/overview.md#iterations)
  • [Egress traffic](https://docs.nebius.com/object-storage/resources/pricing.md#egress-traffic) from source (except when both buckets are in the same [region](https://docs.nebius.com/overview/regions.md))
  • [HTTP requests](https://docs.nebius.com/object-storage/resources/pricing.md#http-requests-on-data) on destination data: class A (PUT, POST, DELETE) and class B (HEAD) operations, as described in [Iterations](https://docs.nebius.com/object-storage/transfer/overview.md#iterations)
  • [Storing data](https://docs.nebius.com/object-storage/resources/pricing.md#storing-data) in destination (once an object or its part is uploaded)
|
  • [HTTP requests](https://docs.nebius.com/object-storage/resources/pricing.md#http-requests-on-data) on source data: class B (GET, HEAD) operations, as described in [Iterations](https://docs.nebius.com/object-storage/transfer/overview.md#iterations)
  • [Egress traffic](https://docs.nebius.com/object-storage/resources/pricing.md#egress-traffic) from source
  • Destination costs: ingress traffic, requests, storage, etc. (see your provider's documentation)
| | **Source: external** |
  • Source costs: egress traffic, requests, etc. (see your provider's documentation)
  • [HTTP requests](https://docs.nebius.com/object-storage/resources/pricing.md#http-requests-on-data) on destination data: class A (PUT, POST, DELETE) and class B (HEAD) operations, as described in [Iterations](https://docs.nebius.com/object-storage/transfer/overview.md#iterations)
  • [Storing data](https://docs.nebius.com/object-storage/resources/pricing.md#storing-data) in destination (once an object or its part is uploaded)
| *Not supported* | # Bucket requirements for data transfers Source: https://docs.nebius.com/object-storage/transfer/requirements.md You can transfer data between Nebius AI Cloud buckets or between a Nebius AI Cloud bucket and a supported S3-compatible storage service. Additionally, Azure Blob Storage containers are supported as data transfer sources. In every data transfer, either the source, the destination or both must be Nebius AI Cloud buckets. You can also use [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) for data transfers. ## Supported external storage services When transferring data from another S3-compatible storage service, verify the consistency of object metadata before starting the transfer. Object Storage relies on the source service to assign accurate timestamps of the last modification. If the source service sets timestamps incorrectly — for example, to dates in the past during object creation — such objects may be skipped during synchronization, even if they are new or updated. The following table lists supported external storage services. This list is subject to change. If you want to add a provider that isn't listed, [contact support](https://console.nebius.com/support/create-ticket). | Provider | Endpoints | Source | Destination | | - | - | - | - | | [Alibaba Cloud Object Storage Service](https://www.alibabacloud.com/help/en/oss/user-guide/oss-bucket-overview) | `https://oss-*.aliyuncs.com` | Yes | Yes, with limitations\* | | [AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingBucket.html) | `https://s3.*.amazonaws.com`, `https://s3.dualstack.*.amazonaws.com` | Yes | Yes | | [Azure Blob Storage](https://learn.microsoft.com/en-us/azure/storage/blobs/blob-containers-portal) | `https://*.blob.core.windows.net` | Yes | No | | [Backblaze B2](https://www.backblaze.com/docs/cloud-storage-buckets) | `https://s3.*.backblazeb2.com` | Yes | Yes, with limitations\* | | [Cloudflare R2](https://developers.cloudflare.com/r2/buckets/) | `https://*.r2.cloudflarestorage.com` | Yes | No | | [Google Cloud Storage](https://cloud.google.com/storage/docs/buckets) | `https://storage.googleapis.com`, `https://storage.*.rep.googleapis.com` | Yes | No | | [IBM Cloud Object Storage](https://cloud.ibm.com/docs/cloud-object-storage/cli?topic=cloud-object-storage-getting-started-cloud-object-storage) | `https://s3.*.cloud-object-storage.appdomain.cloud` | Yes | Yes | | [MEGA S4](https://help.mega.io/megas4) | `https://s3.*.megas4.com` | Yes | Yes | | [Oracle Cloud Infrastructure Object Storage](https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/managingbuckets.htm) | `https://*.compat.objectstorage.*.oci.customer-oci.com`, `https://*.compat.objectstorage.*.oraclecloud.com` | Yes | No | | [Supabase](https://supabase.com/docs/guides/storage/s3/compatibility) | `https://*.supabase.co/storage/v1/s3`, `https://*.storage.supabase.co/storage/v1/s3` | Yes | Yes, with limitations\* | | [T3 Tigris Data](https://www.tigrisdata.com/) | `https://t3.storage.dev` | Yes | No | | [Wasabi](https://docs.wasabi.com/docs/creating-a-bucket) | `https://s3.*.wasabisys.com`, `https://s3.wasabisys.com` | Yes | Yes, with limitations\* | | [Dropbox](https://docs.dropboxapi.com/object-storage/docs/welcome) | `https://seal.dropboxapi.com` | Yes | Yes | \* Alibaba Cloud Object Storage Service, Backblaze B2, Supabase and Wasabi don't support the `If-Match` and `If-None-Match` conditional request headers. For details, see [Limitations for conditional requests](https://docs.nebius.com/object-storage/transfer/requirements.md#limitations-for-conditional-requests). ## Versioned buckets as sources You can transfer data from versioned buckets. For versioned buckets, only the current object version is transferred. ## Access to buckets When you [create a data transfer](https://docs.nebius.com/object-storage/transfer/launch.md), you provide credentials that Object Storage uses to access the buckets. These credentials belong to accounts in storage services, such as [service accounts](https://docs.nebius.com/iam/overview.md#accounts-and-members) in Nebius AI Cloud. The accounts perform actions on buckets and objects during the data transfer, so these accounts must have sufficient permissions to perform these actions. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). ## Limitations for conditional requests Alibaba Cloud Object Storage Service, Backblaze B2, Supabase and Wasabi don't support the `If-Match` and `If-None-Match` HTTP headers for conditional requests. When you use one of these providers as a transfer destination, guarantees for write and delete operations degrade to best-effort behavior: * Protection of concurrent write and delete operations isn't enforced. The data transfer can't atomically verify that an object wasn't modified between the read and the write or delete operation. This creates a race condition where concurrent operations may silently overwrite changes or delete objects unexpectedly. * If [overwriting and deleting unmanaged destination objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#unmanaged-destination-objects) is disabled (`.spec.touch_unmanaged = false`), unmanaged objects may still be overwritten or deleted if another process writes to them between the read and write or delete operation. * The enabled [overwriting destination objects if source is newer](https://docs.nebius.com/object-storage/transfer/destination-objects.md#overwriting-destination-objects) (`.spec.overwrite_strategy = IF_NEWER`) doesn't guarantee that only older objects are overwritten. If an object is written after the read operation but before the write operation, it won't be detected and may be overwritten. * The enabled [deletion of destination objects that aren't in the source](https://docs.nebius.com/object-storage/transfer/destination-objects.md#deleting-destination-objects) (`.spec.enable_deletes_in_destination = true`) doesn't guarantee that only stale destination objects are deleted. If an object is written to the destination after the destination read operation but before deletion, it may be deleted. # Creating and launching data transfers in Object Storage Source: https://docs.nebius.com/object-storage/transfer/launch.md Data transfers allow you to move data between buckets when you want to migrate or replicate it. For more information, see [How data transfers work](https://docs.nebius.com/object-storage/transfer/overview.md). ## Prerequisites > [tab] Web console > > 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 2. In the [web console](https://console.nebius.com), select the project that contains the destination bucket (if it's in Nebius AI Cloud) or the source bucket (if the destination is in an external storage service). > 3. Make sure that your account has access to the buckets. Prepare credentials for the buckets, for example, access and secret keys. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). > > > [!NOTE] > > > > To transfer data from S3-compatible storage to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) attached to the filesystem first. Then, use the filesystem bucket as the destination bucket in the data transfer. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > 3. Get the ID of the project that contains the destination bucket (if it's in Nebius AI Cloud) or the source bucket (if the destination is in an external storage service): > > ```bash > nebius storage bucket get --format jsonpath='{.metadata.parent_id}' > ``` > > 4. Make sure that your account has access to the buckets. Prepare credentials for the buckets, for example, access and secret keys. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). > > > [!NOTE] > > > > To transfer data from S3-compatible storage to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) attached to the filesystem first. Then, use the filesystem bucket as the destination bucket in the data transfer. > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > 3. Save to a [local variable](https://developer.hashicorp.com/terraform/language/values/locals) the ID of the project that contains the destination bucket (if it's in Nebius AI Cloud) or the source bucket (if the destination is in an external storage service): > > ```hcl > data "nebius_storage_v1_bucket" "nebius_bucket" { > id = "" > } > > locals { > transfer_project_id = data.nebius_storage_v1_bucket.nebius_bucket.parent_id > } > ``` > > 4. Make sure that your account has access to the buckets. Prepare credentials for the buckets, for example, access and secret keys. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). > > > [!NOTE] > > > > To transfer data from S3-compatible storage to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) attached to the filesystem first. Then, use the filesystem bucket as the destination bucket in the data transfer. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > 3. Get the project ID: > > ```go > bucketSvc := sdk.Services().Storage().V1().Bucket() > bucket, err := bucketSvc.Get( > ctx, > &storage.GetBucketRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(bucket.GetMetadata().GetParentId()) > ``` > > In the code, set `Id` to the bucket ID. The code prints the project ID. > > 4. Make sure that your account has access to the buckets. Prepare credentials for the buckets, for example, access and secret keys. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). > > > [!NOTE] > > > > To transfer data from S3-compatible storage to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) attached to the filesystem first. Then, use the filesystem bucket as the destination bucket in the data transfer. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > 3. Get the project ID: > > ```python > bucket_service = BucketServiceClient(sdk) > bucket = await bucket_service.get( > GetBucketRequest(id=""), > ) > print(bucket.metadata.parent_id) > ``` > > In the code, set `id` to the bucket ID. The code prints the project ID. > > 4. Make sure that your account has access to the buckets. Prepare credentials for the buckets, for example, access and secret keys. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). > > > [!NOTE] > > > > To transfer data from S3-compatible storage to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) attached to the filesystem first. Then, use the filesystem bucket as the destination bucket in the data transfer. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > 3. Get the project ID: > > ```ts > const bucketService = new BucketService(sdk); > const bucket = await bucketService.get( > GetBucketRequest.create({ id: "" }), > ).result; > console.log(bucket.metadata.parentId); > ``` > > In the code, set `id` to the bucket ID. The code prints the project ID. > > 4. Make sure that your account has access to the buckets. Prepare credentials for the buckets, for example, access and secret keys. For more information, see [Access to buckets for data transfers](https://docs.nebius.com/object-storage/transfer/access.md). > > > [!NOTE] > > > > To transfer data from S3-compatible storage to a [shared filesystem](https://docs.nebius.com/compute/storage/types.md#shared-filesystems), create a [filesystem bucket](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) attached to the filesystem first. Then, use the filesystem bucket as the destination bucket in the data transfer. ## How to launch a data transfer > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Data Transfer** and then click  **Create data transfer**. > > 2. Configure the data transfer: > > 1. Specify its name. > > 2. Select the [data transfer type](https://docs.nebius.com/object-storage/transfer/stop-condition.md#data-transfer-type-web-console): one-time transfer or replication. > > 3. Configure the source and destination buckets: > > 4. Specify the path to the buckets. > > In the **Bucket** field, you can optionally add [object key prefixes](https://docs.nebius.com/object-storage/transfer/key-prefixes.md) to the bucket name. In the source, you filter objects. In the destination, you overwrite prefixes of the source objects. > > Filesystem buckets are listed in the **Bucket** field together with other buckets. > > 5. Set [credentials](https://docs.nebius.com/object-storage/transfer/access.md#credentials). > > 6. Configure how the data transfer [handles destination objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md). See the settings under **Overwriting destination objects**, **Deleting destination objects**, and **Unmanaged objects**. > > 7. Configure [limits on request rate and bandwidth](https://docs.nebius.com/object-storage/transfer/limits.md). If you don't set them or set them to zero, the default values apply: > > * Request rate: 4000 requests per second. > * Bandwidth: 50 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.)/s. > > 3. Click **Create transfer**. > [tab] CLI > > 1. Create a `transfer.json` file with the data transfer configuration and replace values in the file. Use one of the files below, depending on the source and destination storage services: > > > [accordion] Nebius AI Cloud to Nebius AI Cloud > > > > ```json transfer.json > > { > > "metadata": { > > "name": "", > > "parent_id": "" > > }, > > "spec": { > > "source": { > > "nebius": { > > "region": "", > > "bucket_name": "", > > > > // Either: > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > }, > > // Or, for anonymous access: > > // "anonymous": {} > > }, > > "prefix": "" // Optional > > }, > > "destination": { > > "nebius": { > > "region": "", > > "bucket_name": "", > > > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > } > > }, > > "prefix": "" // Optional > > }, > > > > // Either: > > "after_one_iteration": {}, > > // Or: > > // "after_n_empty_iterations": { > > // "empty_iterations_threshold": > > // }, > > // Or: > > // "infinite": {}, > > // > > // "inter_iteration_interval": "", // For example, "1h20m40s" > > > > "overwrite_strategy": "", > > "enable_deletes_in_destination": true|false, > > "touch_unmanaged": true|false, // Optional > > "limiters": { > > "requests_per_second": , > > "bandwidth_bytes_per_second": > > } > > } > > } > > ``` > > > [accordion] Nebius AI Cloud to another storage service > > > > ```json transfer.json > > { > > "metadata": { > > "name": "", > > "parent_id": "" > > }, > > "spec": { > > "source": { > > "nebius": { > > "region": "", > > "bucket_name": "", > > > > // Either: > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > }, > > // Or, for anonymous access: > > // "anonymous": {} > > }, > > "prefix": "" // Optional > > }, > > "destination": { > > "s3_compatible": { > > "endpoint": "", > > "region": "", > > "bucket_name": "", > > > > // Either: > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > }, > > // Or, for anonymous access: > > // "anonymous": {} > > }, > > "prefix": "" // Optional > > }, > > > > // Either: > > "after_one_iteration": {}, > > // Or: > > // "after_n_empty_iterations": { > > // "empty_iterations_threshold": > > // }, > > // Or: > > // "infinite": {}, > > // > > // "inter_iteration_interval": "", // For example, "1h20m40s" > > > > "overwrite_strategy": "", > > "enable_deletes_in_destination": true|false, > > "touch_unmanaged": true|false, // Optional > > "limiters": { > > "requests_per_second": , > > "bandwidth_bytes_per_second": > > } > > } > > } > > ``` > > > [accordion] Azure Blob Storage to Nebius AI Cloud > > > > ```json transfer.json > > { > > "metadata": { > > "name": "", > > "parent_id": "" > > }, > > "spec": { > > "source": { > > "azure_blob_storage": { > > "endpoint": "", > > "container_name": "", > > > > // Either: > > "azure_storage_account": { > > "account_name": "", > > "access_key": "" > > }, > > // Or, for anonymous access: > > // "anonymous": {} > > }, > > "prefix": "" // Optional > > }, > > "destination": { > > "nebius": { > > "region": "", > > "bucket_name": "", > > > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > } > > }, > > "prefix": "" // Optional > > }, > > > > // Either: > > "after_one_iteration": {}, > > // Or: > > // "after_n_empty_iterations": { > > // "empty_iterations_threshold": > > // }, > > // Or: > > // "infinite": {}, > > // > > // "inter_iteration_interval": "", // For example, "1h20m40s" > > > > "overwrite_strategy": "", > > "enable_deletes_in_destination": true|false, > > "touch_unmanaged": true|false, // Optional > > "limiters": { > > "requests_per_second": , > > "bandwidth_bytes_per_second": > > } > > } > > } > > ``` > > > [accordion] Another storage service to Nebius AI Cloud > > > > ```json transfer.json > > { > > "metadata": { > > "name": "", > > "parent_id": "" > > }, > > "spec": { > > "source": { > > "s3_compatible": { > > "endpoint": "", > > "region": "", > > "bucket_name": "", > > > > // Either: > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > }, > > // Or, for anonymous access: > > // "anonymous": {} > > }, > > "prefix": "" // Optional > > }, > > "destination": { > > "nebius": { > > "region": "", > > "bucket_name": "", > > > > "access_key": { > > "access_key_id": "", > > "secret_access_key": "" > > } > > }, > > "prefix": "" // Optional > > }, > > > > // Either: > > "after_one_iteration": {}, > > // Or: > > // "after_n_empty_iterations": { > > // "empty_iterations_threshold": > > // }, > > // Or: > > // "infinite": {}, > > // > > // "inter_iteration_interval": "", // For example, "1h20m40s" > > > > "overwrite_strategy": "", > > "enable_deletes_in_destination": true|false, > > "touch_unmanaged": true|false, // Optional > > "limiters": { > > "requests_per_second": , > > "bandwidth_bytes_per_second": > > } > > } > > } > > ``` > > For details, see: > > * [Examples](https://docs.nebius.com/object-storage/transfer/launch.md#examples) > * [Reference](https://docs.nebius.com/cli/reference/storage/transfer/create.md) for the `nebius storage transfer create` CLI command > * [Transfer configuration](https://docs.nebius.com/object-storage/transfer/stop-condition.md) > 2. Launch the data transfer: > > ```bash > nebius storage transfer create \ > --parent-id \ > --file transfer.json > ``` > [tab] Terraform > > 1. Add a data transfer block to your Terraform configuration. > > We recommend using Terraform [ephemeral](https://docs.nebius.com/terraform-provider/sensitive-values.md#ephemerals-for-sensitive-values) resource blocks and write-only `sensitive` fields when passing access credentials for buckets. You can also use regular fields, but the credential values are then stored in Terraform plan and state files, which is less secure. > > The following examples show how to launch a data transfer for different sources and destinations: > > > [accordion] Nebius AI Cloud to Nebius AI Cloud > > > > ```hcl > > ephemeral "nebius_iam_v2_access_key_secret" "ak_secret" { > > aws_access_key_id = "" > > } > > > > resource "nebius_storage_v1_transfer" "my_transfer" { > > name = "" > > parent_id = local.transfer_project_id > > > > source { > > nebius { > > region = "" > > bucket_name = "" > > > > # Either: > > access_key { > > access_key_id = "" > > } > > # Or, for anonymous access: > > # anonymous {} > > } > > # Optional: > > prefix = "" > > } > > > > destination { > > nebius { > > region = "" > > bucket_name = "" > > > > access_key { > > access_key_id = "" > > } > > } > > # Optional: > > prefix = "" > > } > > > > sensitive = { > > source = { > > nebius = { > > access_key = { > > secret_access_key = ephemeral.nebius_iam_v2_access_key_secret.ak_secret.secret > > } > > } > > } > > destination = { > > nebius = { > > access_key = { > > secret_access_key = ephemeral.nebius_iam_v2_access_key_secret.ak_secret.secret > > } > > } > > } > > } > > > > # Either: > > after_one_iteration {} > > # Or: > > # after_n_empty_iterations { > > # empty_iterations_threshold = > > # } > > # Or: > > # infinite {} > > # > > # inter_iteration_interval = "" # Optional. For example, "1h20m40s" > > > > overwrite_strategy = "NEVER" # Or "IF_NEWER" > > enable_deletes_in_destination = false > > touch_unmanaged = false # Optional > > > > limiters { > > requests_per_second = > > bandwidth_bytes_per_second = > > } > > } > > ``` > > > [accordion] Nebius AI Cloud to another storage service > > > > ```hcl > > ephemeral "nebius_mysterybox_v1_secret_payload_entry" "transfer_secret" { > > secret_id = "" > > key = "" > > } > > > > resource "nebius_storage_v1_transfer" "my_transfer" { > > name = "" > > parent_id = local.transfer_project_id > > > > source { > > nebius { > > region = "" > > bucket_name = "" > > > > # Either: > > access_key { > > access_key_id = "" > > } > > # Or, for anonymous access: > > # anonymous {} > > } > > # Optional: > > prefix = "" > > } > > > > destination { > > s3_compatible { > > endpoint = "" > > region = "" > > bucket_name = "" > > > > # Either: > > access_key { > > access_key_id = "" > > } > > # Or, for anonymous access: > > # anonymous {} > > } > > # Optional: > > prefix = "" > > } > > > > sensitive = { > > source = { > > nebius = { > > access_key = { > > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > > } > > } > > } > > destination = { > > s3_compatible = { > > access_key = { > > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > > } > > } > > } > > } > > > > # Either: > > after_one_iteration {} > > # Or: > > # after_n_empty_iterations { > > # empty_iterations_threshold = > > # } > > # Or: > > # infinite {} > > # > > # inter_iteration_interval = "" # Optional. For example, "1h20m40s" > > > > overwrite_strategy = "NEVER" # Or "IF_NEWER" > > enable_deletes_in_destination = false > > touch_unmanaged = false # Optional > > > > limiters { > > requests_per_second = > > bandwidth_bytes_per_second = > > } > > } > > ``` > > > [accordion] Azure Blob Storage to Nebius AI Cloud > > > > ```hcl > > ephemeral "nebius_mysterybox_v1_secret_payload_entry" "transfer_secret" { > > secret_id = "" > > key = "" > > } > > > > resource "nebius_storage_v1_transfer" "my_transfer" { > > name = "" > > parent_id = local.transfer_project_id > > > > source { > > azure_blob_storage { > > endpoint = "" > > container_name = "" > > > > # Either: > > azure_storage_account { > > account_name = "" > > } > > # Or, for anonymous access: > > # anonymous {} > > } > > # Optional: > > prefix = "" > > } > > > > destination { > > nebius { > > region = "" > > bucket_name = "" > > > > access_key { > > access_key_id = "" > > } > > } > > # Optional: > > prefix = "" > > } > > > > sensitive = { > > source = { > > azure_blob_storage = { > > azure_storage_account = { > > access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > > } > > } > > } > > destination = { > > nebius = { > > access_key = { > > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > > } > > } > > } > > } > > > > # Either: > > after_one_iteration {} > > # Or: > > # after_n_empty_iterations { > > # empty_iterations_threshold = > > # } > > # Or: > > # infinite {} > > # > > # inter_iteration_interval = "" # Optional. For example, "1h20m40s" > > > > overwrite_strategy = "NEVER" # Or "IF_NEWER" > > enable_deletes_in_destination = false > > touch_unmanaged = false # Optional > > > > limiters { > > requests_per_second = > > bandwidth_bytes_per_second = > > } > > } > > ``` > > > [accordion] Another storage service to Nebius AI Cloud > > > > ```hcl > > ephemeral "nebius_mysterybox_v1_secret_payload_entry" "transfer_secret" { > > secret_id = "" > > key = "" > > } > > > > resource "nebius_storage_v1_transfer" "my_transfer" { > > name = "" > > parent_id = local.transfer_project_id > > > > source { > > s3_compatible { > > endpoint = "" > > region = "" > > bucket_name = "" > > > > # Either: > > access_key { > > access_key_id = "" > > } > > # Or, for anonymous access: > > # anonymous {} > > } > > # Optional: > > prefix = "" > > } > > > > destination { > > nebius { > > region = "" > > bucket_name = "" > > > > access_key { > > access_key_id = "" > > } > > } > > # Optional: > > prefix = "" > > } > > > > sensitive = { > > source = { > > s3_compatible = { > > access_key = { > > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > > } > > } > > } > > destination = { > > nebius = { > > access_key = { > > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > > } > > } > > } > > } > > > > # Either: > > after_one_iteration {} > > # Or: > > # after_n_empty_iterations { > > # empty_iterations_threshold = > > # } > > # Or: > > # infinite {} > > # > > # inter_iteration_interval = "" # Optional. For example, "1h20m40s" > > > > overwrite_strategy = "NEVER" # Or "IF_NEWER" > > enable_deletes_in_destination = false > > touch_unmanaged = false # Optional > > > > limiters { > > requests_per_second = > > bandwidth_bytes_per_second = > > } > > } > > ``` > > > [!NOTE] > > > > The examples use the same secret for the source and destination. If needed, provide different secrets for each side. > > For details, see: > > * [Examples](https://docs.nebius.com/object-storage/transfer/launch.md#examples) > * [Reference](https://docs.nebius.com/terraform-provider/reference/resources/storage_v1_transfer.md) for the `nebius_storage_v1_transfer` resource > * [Transfer configuration](https://docs.nebius.com/object-storage/transfer/stop-condition.md) > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Create a one-time transfer between two Nebius AI Cloud buckets: > > ```go > srcAccessKey := &storage.TransferCredentialsAccessKey{ > AccessKeyId: "", > SecretAccessKey: "", > } > srcCredentials := > &storage.TransferSource_NebiusProvider_AccessKey{ > AccessKey: srcAccessKey, > } > dstAccessKey := &storage.TransferCredentialsAccessKey{ > AccessKeyId: "", > SecretAccessKey: "", > } > dstCredentials := > &storage.TransferDestination_NebiusProvider_AccessKey{ > AccessKey: dstAccessKey, > } > stopCondition := &storage.TransferSpec_AfterOneIteration{ > AfterOneIteration: > &storage.TransferSpec_StopConditionAfterOneIteration{}, > } > transferSvc := sdk.Services().Storage().V1().Transfer() > transferOp, err := transferSvc.Create( > ctx, > &storage.CreateTransferRequest{ > Metadata: &common.ResourceMetadata{ > Name: "launch-transfer-test", > ParentId: "", > }, > Spec: &storage.TransferSpec{ > Source: &storage.TransferSource{ > Provider: &storage.TransferSource_Nebius{ > Nebius: &storage.TransferSource_NebiusProvider{ > Region: "eu-north1", > BucketName: "", > Credentials: srcCredentials, > }, > }, > }, > Destination: &storage.TransferDestination{ > Provider: > &storage.TransferDestination_Nebius{ > Nebius: > &storage.TransferDestination_NebiusProvider{ > Region: "eu-north1", > BucketName: "", > Credentials: dstCredentials, > }, > }, > }, > StopCondition: stopCondition, > OverwriteStrategy: storage.TransferSpec_NEVER, > }, > }, > ) > if err != nil { > return err > } > if _, err = transferOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `AccessKeyId`: Access key ID for the source bucket and for the destination bucket. > * `SecretAccessKey`: Secret access key for the source bucket and for the destination bucket. > * `Metadata.ParentId`: Project ID. > * `BucketName` in the source: Source bucket name. > * `BucketName` in the destination: Destination bucket name. > > The example names the transfer `launch-transfer-test`, uses the `eu-north1` region for both buckets, stops after one iteration, and sets `OverwriteStrategy` to `TransferSpec_NEVER`. > [tab] Python SDK > > Create a one-time transfer between two Nebius AI Cloud buckets: > > ```python > transfer_service = TransferServiceClient(sdk) > stop_condition = TransferSpec__StopConditionAfterOneIteration() > transfer_operation = await transfer_service.create( > CreateTransferRequest( > metadata=ResourceMetadata( > name="launch-transfer-test", > parent_id="", > ), > spec=TransferSpec( > source=TransferSource( > nebius=TransferSource__NebiusProvider( > region="eu-north1", > bucket_name="", > access_key=TransferCredentialsAccessKey( > access_key_id="", > secret_access_key="", > ), > ), > ), > destination=TransferDestination( > nebius=TransferDestination__NebiusProvider( > region="eu-north1", > bucket_name="", > access_key=TransferCredentialsAccessKey( > access_key_id="", > secret_access_key="", > ), > ), > ), > after_one_iteration=stop_condition, > overwrite_strategy=TransferSpec.OverwriteStrategy.NEVER, > ), > ), > ) > await transfer_operation.wait() > ``` > > In the code, set the following parameters: > > * `access_key_id`: Access key ID for the source bucket and for the destination bucket. > * `secret_access_key`: Secret access key for the source bucket and for the destination bucket. > * `metadata.parent_id`: Project ID. > * `bucket_name` in the source: Source bucket name. > * `bucket_name` in the destination: Destination bucket name. > > The example names the transfer `launch-transfer-test`, uses the `eu-north1` region for both buckets, sets `after_one_iteration`, and sets `overwrite_strategy` to `TransferSpec.OverwriteStrategy.NEVER`. > [tab] JavaScript SDK > > Create a one-time transfer between two Nebius AI Cloud buckets: > > ```ts > const transferService = new TransferService(sdk); > const transferOperation = await transferService.create( > CreateTransferRequest.create({ > metadata: ResourceMetadata.create({ > name: "launch-transfer-test", > parentId: "", > }), > spec: TransferSpec.create({ > source: TransferSource.create({ > provider: { > $case: "nebius", > nebius: TransferSource_NebiusProvider.create({ > region: "eu-north1", > bucketName: "", > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "", > secretAccessKey: "", > }), > }, > }), > }, > }), > destination: TransferDestination.create({ > provider: { > $case: "nebius", > nebius: TransferDestination_NebiusProvider.create({ > region: "eu-north1", > bucketName: "", > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "", > secretAccessKey: "", > }), > }, > }), > }, > }), > stopCondition: { > $case: "afterOneIteration", > afterOneIteration: > TransferSpec_StopConditionAfterOneIteration.create(), > }, > overwriteStrategy: TransferSpec_OverwriteStrategy.NEVER, > }), > }), > ).result; > await transferOperation.wait(); > ``` > > In the code, set the following parameters: > > * `accessKeyId`: Access key ID for the source bucket and for the destination bucket. > * `secretAccessKey`: Secret access key for the source bucket and for the destination bucket. > * `metadata.parentId`: Project ID. > * `bucketName` in the source: Source bucket name. > * `bucketName` in the destination: Destination bucket name. > > The example names the transfer `launch-transfer-test`, uses the `eu-north1` region for both buckets, sets `stopCondition` to `afterOneIteration`, and sets `overwriteStrategy` to `TransferSpec_OverwriteStrategy.NEVER`. ## Examples ### One-time transfer between Nebius AI Cloud regions The following configuration examples show how to create a one-time transfer (a transfer that stops after one iteration) from a bucket in the `eu-north1` region to a bucket in the `us-central1` region: > [tab] Web console > > Create the data transfer in the project in `us-central1` where the destination bucket is located: > > * **Type**: One-time transfer > > * **Source**: Nebius > > * **Region**: `eu-north1` > * **Bucket name** (example): `source_bucket` > * **Credentials**: [Access and secret keys](https://docs.nebius.com/iam/service-accounts/access-keys.md) > > * **Destination**: Nebius > > * **Region**: `us-central1` > * **Bucket name** (example): `destination_bucket` > * **Credentials**: Access and secret keys > * **Overwriting destination objects**: Overwrite if source is newer > * **Deleting destination objects**: Do not delete > [tab] CLI > > The `.metadata.parent_id` parameter should be the ID of the project in `us-central1` that contains the destination bucket. > > ```json > { > "metadata": { > "name": "eu-north1-to-us-central1-transfer", > "parent_id": "project-***" > }, > "spec": { > "source": { > "nebius": { > "region": "eu-north1", > "bucket_name": "source_bucket", > "access_key": { > "access_key_id": "****", > "secret_access_key": "****" > } > } > }, > "destination": { > "nebius": { > "region": "us-central1", > "bucket_name": "destination_bucket", > "access_key": { > "access_key_id": "****", > "secret_access_key": "****" > } > } > }, > "after_one_iteration": {}, > "overwrite_strategy": "IF_NEWER", > "enable_deletes_in_destination": false > } > } > ``` > [tab] Terraform > > The `parent_id` parameter should be the ID of the project in `us-central1` that contains the destination bucket. > > ```hcl > ephemeral "nebius_iam_v2_access_key_secret" "ak_secret" { > aws_access_key_id = "****" > } > > resource "nebius_storage_v1_transfer" "my_transfer" { > name = "eu-north1-to-us-central1-transfer" > parent_id = "project-***" > > source { > nebius { > region = "eu-north1" > bucket_name = "source_bucket" > access_key { > access_key_id = "****" > } > } > } > > destination { > nebius { > region = "us-central1" > bucket_name = "destination_bucket" > access_key { > access_key_id = "****" > } > } > } > > sensitive = { > source = { > nebius = { > access_key = { > secret_access_key = ephemeral.nebius_iam_v2_access_key_secret.ak_secret.secret > } > } > } > destination = { > nebius = { > access_key = { > secret_access_key = ephemeral.nebius_iam_v2_access_key_secret.ak_secret.secret > } > } > } > } > > after_one_iteration {} > > overwrite_strategy = "IF_NEWER" > enable_deletes_in_destination = false > } > ``` > [tab] Go SDK > > The `Metadata.ParentId` parameter should be the ID of the project in `us-central1` that contains the destination bucket. > > ```go > srcAccessKey := &storage.TransferCredentialsAccessKey{ > AccessKeyId: "****", > SecretAccessKey: "****", > } > srcCredentials := > &storage.TransferSource_NebiusProvider_AccessKey{ > AccessKey: srcAccessKey, > } > dstAccessKey := &storage.TransferCredentialsAccessKey{ > AccessKeyId: "****", > SecretAccessKey: "****", > } > dstCredentials := > &storage.TransferDestination_NebiusProvider_AccessKey{ > AccessKey: dstAccessKey, > } > stopCondition := &storage.TransferSpec_AfterOneIteration{ > AfterOneIteration: > &storage.TransferSpec_StopConditionAfterOneIteration{}, > } > transferSvc := sdk.Services().Storage().V1().Transfer() > transferOp, err := transferSvc.Create( > ctx, > &storage.CreateTransferRequest{ > Metadata: &common.ResourceMetadata{ > Name: "eu-north1-to-us-central1-transfer", > ParentId: "project-***", > }, > Spec: &storage.TransferSpec{ > Source: &storage.TransferSource{ > Provider: &storage.TransferSource_Nebius{ > Nebius: &storage.TransferSource_NebiusProvider{ > Region: "eu-north1", > BucketName: "source_bucket", > Credentials: srcCredentials, > }, > }, > }, > Destination: &storage.TransferDestination{ > Provider: > &storage.TransferDestination_Nebius{ > Nebius: > &storage.TransferDestination_NebiusProvider{ > Region: "us-central1", > BucketName: "destination_bucket", > Credentials: dstCredentials, > }, > }, > }, > StopCondition: stopCondition, > OverwriteStrategy: storage.TransferSpec_IF_NEWER, > EnableDeletesInDestination: false, > }, > }, > ) > if err != nil { > return err > } > if _, err = transferOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > The `metadata.parent_id` parameter should be the ID of the project in `us-central1` that contains the destination bucket. > > ```python > transfer_service = TransferServiceClient(sdk) > stop_condition = ( > TransferSpec__StopConditionAfterOneIteration() > ) > transfer_operation = await transfer_service.create( > CreateTransferRequest( > metadata=ResourceMetadata( > name="eu-north1-to-us-central1-transfer", > parent_id="project-***", > ), > spec=TransferSpec( > source=TransferSource( > nebius=TransferSource__NebiusProvider( > region="eu-north1", > bucket_name="source_bucket", > access_key=TransferCredentialsAccessKey( > access_key_id="****", > secret_access_key="****", > ), > ), > ), > destination=TransferDestination( > nebius=TransferDestination__NebiusProvider( > region="us-central1", > bucket_name="destination_bucket", > access_key=TransferCredentialsAccessKey( > access_key_id="****", > secret_access_key="****", > ), > ), > ), > after_one_iteration=stop_condition, > overwrite_strategy=( > TransferSpec.OverwriteStrategy.IF_NEWER > ), > enable_deletes_in_destination=False, > ), > ), > ) > await transfer_operation.wait() > ``` > [tab] JavaScript SDK > > The `metadata.parentId` parameter should be the ID of the project in `us-central1` that contains the destination bucket. > > ```ts > const transferService = new TransferService(sdk); > const transferOperation = await transferService.create( > CreateTransferRequest.create({ > metadata: ResourceMetadata.create({ > name: "eu-north1-to-us-central1-transfer", > parentId: "project-***", > }), > spec: TransferSpec.create({ > source: TransferSource.create({ > provider: { > $case: "nebius", > nebius: TransferSource_NebiusProvider.create({ > region: "eu-north1", > bucketName: "source_bucket", > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "****", > secretAccessKey: "****", > }), > }, > }), > }, > }), > destination: TransferDestination.create({ > provider: { > $case: "nebius", > nebius: TransferDestination_NebiusProvider.create({ > region: "us-central1", > bucketName: "destination_bucket", > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "****", > secretAccessKey: "****", > }), > }, > }), > }, > }), > stopCondition: { > $case: "afterOneIteration", > afterOneIteration: > TransferSpec_StopConditionAfterOneIteration.create(), > }, > overwriteStrategy: > TransferSpec_OverwriteStrategy.IF_NEWER, > enableDeletesInDestination: false, > }), > }), > ).result; > await transferOperation.wait(); > ``` ### Replication between Nebius AI Cloud regions The following configuration examples show how to create a replication (a continuous transfer that you stop manually) from a bucket in the `us-central1` region to a bucket in the `eu-north1` region: > [tab] Web console > > Create the data transfer in the project in `eu-north1` where the destination bucket is located: > > * **Type**: Replication > > * **Source**: Nebius > > * **Region**: `us-central1` > * **Bucket name** (example): `primary_bucket` > * **Credentials**: [Access and secret keys](https://docs.nebius.com/iam/service-accounts/access-keys.md) > > * **Destination**: Nebius > > * **Region**: `eu-north1` > * **Bucket name** (example): `secondary_bucket` > * **Credentials**: Access and secret keys > * **Overwriting destination objects**: Overwrite if source is newer > * **Deleting destination objects**: Delete if not in source > [tab] CLI > > The `.metadata.parent_id` parameter should be the ID of the project in `eu-north1` that contains the destination bucket. > > ```json > { > "metadata": { > "name": "us-central1-to-eu-north1-backup", > "parent_id": "project-***" > }, > "spec": { > "source": { > "nebius": { > "region": "us-central1", > "bucket_name": "primary_bucket", > "access_key": { > "access_key_id": "****", > "secret_access_key": "****" > } > } > }, > "destination": { > "nebius": { > "region": "eu-north1", > "bucket_name": "secondary_bucket", > "access_key": { > "access_key_id": "****", > "secret_access_key": "****" > } > } > }, > "infinite": {}, > "overwrite_strategy": "IF_NEWER", > "enable_deletes_in_destination": true > } > } > ``` > [tab] Terraform > > The `parent_id` parameter should be the ID of the project in `eu-north1` that contains the destination bucket. > > ```hcl > ephemeral "nebius_iam_v2_access_key_secret" "ak_secret" { > aws_access_key_id = "****" > } > > resource "nebius_storage_v1_transfer" "my_transfer" { > name = "us-central1-to-eu-north1-backup" > parent_id = "project-***" > > source { > nebius { > region = "us-central1" > bucket_name = "primary_bucket" > access_key { > access_key_id = "****" > } > } > } > > destination { > nebius { > region = "eu-north1" > bucket_name = "secondary_bucket" > access_key { > access_key_id = "****" > } > } > } > > sensitive = { > source = { > nebius = { > access_key = { > secret_access_key = ephemeral.nebius_iam_v2_access_key_secret.ak_secret.secret > } > } > } > destination = { > nebius = { > access_key = { > secret_access_key = ephemeral.nebius_iam_v2_access_key_secret.ak_secret.secret > } > } > } > } > > infinite {} > overwrite_strategy = "IF_NEWER" > enable_deletes_in_destination = true > } > ``` > [tab] Go SDK > > The `Metadata.ParentId` parameter should be the ID of the project in `eu-north1` that contains the destination bucket. > > ```go > srcAccessKey := &storage.TransferCredentialsAccessKey{ > AccessKeyId: "****", > SecretAccessKey: "****", > } > srcCredentials := > &storage.TransferSource_NebiusProvider_AccessKey{ > AccessKey: srcAccessKey, > } > dstAccessKey := &storage.TransferCredentialsAccessKey{ > AccessKeyId: "****", > SecretAccessKey: "****", > } > dstCredentials := > &storage.TransferDestination_NebiusProvider_AccessKey{ > AccessKey: dstAccessKey, > } > stopCondition := &storage.TransferSpec_Infinite{ > Infinite: &storage.TransferSpec_StopConditionInfinite{}, > } > transferSvc := sdk.Services().Storage().V1().Transfer() > transferOp, err := transferSvc.Create( > ctx, > &storage.CreateTransferRequest{ > Metadata: &common.ResourceMetadata{ > Name: "us-central1-to-eu-north1-backup", > ParentId: "project-***", > }, > Spec: &storage.TransferSpec{ > Source: &storage.TransferSource{ > Provider: &storage.TransferSource_Nebius{ > Nebius: &storage.TransferSource_NebiusProvider{ > Region: "us-central1", > BucketName: "primary_bucket", > Credentials: srcCredentials, > }, > }, > }, > Destination: &storage.TransferDestination{ > Provider: > &storage.TransferDestination_Nebius{ > Nebius: > &storage.TransferDestination_NebiusProvider{ > Region: "eu-north1", > BucketName: "secondary_bucket", > Credentials: dstCredentials, > }, > }, > }, > StopCondition: stopCondition, > OverwriteStrategy: storage.TransferSpec_IF_NEWER, > EnableDeletesInDestination: true, > }, > }, > ) > if err != nil { > return err > } > if _, err = transferOp.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > The `metadata.parent_id` parameter should be the ID of the project in `eu-north1` that contains the destination bucket. > > ```python > transfer_service = TransferServiceClient(sdk) > stop_condition = TransferSpec__StopConditionInfinite() > transfer_operation = await transfer_service.create( > CreateTransferRequest( > metadata=ResourceMetadata( > name="us-central1-to-eu-north1-backup", > parent_id="project-***", > ), > spec=TransferSpec( > source=TransferSource( > nebius=TransferSource__NebiusProvider( > region="us-central1", > bucket_name="primary_bucket", > access_key=TransferCredentialsAccessKey( > access_key_id="****", > secret_access_key="****", > ), > ), > ), > destination=TransferDestination( > nebius=TransferDestination__NebiusProvider( > region="eu-north1", > bucket_name="secondary_bucket", > access_key=TransferCredentialsAccessKey( > access_key_id="****", > secret_access_key="****", > ), > ), > ), > infinite=stop_condition, > overwrite_strategy=( > TransferSpec.OverwriteStrategy.IF_NEWER > ), > enable_deletes_in_destination=True, > ), > ), > ) > await transfer_operation.wait() > ``` > [tab] JavaScript SDK > > The `metadata.parentId` parameter should be the ID of the project in `eu-north1` that contains the destination bucket. > > ```ts > const transferService = new TransferService(sdk); > const transferOperation = await transferService.create( > CreateTransferRequest.create({ > metadata: ResourceMetadata.create({ > name: "us-central1-to-eu-north1-backup", > parentId: "project-***", > }), > spec: TransferSpec.create({ > source: TransferSource.create({ > provider: { > $case: "nebius", > nebius: TransferSource_NebiusProvider.create({ > region: "us-central1", > bucketName: "primary_bucket", > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "****", > secretAccessKey: "****", > }), > }, > }), > }, > }), > destination: TransferDestination.create({ > provider: { > $case: "nebius", > nebius: TransferDestination_NebiusProvider.create({ > region: "eu-north1", > bucketName: "secondary_bucket", > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "****", > secretAccessKey: "****", > }), > }, > }), > }, > }), > stopCondition: { > $case: "infinite", > infinite: TransferSpec_StopConditionInfinite.create(), > }, > overwriteStrategy: > TransferSpec_OverwriteStrategy.IF_NEWER, > enableDeletesInDestination: true, > }), > }), > ).result; > await transferOperation.wait(); > ``` # Managing data transfers Source: https://docs.nebius.com/object-storage/transfer/manage.md After you [create](https://docs.nebius.com/object-storage/transfer/launch.md) a data transfer, you can modify certain parameters, stop and resume it, or delete it. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > > Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## How to modify a data transfer You can modify certain parameters of an existing data transfer: * Name * [Credentials](https://docs.nebius.com/object-storage/transfer/access.md#credentials) and [object key prefixes](https://docs.nebius.com/object-storage/transfer/key-prefixes.md) for both the source and destination buckets * [Transfer type or stop condition](https://docs.nebius.com/object-storage/transfer/stop-condition.md) * Inter-iteration interval * [Settings for handling destination objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md) * [Limits on request rate and bandwidth](https://docs.nebius.com/object-storage/transfer/limits.md) Changes may require several minutes to take effect, during which the old settings could still be in use temporarily. You cannot change the names or endpoints of the source and destination buckets of a data transfer. To modify a data transfer: > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Data Transfer**. > 2. Open the page of the data transfer that you want to modify. > 3. Switch to the **Settings** tab. > 4. Modify the parameters and click **Save changes**. > [tab] CLI > > 1. To get the data transfer ID, get a list of data transfers: > ```bash > nebius storage transfer list > ``` > The data transfer ID is returned in the `.metadata.id` parameter. > 2. Update the data transfer. For example, to change credentials for the source bucket in Nebius AI Cloud, run the following command: > > ```bash > nebius storage transfer update \ > --source-nebius-access-key-access-key-id \ > --source-nebius-access-key-secret-access-key > ``` > > For more information about the command parameters, see the [command reference](https://docs.nebius.com/cli/reference/storage/transfer/update.md). > [tab] Terraform > > 1. Modify the [nebius\_storage\_v1\_transfer](https://docs.nebius.com/terraform-provider/reference/resources/storage_v1_transfer.md) resource in your Terraform configuration. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Update credentials for the source bucket in Nebius AI Cloud: > > ```go > updateSvc := sdk.Services().Storage().V1().Transfer() > transfer, err := updateSvc.Get( > ctx, > &storage.GetTransferRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > transfer.Spec.Source.GetNebius().Credentials = > &storage.TransferSource_NebiusProvider_AccessKey{ > AccessKey: &storage.TransferCredentialsAccessKey{ > AccessKeyId: "", > SecretAccessKey: "", > }, > } > updateOp, err := updateSvc.Update( > ctx, > &storage.UpdateTransferRequest{ > Metadata: transfer.Metadata, > Spec: transfer.Spec, > }, > ) > if err != nil { > return err > } > if _, err = updateOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Data transfer ID. > * `AccessKeyId`: Access key ID for the source bucket. > * `SecretAccessKey`: Secret access key for the source bucket. > [tab] Python SDK > > Update credentials for the source bucket in Nebius AI Cloud: > > ```python > transfer_service = TransferServiceClient(sdk) > transfer = await transfer_service.get( > GetTransferRequest(id=""), > ) > transfer.spec.source.nebius.access_key = ( > TransferCredentialsAccessKey( > access_key_id="", > secret_access_key="", > ) > ) > update_operation = await transfer_service.update( > UpdateTransferRequest( > metadata=transfer.metadata, > spec=transfer.spec, > ), > ) > await update_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Data transfer ID. > * `access_key_id`: Access key ID for the source bucket. > * `secret_access_key`: Secret access key for the source bucket. > [tab] JavaScript SDK > > Update credentials for the source bucket in Nebius AI Cloud: > > ```ts > const updateTransferService = new TransferService(sdk); > const transfer = await updateTransferService.get( > GetTransferRequest.create({ id: "" }), > ).result; > transfer.spec.source.provider.nebius.credentials = { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "", > secretAccessKey: "", > }), > }; > const updateOperation = await updateTransferService.update( > UpdateTransferRequest.create({ > metadata: transfer.metadata, > spec: transfer.spec, > }), > ).result; > await updateOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Data transfer ID. > * `accessKeyId`: Access key ID for the source bucket. > * `secretAccessKey`: Secret access key for the source bucket. ## How to stop and resume a data transfer When you stop a data transfer, all ongoing uploads of objects and their parts are canceled. When you resume a data transfer, it starts a new [iteration](https://docs.nebius.com/object-storage/transfer/overview.md#iterations). > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Data Transfer**. > 2. Next to the name of the data transfer, click  → **Stop** or **Resume**. > 3. Confirm the action. > [tab] CLI > > 1. To get the data transfer ID, get a list of data transfers: > ```bash > nebius storage transfer list > ``` > The data transfer ID is returned in the `.metadata.id` parameter. > > 2. To stop the data transfer, run the following command: > > ```bash > nebius storage transfer stop > ``` > > 3. To resume the data transfer, run the following command: > > ```bash > nebius storage transfer resume > ``` > [tab] Go SDK > > 1. Stop the data transfer: > > ```go > stopSvc := sdk.Services().Storage().V1().Transfer() > stopOp, err := stopSvc.Stop( > ctx, > &storage.StopTransferRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = stopOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Id` to the data transfer ID. > > 2. Resume the data transfer: > > ```go > resumeSvc := sdk.Services().Storage().V1().Transfer() > resumeOp, err := resumeSvc.Resume( > ctx, > &storage.ResumeTransferRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = resumeOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Id` to the data transfer ID. > [tab] Python SDK > > 1. Stop the data transfer: > > ```python > transfer_service = TransferServiceClient(sdk) > stop_operation = await transfer_service.stop( > StopTransferRequest(id=""), > ) > await stop_operation.wait() > ``` > > In the code, set `id` to the data transfer ID. > > 2. Resume the data transfer: > > ```python > transfer_service = TransferServiceClient(sdk) > resume_operation = await transfer_service.resume( > ResumeTransferRequest(id=""), > ) > await resume_operation.wait() > ``` > > In the code, set `id` to the data transfer ID. > [tab] JavaScript SDK > > 1. Stop the data transfer: > > ```ts > const stopTransferService = new TransferService(sdk); > const stopOperation = await stopTransferService.stop( > StopTransferRequest.create({ id: "" }), > ).result; > await stopOperation.wait(); > ``` > > In the code, set `id` to the data transfer ID. > > 2. Resume the data transfer: > > ```ts > const resumeTransferService = new TransferService(sdk); > const resumeOperation = await resumeTransferService.resume( > ResumeTransferRequest.create({ id: "" }), > ).result; > await resumeOperation.wait(); > ``` > > In the code, set `id` to the data transfer ID. ## How to delete a data transfer When you delete a data transfer, Object Storage stops it before deletion. Transferred objects are not affected. > [tab] Web console > > 1. In the sidebar, go to  **Storage** → **Data Transfer**. > 2. Next to the name of the data transfer, click  → **Delete**. > 3. Confirm the action. > [tab] CLI > > 1. To get the data transfer ID, get a list of data transfers: > ```bash > nebius storage transfer list > ``` > The data transfer ID is returned in the `.metadata.id` parameter. > 2. Delete the data transfer: > > ```bash > nebius storage transfer delete > ``` > [tab] Terraform > > 1. Remove the corresponding `nebius_storage_v1_transfer` resource from the configuration file. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Delete the data transfer: > > ```go > deleteSvc := sdk.Services().Storage().V1().Transfer() > deleteOp, err := deleteSvc.Delete( > ctx, > &storage.DeleteTransferRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deleteOp.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set `Id` to the data transfer ID. > [tab] Python SDK > > Delete the data transfer: > > ```python > transfer_service = TransferServiceClient(sdk) > delete_operation = await transfer_service.delete( > DeleteTransferRequest(id=""), > ) > await delete_operation.wait() > ``` > > In the code, set `id` to the data transfer ID. > [tab] JavaScript SDK > > Delete the data transfer: > > ```ts > const deleteTransferService = new TransferService(sdk); > const deleteOperation = await deleteTransferService.delete( > DeleteTransferRequest.create({ id: "" }), > ).result; > await deleteOperation.wait(); > ``` > > In the code, set `id` to the data transfer ID. # Data transfer types and stop conditions Source: https://docs.nebius.com/object-storage/transfer/stop-condition.md Data transfers are based on consecutive [iterations](https://docs.nebius.com/object-storage/transfer/overview.md#iterations). Each iteration passes the source and destination buckets once. You can configure the number of iterations and the interval between them. To do so: * Specify the data transfer type if you [launch the data transfer](https://docs.nebius.com/object-storage/transfer/launch.md) in the web console. * Set the stop condition if you launch the data transfer by using the CLI or other developer tools. ## Data transfer type (web console) When you create a data transfer in the web console, you can select the *data transfer type*: * **One-time transfer**: Data transfer is completed after just one iteration. One-time transfers are designed for data migration and backup. * **Replication**: Iterations continue until you stop or delete the data transfer. Replications are designed for continuous synchronization between a source and a destination. ## Stop condition (developer tools) When you use the CLI or other developer tools to create a data transfer, set a *stop condition* in the data transfer configuration. This condition specifies when the data transfer should stop. The configuration must include exactly one of the following options: * `.spec.after_one_iteration` (same as the **One-time transfer** type): Transfer stops after completing its first iteration. The value should be an empty object. > [tab] CLI > > ```json > { > "spec": { > "after_one_iteration": {}, > // Other parameters > } > } > ``` > [tab] Terraform > > ```hcl > resource "nebius_storage_v1_transfer" "one_time_transfer" { > stop_condition { > after_one_iteration = true > } > # Other parameters > } > ``` > [tab] Go SDK > > ```go > spec := &storage.TransferSpec{ > StopCondition: &storage.TransferSpec_AfterOneIteration{ > AfterOneIteration: &storage.TransferSpec_StopConditionAfterOneIteration{}, > }, > // Other parameters > } > ``` > [tab] Python SDK > > ```python > spec = TransferSpec( > after_one_iteration=TransferSpec__StopConditionAfterOneIteration(), > # Other parameters > ) > ``` > [tab] JavaScript SDK > > ```javascript > const spec = TransferSpec.create({ > stopCondition: { > $case: "afterOneIteration", > afterOneIteration: TransferSpec_StopConditionAfterOneIteration.create(), > }, > // Other parameters > }); > ``` * `.spec.after_n_empty_iterations`: Transfer stops after a number of consecutive [empty iterations](https://docs.nebius.com/object-storage/transfer/overview.md#empty-iterations). For example, after five iterations: > [tab] CLI > > ```json > { > "spec": { > "after_n_empty_iterations": { > "empty_iterations_threshold": 5 > }, > // Other parameters > } > } > ``` > [tab] Terraform > > ```hcl > resource "nebius_storage_v1_transfer" "empty_iterations_transfer" { > stop_condition { > after_n_empty_iterations { > empty_iterations_threshold = 5 > } > } > # Other parameters > } > ``` > [tab] Go SDK > > ```go > spec := &storage.TransferSpec{ > StopCondition: &storage.TransferSpec_AfterNEmptyIterations{ > AfterNEmptyIterations: &storage.TransferSpec_StopConditionAfterNEmptyIterations{ > EmptyIterationsThreshold: 5, > }, > }, > // Other parameters > } > ``` > [tab] Python SDK > > ```python > spec = TransferSpec( > after_n_empty_iterations=TransferSpec__StopConditionAfterNEmptyIterations( > empty_iterations_threshold=5, > ), > # Other parameters > ) > ``` > [tab] JavaScript SDK > > ```javascript > const spec = TransferSpec.create({ > stopCondition: { > $case: "afterNEmptyIterations", > afterNEmptyIterations: TransferSpec_StopConditionAfterNEmptyIterations.create({ > emptyIterationsThreshold: 5, > }), > }, > // Other parameters > }); > ``` * `.spec.infinite` (same as the **Replication** type): Transfer continues indefinitely until manually stopped. > [tab] CLI > > ```json > { > "spec": { > "infinite": {}, > // Other parameters > } > } > ``` > [tab] Terraform > > ```hcl > resource "nebius_storage_v1_transfer" "infinite_transfer" { > stop_condition { > infinite = true > } > # Other parameters > } > ``` > [tab] Go SDK > > ```go > spec := &storage.TransferSpec{ > StopCondition: &storage.TransferSpec_Infinite{ > Infinite: &storage.TransferSpec_StopConditionInfinite{}, > }, > // Other parameters > } > ``` > [tab] Python SDK > > ```python > spec = TransferSpec( > infinite=TransferSpec__StopConditionInfinite(), > # Other parameters > ) > ``` > [tab] JavaScript SDK > > ```javascript > const spec = TransferSpec.create({ > stopCondition: { > $case: "infinite", > infinite: TransferSpec_StopConditionInfinite.create(), > }, > // Other parameters > }); > ``` ## Interval between iterations For data transfers with more than one iteration, you can optionally configure an interval between iterations: > [tab] Web console > > In the [web console](https://console.nebius.com/datatransfer), this setting appears under **Interval between iterations** when you [create](https://docs.nebius.com/object-storage/transfer/launch.md) or [modify](https://docs.nebius.com/object-storage/transfer/manage.md) a data transfer. > [tab] CLI > > ```json > { > "spec": { > "inter_iteration_interval": "" > // Other parameters > } > } > ``` > > In the value, specify the number of hours, minutes, and seconds for the interval. For example, `1h20m40s`. > [tab] Terraform > > ```hcl > resource "nebius_storage_v1_transfer" "example_transfer" { > inter_iteration_interval = "" > # Other parameters > } > ``` > > In the value, specify the number of hours, minutes, and seconds for the interval. For example, `1h20m40s`. > [tab] Go SDK > > Set `InterIterationInterval` to a Protocol Buffer duration. The example waits 1 hour, 20 minutes, and 40 seconds. `durationpb` is `google.golang.org/protobuf/types/known/durationpb`: > > ```go > interval := 1*time.Hour + 20*time.Minute + 40*time.Second > spec := &storage.TransferSpec{ > InterIterationInterval: durationpb.New(interval), > // Other parameters > } > ``` > [tab] Python SDK > > Set `inter_iteration_interval` to a `timedelta`. The example waits 1 hour, 20 minutes, and 40 seconds: > > ```python > from datetime import timedelta > > spec = TransferSpec( > inter_iteration_interval=timedelta( > hours=1, > minutes=20, > seconds=40, > ), > # Other parameters > ) > ``` > [tab] JavaScript SDK > > Set `interIterationInterval` to a Day.js duration. The example waits 1 hour, 20 minutes, and 40 seconds: > > ```javascript > import dayjs from "dayjs"; > import duration from "dayjs/plugin/duration.js"; > > dayjs.extend(duration); > const spec = TransferSpec.create({ > interIterationInterval: dayjs.duration({ > hours: 1, > minutes: 20, > seconds: 40, > }), > // Other parameters > }); > ``` # Access to buckets for data transfers Source: https://docs.nebius.com/object-storage/transfer/access.md When you [create a data transfer](https://docs.nebius.com/object-storage/transfer/launch.md), you provide credentials that Object Storage uses to access the buckets. These credentials belong to accounts in storage services, such as [service accounts](https://docs.nebius.com/iam/overview.md#accounts-and-members) in Nebius AI Cloud. The accounts perform actions on buckets and objects during the data transfer, so these accounts must have sufficient permissions to perform these actions. ## Required permissions Before you [launch a data transfer](https://docs.nebius.com/object-storage/transfer/launch.md), make sure that the service accounts at the source and destination have sufficient permissions to perform operations on buckets and objects. In Nebius AI Cloud, you can [add a service account to a group](https://docs.nebius.com/iam/authorization/groups/members.md) and either assign this group [roles](https://docs.nebius.com/iam/authorization/roles.md) with necessary permissions listed below, or set up [bucket policies](https://docs.nebius.com/object-storage/buckets/bucket-policy.md) for the group. The table below lists the actions that must be permitted and the minimum roles that grant these permissions to accounts: | Transfer side | Actions | Minimum Nebius AI Cloud roles | | - | - | - | | Source | `ListObjects`, `HeadObject`, `GetObject` | `storage.object-lister` + `storage.object-viewer` (combination) or `storage.viewer` (single role) | | Destination | `HeadObject`, `PutObject`, `CreateMultipartUpload`, `UploadPart`, `CompleteMultipartUpload` | `storage.object-viewer` + `storage.uploader` (combination) or `storage.object-editor` (single role) | | Destination (if [deleting destination objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#deleting-destination-objects) is enabled) | Destination actions listed above, plus `ListObjects` and `DeleteObject` | `storage.object-editor` (single role) or `storage.editor` (single role) | For more information about these actions, see [Iterations](https://docs.nebius.com/object-storage/transfer/overview.md#iterations). ## Credentials Provide credentials when you create a data transfer. The account (such as a [service account](https://docs.nebius.com/iam/overview.md#accounts-and-members)) uses the credentials to access buckets and objects and operate with them. ### Credentials for S3-compatible storage services For a bucket in Object Storage or another S3-compatible storage service, the required credentials are a pair of keys called *access and secret keys*, also known as *access key ID and secret access key*. Add these credentials to the transfer configuration when you [create](https://docs.nebius.com/object-storage/transfer/launch.md) or [modify](https://docs.nebius.com/object-storage/transfer/manage.md) a data transfer: > [tab] Web console > > In the [web console](https://console.nebius.com/datatransfer), settings for credentials appear under **Source** and **Destination** when you create or modify a data transfer. To enter the access and secret keys, under **Credentials**, select **Access and secret keys**. > [tab] CLI > > Use `.{source,destination}.{nebius,s3_compatible}.access_key` to add credentials. For example, when you're transferring data from a Nebius AI Cloud bucket (`.spec.source.nebius`) to an S3-compatible bucket (`.spec.destination.s3_compatible`), add credentials like this: > > ```json > { > "spec": { > "source": { > "nebius": { > "access_key": { > "access_key_id": "", > "secret_access_key": "" > }, > // Other source parameters > } > }, > "destination": { > "s3_compatible": { > "access_key": { > "access_key_id": "", > "secret_access_key": "" > }, > // Other destination parameters > } > }, > // Other parameters > } > } > ``` > > Set the values of `.spec.{source,destination}.{nebius,s3_compatible}.access_key.{access_key_id,secret_access_key}` securely, for example, by using environment variables. > [tab] Terraform > > Use `{source,destination}.{nebius,s3_compatible}.access_key` to add credentials. For example, when you're transferring data from a Nebius AI Cloud bucket (`source.nebius`) to an S3-compatible bucket (`destination.s3_compatible`), add credentials like this: > > ```hcl > ephemeral "nebius_mysterybox_v1_secret_payload_entry" "transfer_secret" { > secret_id = "" > key = "" > } > > resource "nebius_storage_v1_transfer" "example" { > source { > nebius { > access_key { > access_key_id = var.source_access_key_id > } > } > # Other source parameters > } > > destination { > s3_compatible { > access_key { > access_key_id = var.destination_access_key_id > } > } > # Other destination parameters > } > > sensitive = { > source = { > nebius = { > access_key = { > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > } > } > } > destination = { > s3_compatible = { > access_key = { > secret_access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > } > } > } > } > > # Other parameters > } > ``` > > For `nebius_storage_v1_transfer`, we recommend retrieving credentials for storage services through Terraform ephemeral resource blocks and passing them through write-only `sensitive` fields so they aren't stored in the Terraform state. For more information, see [Working with sensitive values](https://docs.nebius.com/terraform-provider/sensitive-values.md). > > You can also use regular [input variables](https://developer.hashicorp.com/terraform/language/values/variables), but the credential values are then stored in Terraform plan and state files, which is less secure. > [tab] Go SDK > > Set `Credentials` on the Nebius AI Cloud source and the S3-compatible destination. For example: > > ```go > source := &storage.TransferSource{ > Provider: &storage.TransferSource_Nebius{ > Nebius: &storage.TransferSource_NebiusProvider{ > Credentials: &storage.TransferSource_NebiusProvider_AccessKey{ > AccessKey: &storage.TransferCredentialsAccessKey{ > AccessKeyId: "", > SecretAccessKey: "", > }, > }, > // Other source parameters > }, > }, > } > destination := &storage.TransferDestination{ > Provider: &storage.TransferDestination_S3Compatible{ > S3Compatible: &storage.TransferDestination_S3CompatibleProvider{ > Credentials: &storage.TransferDestination_S3CompatibleProvider_AccessKey{ > AccessKey: &storage.TransferCredentialsAccessKey{ > AccessKeyId: "", > SecretAccessKey: "", > }, > }, > // Other destination parameters > }, > }, > } > ``` > > * `AccessKeyId`: Access key ID for the source bucket and for the destination bucket. > * `SecretAccessKey`: Secret access key for the source bucket and for the destination bucket. Set this value securely, for example, by using environment variables. > [tab] Python SDK > > Set `access_key` on the Nebius AI Cloud source and the S3-compatible destination. For example: > > ```python > source = TransferSource( > nebius=TransferSource__NebiusProvider( > access_key=TransferCredentialsAccessKey( > access_key_id="", > secret_access_key="", > ), > # Other source parameters > ), > ) > destination = TransferDestination( > s3_compatible=TransferDestination__S3CompatibleProvider( > access_key=TransferCredentialsAccessKey( > access_key_id="", > secret_access_key="", > ), > # Other destination parameters > ), > ) > ``` > > * `access_key_id`: Access key ID for the source bucket and for the destination bucket. > * `secret_access_key`: Secret access key for the source bucket and for the destination bucket. Set this value securely, for example, by using environment variables. > [tab] JavaScript SDK > > Set `credentials` on the Nebius AI Cloud source and the S3-compatible destination. For example: > > ```javascript > const source = TransferSource.create({ > provider: { > $case: "nebius", > nebius: TransferSource_NebiusProvider.create({ > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "", > secretAccessKey: "", > }), > }, > // Other source parameters > }), > }, > }); > const destination = TransferDestination.create({ > provider: { > $case: "s3Compatible", > s3Compatible: TransferDestination_S3CompatibleProvider.create({ > credentials: { > $case: "accessKey", > accessKey: TransferCredentialsAccessKey.create({ > accessKeyId: "", > secretAccessKey: "", > }), > }, > // Other destination parameters > }), > }, > }); > ``` > > * `accessKeyId`: Access key ID for the source bucket and for the destination bucket. > * `secretAccessKey`: Secret access key for the source bucket and for the destination bucket. Set this value securely, for example, by using environment variables. To get access and secret keys for an Object Storage bucket, [create access keys](https://docs.nebius.com/iam/service-accounts/access-keys.md) for a service account that has the [required permissions](https://docs.nebius.com/object-storage/transfer/access.md#required-permissions). ### Credentials for source containers in Azure Blob Storage If your source bucket ([container](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction#containers)) is in Azure Blob Storage, provide credentials of your [storage account in Azure](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview): the name and [access key](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage). Do not confuse a storage account with an Azure account. The storage account is used for data objects, such as blobs or files. > [tab] Web console > > In the [web console](https://console.nebius.com/datatransfer), settings for credentials appear under **Source** when you create or modify a data transfer and select **Azure** as the source type. To enter the storage account name and access key, under **Credentials**, select **Access key**. > [tab] CLI > > Use parameters in `.source.azure_blob_storage`: > > ```json > { > "spec": { > "source": { > "azure_blob_storage": { > "endpoint": "", > "container_name": "", > "azure_storage_account": { > "account_name": "", > "access_key": "" > } > } > }, > // Destination and other parameters > } > } > ``` > > * `.spec.source.azure_blob_storage.endpoint`: Endpoint of the Azure storage account in the format `https://.blob.core.windows.net`. > * `.spec.source.azure_blob_storage.container_name`: Name of the source container in Azure Blob Storage. > * `.spec.source.azure_blob_storage.azure_storage_account.account_name`: Name of the storage account. > * `.spec.source.azure_blob_storage.azure_storage_account.access_key`: Access key from Azure that the storage account uses for authentication. Set this value securely, for example, by using environment variables. > [tab] Terraform > > Use arguments in `source.azure_blob_storage`: > > ```hcl > ephemeral "nebius_mysterybox_v1_secret_payload_entry" "transfer_secret" { > secret_id = "" > key = "" > } > > resource "nebius_storage_v1_transfer" "example" { > source { > azure_blob_storage { > endpoint = var.source_storage_account_endpoint > container_name = var.source_container_name > > azure_storage_account { > account_name = var.source_storage_account_name > } > } > } > > sensitive = { > source = { > azure_blob_storage = { > azure_storage_account = { > access_key = ephemeral.nebius_mysterybox_v1_secret_payload_entry.transfer_secret.data.string_value > } > } > } > } > # Destination and other parameters > } > ``` > > * `source.azure_blob_storage.endpoint`: Endpoint of the Azure storage account in the format `https://.blob.core.windows.net`. > * `source.azure_blob_storage.container_name`: Name of the source container in Azure Blob Storage. > * `source.azure_blob_storage.azure_storage_account.account_name`: Name of the storage account. > * `source.azure_blob_storage.azure_storage_account.access_key`: Access key from Azure that the storage account uses for authentication. For `nebius_storage_v1_transfer`, we recommend retrieving this key through Terraform ephemeral resource blocks and passing it through write-only `sensitive` fields. For more information, see [Working with sensitive values](https://docs.nebius.com/terraform-provider/sensitive-values.md). You can also use an [input variable](https://developer.hashicorp.com/terraform/language/values/variables), but the key value is then stored in Terraform plan and state files, which is less secure. > [tab] Go SDK > > Set the Azure Blob Storage source like this: > > ```go > source := &storage.TransferSource{ > Provider: &storage.TransferSource_AzureBlobStorage{ > AzureBlobStorage: &storage.TransferSource_AzureBlobStorageProvider{ > Endpoint: "", > ContainerName: "", > Credentials: &storage.TransferSource_AzureBlobStorageProvider_AzureStorageAccount{ > AzureStorageAccount: &storage.TransferCredentialsAzureStorageAccount{ > AccountName: "", > AccessKey: "", > }, > }, > }, > }, > } > ``` > > * `Endpoint`: Endpoint of the Azure storage account in the format `https://.blob.core.windows.net`. > * `ContainerName`: Name of the source container in Azure Blob Storage. > * `AccountName`: Name of the storage account. > * `AccessKey`: Access key from Azure that the storage account uses for authentication. Set this value securely, for example, by using environment variables. > [tab] Python SDK > > Set the Azure Blob Storage source like this: > > ```python > source = TransferSource( > azure_blob_storage=TransferSource__AzureBlobStorageProvider( > endpoint="", > container_name="", > azure_storage_account=TransferCredentialsAzureStorageAccount( > account_name="", > access_key="", > ), > ), > ) > ``` > > * `endpoint`: Endpoint of the Azure storage account in the format `https://.blob.core.windows.net`. > * `container_name`: Name of the source container in Azure Blob Storage. > * `account_name`: Name of the storage account. > * `access_key`: Access key from Azure that the storage account uses for authentication. Set this value securely, for example, by using environment variables. > [tab] JavaScript SDK > > Set the Azure Blob Storage source like this: > > ```javascript > const source = TransferSource.create({ > provider: { > $case: "azureBlobStorage", > azureBlobStorage: TransferSource_AzureBlobStorageProvider.create({ > endpoint: "", > containerName: "", > credentials: { > $case: "azureStorageAccount", > azureStorageAccount: TransferCredentialsAzureStorageAccount.create({ > accountName: "", > accessKey: "", > }), > }, > }), > }, > }); > ``` > > * `endpoint`: Endpoint of the Azure storage account in the format `https://.blob.core.windows.net`. > * `containerName`: Name of the source container in Azure Blob Storage. > * `accountName`: Name of the storage account. > * `accessKey`: Access key from Azure that the storage account uses for authentication. Set this value securely, for example, by using environment variables. ### Anonymous access If a bucket has anonymous access enabled, meaning that all unauthenticated users have the [required permissions](https://docs.nebius.com/object-storage/transfer/access.md#required-permissions) in the bucket, you can skip providing credentials: > [tab] Web console > > In the [web console](https://console.nebius.com/datatransfer), settings for credentials appear under **Source** when you create or modify a data transfer. To set up anonymous access, under **Credentials**, select **Anonymous**. > [tab] CLI > > Use `{"anonymous": {}}` in `.spec.source.{nebius,s3_compatible,azure_blob_storage}` or `.spec.destination.s3_compatible`. For example, when you're transferring data from a Nebius AI Cloud bucket (`.spec.source.nebius`), set up anonymous access like this: > > ```json > { > "spec": { > "source": { > "nebius": { > "anonymous": {}, > // Other source parameters > } > }, > // Destination and other parameters > } > } > ``` > [tab] Terraform > > Use `anonymous {}` in `source.{nebius,s3_compatible,azure_blob_storage}` or `destination.s3_compatible`. For example, when you're transferring data from a Nebius AI Cloud bucket (`source.nebius`), set up anonymous access like this: > > ```hcl > resource "nebius_storage_v1_transfer" "example" { > source { > nebius { > anonymous {} > } > } > # Destination and other parameters > } > ``` > [tab] Go SDK > > Set `Credentials` to anonymous access on a Nebius AI Cloud, S3-compatible, or Azure Blob Storage source, or on an S3-compatible destination. For example, for a Nebius AI Cloud source: > > ```go > source := &storage.TransferSource{ > Provider: &storage.TransferSource_Nebius{ > Nebius: &storage.TransferSource_NebiusProvider{ > Credentials: &storage.TransferSource_NebiusProvider_Anonymous{ > Anonymous: &storage.TransferCredentialsAnonymous{}, > }, > // Other source parameters > }, > }, > } > ``` > [tab] Python SDK > > Set `anonymous` on a Nebius AI Cloud, S3-compatible, or Azure Blob Storage source, or on an S3-compatible destination. For example, for a Nebius AI Cloud source: > > ```python > source = TransferSource( > nebius=TransferSource__NebiusProvider( > anonymous=TransferCredentialsAnonymous(), > # Other source parameters > ), > ) > ``` > [tab] JavaScript SDK > > Set `credentials` to anonymous access on a Nebius AI Cloud, S3-compatible, or Azure Blob Storage source, or on an S3-compatible destination. For example, for a Nebius AI Cloud source: > > ```javascript > const source = TransferSource.create({ > provider: { > $case: "nebius", > nebius: TransferSource_NebiusProvider.create({ > credentials: { > $case: "anonymous", > anonymous: TransferCredentialsAnonymous.create(), > }, > // Other source parameters > }), > }, > }); > ``` Destination buckets in Nebius AI Cloud don't support the anonymous access setting because Object Storage doesn't allow anonymous write access. # Object key prefixes in data transfers Source: https://docs.nebius.com/object-storage/transfer/key-prefixes.md By default, all source objects are transferred in a data transfer, and their [keys](https://docs.nebius.com/object-storage/overview.md#keys-prefixes-and-object-hierarchy) are unchanged in the destination. You can optionally use source and destination prefixes to change this behavior: * *Source prefix* filters objects in the source bucket. * *Destination prefix* is added to keys of all transferred objects. > For example, if the source prefix is `test_dir/` and the destination prefix is `migration/`, the data transfer only works with source objects that have keys starting with `test_dir/`. In the destination, the data transfer replaces the `test_dir/` prefix in object keys with `migration/`. A source object named `test_dir/somefile.txt` becomes `migration/somefile.txt` in the destination. You can specify prefixes when you [create](https://docs.nebius.com/object-storage/transfer/launch.md) or [modify](https://docs.nebius.com/object-storage/transfer/manage.md) a data transfer: > [tab] Web console > > In the [web console](https://console.nebius.com/datatransfer), append prefixes to the names of the source and destination buckets (for example, `mybucket/test_dir/`). > [tab] CLI > > Set the `.spec.source.prefix` and `.spec.destination.prefix` parameters in your configuration file: > > ```json > { > "spec": { > "source": { > "prefix": "test_dir/" > }, > "destination": { > "prefix": "migration/" > } > } > } > ``` > [tab] Terraform > > Use the `prefix` argument in the `source` and `destination` blocks: > > ```hcl > resource "nebius_storage_v1_transfer" "example" { > source { > prefix = "test_dir/" > # Other source parameters > } > destination { > prefix = "migration/" > # Other destination parameters > } > # Other parameters > } > ``` > [tab] Go SDK > > Set `Prefix` on the source and the destination: > > ```go > source := &storage.TransferSource{ > Prefix: "test_dir/", > } > destination := &storage.TransferDestination{ > Prefix: "migration/", > } > ``` > [tab] Python SDK > > Set `prefix` on the source and the destination: > > ```python > source = TransferSource( > prefix="test_dir/", > ) > destination = TransferDestination( > prefix="migration/", > ) > ``` > [tab] JavaScript SDK > > Set `prefix` on the source and the destination: > > ```javascript > const source = TransferSource.create({ > prefix: "test_dir/", > }); > const destination = TransferDestination.create({ > prefix: "migration/", > }); > ``` # How data transfers handle destination objects Source: https://docs.nebius.com/object-storage/transfer/destination-objects.md By the time an iteration of a data transfer starts, the destination bucket may already contain objects. You can configure what Object Storage does with them: * [Overwrite objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#overwriting-destination-objects) that have a newer pair in the source. * [Delete objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#deleting-destination-objects) that no longer have a pair in the source. * Apply the overwrite/delete setting to [unmanaged objects](https://docs.nebius.com/object-storage/transfer/destination-objects.md#unmanaged-destination-objects) (objects in the destination that weren't transferred at previous iterations). ## Overwriting destination objects The setting to overwrite destination objects, also known as the *overwrite strategy* in the developer tools, determines what happens when the source and destination both contain an object with the same key. Depending on the setting's value, Object Storage overwrites the destination object with the source version or leaves it unchanged: * **Overwrite if source is newer**: Object Storage overwrites a destination object only if the source object has a newer timestamp (based on the `Last-Modified` header). This value is recommended for incremental synchronization. * **Do not overwrite**: Object Storage doesn't overwrite existing destination objects. If an object with the same key already exists in the destination, this source object is skipped. This is the safest option to avoid accidental data loss. You can configure overwriting objects when you [create](https://docs.nebius.com/object-storage/transfer/launch.md) a data transfer (but not for existing transfers): > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Data Transfer**. > 2. Click  **Create data transfer**. > 3. Select the overwriting setting under **Destination** → **Overwriting destination objects**. > [tab] CLI > > Set `.spec.overwrite_strategy` to one of the following values: > > * `IF_NEWER`: Overwrite if source is newer. > * `NEVER`: Do not overwrite. > > For example: > > ```json > { > "spec": { > "overwrite_strategy": "IF_NEWER" > } > } > ``` > [tab] Terraform > > Set the `overwrite_strategy` argument to one of the following values in your resource block: > > * `"IF_NEWER"`: Overwrite if source is newer. > * `"NEVER"`: Do not overwrite. > > For example: > > ```hcl > resource "nebius_storage_v1_transfer" "example" { > overwrite_strategy = "IF_NEWER" > # Other parameters > } > ``` > [tab] Go SDK > > Set `OverwriteStrategy` to one of the following values: > > * `TransferSpec_IF_NEWER`: Overwrite if source is newer. > * `TransferSpec_NEVER`: Do not overwrite. > > For example: > > ```go > spec := &storage.TransferSpec{ > OverwriteStrategy: storage.TransferSpec_IF_NEWER, > } > ``` > [tab] Python SDK > > Set `overwrite_strategy` to one of the following values: > > * `TransferSpec.OverwriteStrategy.IF_NEWER`: Overwrite if source is newer. > * `TransferSpec.OverwriteStrategy.NEVER`: Do not overwrite. > > For example: > > ```python > spec = TransferSpec( > overwrite_strategy=TransferSpec.OverwriteStrategy.IF_NEWER, > ) > ``` > [tab] JavaScript SDK > > Set `overwriteStrategy` to one of the following values: > > * `TransferSpec_OverwriteStrategy.IF_NEWER`: Overwrite if source is newer. > * `TransferSpec_OverwriteStrategy.NEVER`: Do not overwrite. > > For example: > > ```javascript > const spec = TransferSpec.create({ > overwriteStrategy: TransferSpec_OverwriteStrategy.IF_NEWER, > }); > ``` ## Deleting destination objects The *delete strategy* determines what happens to a destination object when its source pair no longer exists (the object was deleted from the source). * **Delete if not in source**: At each iteration the transfer deletes the destination object when it has no corresponding object in the source. Use this to keep the destination in synchronization with the source (for example, for a replication). * **Do not delete**: The transfer never deletes destination objects. Objects that exist only in the destination are left as-is. Use it for a backup or when you add extra objects that shouldn't be removed. You can configure deleting objects when you [create a data transfer](https://docs.nebius.com/object-storage/transfer/launch.md) (but not for existing transfers): > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Data Transfer**. > 2. Click  **Create data transfer**. > 3. Select the deleting setting under **Destination** → **Deleting destination objects**. > [tab] CLI > > Set `.spec.enable_deletes_in_destination` to `true` or `false`: > > * `true`: Delete if not in source. > * `false`: Do not delete. > > For example: > > ```json > { > "spec": { > "enable_deletes_in_destination": true > } > } > ``` > [tab] Terraform > > Set the `enable_deletes_in_destination` argument to one of the following values in your resource block: > > * `true`: Delete if not in source. > * `false`: Do not delete. > > For example: > > ```hcl > resource "nebius_storage_v1_transfer" "example" { > enable_deletes_in_destination = true > # Other parameters > } > ``` > [tab] Go SDK > > Set `EnableDeletesInDestination` to `true` or `false`: > > * `true`: Delete if not in source. > * `false`: Do not delete. > > For example: > > ```go > spec := &storage.TransferSpec{ > EnableDeletesInDestination: true, > } > ``` > [tab] Python SDK > > Set `enable_deletes_in_destination` to `True` or `False`: > > * `True`: Delete if not in source. > * `False`: Do not delete. > > For example: > > ```python > spec = TransferSpec( > enable_deletes_in_destination=True, > ) > ``` > [tab] JavaScript SDK > > Set `enableDeletesInDestination` to `true` or `false`: > > * `true`: Delete if not in source. > * `false`: Do not delete. > > For example: > > ```javascript > const spec = TransferSpec.create({ > enableDeletesInDestination: true, > }); > ``` ## Unmanaged destination objects *Unmanaged objects* are objects in the destination bucket that weren't copied from the source bucket during the current or past transfers. You can configure whether Object Storage can [overwrite](https://docs.nebius.com/object-storage/transfer/destination-objects.md#overwriting-destination-objects) them with source objects or [delete](https://docs.nebius.com/object-storage/transfer/destination-objects.md#deleting-destination-objects) them when they don't have pairs in the source: * **Allow overwriting/deleting**: Object Storage overwrites or deletes unmanaged destination objects. Use only when you're sure that you will not upload important data directly to the destination. * **Do not overwrite/delete** (default): Object Storage doesn't overwrite or delete unmanaged destination objects. Only destination objects that were copied from the source bucket during the current or past transfers are affected. > [accordion] Example > > Consider the following states of the source bucket and the destination bucket before the start of a transfer: > > **Source** > > * object\_1 > * object\_2 > * object\_3 > > **Destination** > > * object\_4 > > `object_4` in the destination is an unmanaged object. If the transfer is configured to delete destination objects that don't have pairs in the source, and allows overwriting/deleting unmanaged destination objects, `object_4` is deleted at the next iteration: > > **Source** > > * object\_1 > * object\_2 > * object\_3 > > **Destination** > > * object\_1 > * object\_2 > * object\_3 You can configure how to handle unmanaged objects when you [create a data transfer](https://docs.nebius.com/object-storage/transfer/launch.md) (but not for existing transfers): > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to  **Storage** → **Data Transfer**. > 2. Click  **Create data transfer**. > 3. Select the unmanaged objects setting under **Destination** → **Unmanaged objects**. > [tab] CLI > > Set the `.spec.touch_unmanaged` parameter: > > * `true`: Allow overwriting/deleting unmanaged destination objects. > * `false` (default): Do not overwrite/delete unmanaged destination objects. > > Example: > > ```json > { > "spec": { > "touch_unmanaged": false > } > } > ``` > [tab] Terraform > > Set the `touch_unmanaged` argument to one of the following values in your resource block: > > * `true`: Allow overwriting/deleting unmanaged destination objects. > * `false` (default): Do not overwrite/delete unmanaged destination objects. > > Example: > > ```hcl > resource "nebius_storage_v1_transfer" "example" { > touch_unmanaged = false > # Other parameters > } > ``` > [tab] Go SDK > > Set `TouchUnmanaged` to `true` or `false`: > > * `true`: Allow overwriting/deleting unmanaged destination objects. > * `false` (default): Do not overwrite/delete unmanaged destination objects. > > Example: > > ```go > spec := &storage.TransferSpec{ > TouchUnmanaged: false, > } > ``` > [tab] Python SDK > > Set `touch_unmanaged` to `True` or `False`: > > * `True`: Allow overwriting/deleting unmanaged destination objects. > * `False` (default): Do not overwrite/delete unmanaged destination objects. > > Example: > > ```python > spec = TransferSpec( > touch_unmanaged=False, > ) > ``` > [tab] JavaScript SDK > > Set `touchUnmanaged` to `true` or `false`: > > * `true`: Allow overwriting/deleting unmanaged destination objects. > * `false` (default): Do not overwrite/delete unmanaged destination objects. > > Example: > > ```javascript > const spec = TransferSpec.create({ > touchUnmanaged: false, > }); > ``` # Data transfer limits on request rate and bandwidth Source: https://docs.nebius.com/object-storage/transfer/limits.md Every data transfer has limits for request rate and bandwidth. You can set them when you [create](https://docs.nebius.com/object-storage/transfer/launch.md) or [modify](https://docs.nebius.com/object-storage/transfer/manage.md) a data transfer. The values of the limits represent maximum thresholds that a data transfer will not exceed. If you don't set the limits or set them to zero, the default values apply: * Request rate: 4000 requests per second. * Bandwidth: 50 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.)/s. The limits are useful in the following cases: * Your source provider imposes rate or bandwidth restrictions. * You need to reserve request capacity and bandwidth for other processes. The request rate and bandwidth cannot be unlimited, but you can set high values for them if you need large capacity. To set the limits for request rate and bandwidth: > [tab] Web console > > In the [web console](https://console.nebius.com/datatransfer), set transfer limits under **Destination**. Specify **Request rate limit** and **Bandwidth limit** with your desired values (for example, `1000` requests per second and `1073741824` bytes per second for 1 GiB/s) when you create or modify a data transfer. > [tab] CLI > > Use the `.spec.limiters.requests_per_second` and `.spec.limiters.bandwidth_bytes_per_second` parameters: > > ```json > { > "spec": { > "limiters": { > "requests_per_second": 1000, > "bandwidth_bytes_per_second": 1073741824 > }, > // Other parameters > } > } > ``` > [tab] Terraform > > Use the `limiters.requests_per_second` and `limiters.bandwidth_bytes_per_second` arguments: > > ```hcl > resource "nebius_storage_v1_transfer" "example" { > limiters { > requests_per_second = 1000 > bandwidth_bytes_per_second = 1073741824 > } > # Other parameters > } > ``` > [tab] Go SDK > > Set `Limiters.RequestsPerSecond` and `Limiters.BandwidthBytesPerSecond`: > > ```go > spec := &storage.TransferSpec{ > Limiters: &storage.TransferSpec_Limiters{ > RequestsPerSecond: 1000, > BandwidthBytesPerSecond: 1073741824, > }, > // Other parameters > } > ``` > [tab] Python SDK > > Set `limiters.requests_per_second` and `limiters.bandwidth_bytes_per_second`: > > ```python > spec = TransferSpec( > limiters=TransferSpec.Limiters( > requests_per_second=1000, > bandwidth_bytes_per_second=1073741824, > ), > # Other parameters > ) > ``` > [tab] JavaScript SDK > > Set `limiters.requestsPerSecond` and `limiters.bandwidthBytesPerSecond`. Both values are `Long` values from the `long` package: > > ```javascript > import Long from "long"; > > const spec = TransferSpec.create({ > limiters: TransferSpec_Limiters.create({ > requestsPerSecond: Long.fromNumber(1000), > bandwidthBytesPerSecond: Long.fromNumber(1073741824), > }), > // Other parameters > }); > ``` # Testing data transfer speed with Warp Source: https://docs.nebius.com/object-storage/transfer/testing-transfer-speed.md The data transfer service uses multiple threads and clients to maximize performance. As a result, testing the maximum transfer speed requires enough objects and data to keep these operations busy. Use at least 20,000 objects totaling about 20 TiB. The measured speed also depends on the network limitations of the source and destination endpoints. These instructions use [Warp](https://github.com/minio/warp) to test data transfer speed and generate a test dataset in Nebius Object Storage. To generate the dataset in another S3-compatible storage service, adapt the endpoint, bucket, and credential values to your provider. > [!WARNING] > > Nebius AI Cloud charges you for the test data that you store. When you no longer need the test data, [delete the objects](https://docs.nebius.com/object-storage/objects/manage.md#deleting-multiple-objects). For details, see [Pricing in Object Storage](https://docs.nebius.com/object-storage/resources/pricing.md#storing-data). ## Prerequisites 1. Install Warp: ```bash wget https://dl.min.io/aistor/warp/release/linux-amd64/warp chmod +x warp ``` 2. [Create an access key](https://docs.nebius.com/iam/service-accounts/access-keys.md) for a service account that can read and upload objects in the bucket. For example, assign the service account the [`storage.editor` role](https://docs.nebius.com/iam/authorization/roles#object-storage) for the bucket or its parent project. You need its AWS-like ID and secret key to generate the test dataset. When you create the access key by using the CLI, the AWS-like ID and secret key are specified in the `.status.aws_access_key_id` and `.status.secret` parameters of the output. To create an access key, make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role. 3. [Create an Object Storage bucket](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets). 4. Make sure that the project has enough [Object Storage quota](https://docs.nebius.com/object-storage/resources/quotas-limits.md#quotas) for about 20 TiB of test data. ## How to prepare a test dataset 1. Set the bucket endpoint, name and credentials as environment variables, and specify the ID of the [region](https://docs.nebius.com/overview/regions.md) that contains the bucket: ```bash export S3_ENDPOINT="storage..nebius.cloud:443" export S3_BUCKET="" export S3_ACCESS_KEY="" export S3_SECRET_KEY="" ``` 2. Generate the test dataset. Use the `--noclear` parameter to keep the generated objects in the bucket after the test: ```bash ./warp get \ --host "$S3_ENDPOINT" \ --tls \ --bucket "$S3_BUCKET" \ --access-key "$S3_ACCESS_KEY" \ --secret-key "$S3_SECRET_KEY" \ --objects 20000 \ --obj.size 1GiB \ --duration 1m \ --storage-class ENHANCED_THROUGHPUT \ --concurrent 32 \ --noclear ``` This command generates a test dataset of 20,000 objects, each 1 GiB in size, and keeps it in the bucket specified in the environment variables. The [Enhanced Throughput storage class](https://docs.nebius.com/object-storage/storage-classes.md#enhanced-throughput-storage-class) provides the best transfer speed. ## How to test data transfer speed 1. [Create and launch a one-time data transfer](https://docs.nebius.com/object-storage/transfer/launch.md) from the test bucket. 2. While the data transfer is running, [monitor the test bucket](https://docs.nebius.com/object-storage/monitoring.md). Use the **Traffic** metric, measured in bytes per second, to observe the transfer speed. # How to store a Terraform state in an Object Storage bucket Source: https://docs.nebius.com/object-storage/store-terraform-state.md When you create Nebius AI Cloud infrastructure by using a [Terraform provider](https://docs.nebius.com/terraform-provider/index.md), you declare the desired infrastructure state in `.tf` files. Next, Terraform applies the changes and stores the current infrastructure state in a `.tfstate` file. For shared environments or automated workflows, it is a good practice to store the `.tf` files under version control (for example, in a Git repository) and to store the `.tfstate` files in S3-compatible storage. As a result, several users or automation systems can access and update the same infrastructure state safely. Also, you can [lock the state](https://developer.hashicorp.com/terraform/language/state/locking) to prevent conflicting changes. In Nebius AI Cloud, you can store the `.tfstate` file in an [Object Storage bucket](https://docs.nebius.com/object-storage/overview.md#buckets). The Terraform state is uploaded to the bucket and is updated automatically every time you make changes in your resources in configuration files. ## Prerequisites 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. [Create a bucket](https://docs.nebius.com/object-storage/buckets/manage.md#create) to store the state. > [!NOTE] > > [Terraform](https://developer.hashicorp.com/terraform/language/backend/s3) recommends that you enable versioning for the bucket. However, storing multiple versions of objects in a bucket increases your [costs](https://docs.nebius.com/object-storage/resources/pricing.md). 3. [Create a service account](https://docs.nebius.com/iam/service-accounts/manage.md#create) that accesses the bucket. 4. [Create an access key](https://docs.nebius.com/iam/service-accounts/access-keys.md#create) for this service account and save the AWS-like ID and secret. 5. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. ## How to store the Terraform state file 1. Create a working directory on your local machine. If you intend to use version control, store this directory in a repository. 2. In this directory, create the `terraform.tf` file with the following contents: ```hcl terraform { required_providers { nebius = { source = "nebius/nebius" version = ">= 0.6.8" } } backend "s3" { bucket = "" key = "" region = "eu-north1" access_key = "" secret_key = "" endpoints = { s3 = "https://storage.eu-north1.nebius.cloud" } # Lock the state from concurrent modifications use_lockfile = true # These settings stop Terraform from AWS-specific checks # that are not relevant for Nebius AI Cloud skip_credentials_validation = true skip_region_validation = true skip_requesting_account_id = true skip_metadata_api_check = true } } ``` In this file, specify the following parameters: * `bucket`: Bucket name. * `key`: Path where the state should be stored, relative to the bucket root. * `access_key` and `secret_key`: AWS-like ID and secret to access the bucket. 3. Prepare the [authentication file](https://docs.nebius.com/terraform-provider/authentication.md) `provider "nebius" {}`. 4. Create configuration files for the infrastructure that you need to deploy. To get acquainted with an example of such infrastructure and files, see [How to create resources by using the Nebius AI Cloud provider for Terraform](https://docs.nebius.com/terraform-provider/manage/create-resources.md). 5. Initialize Terraform in the working directory: ```bash terraform init ``` 6. Check that the configuration is correct: ```bash terraform validate ``` 7. Apply the changes: ```bash terraform apply ``` Terraform creates the required infrastructure and stores its state in a `.tfstate` file that is placed in the bucket you specified. After that, when you want to update the infrastructure and change its configuration files, use the same `terraform.tf` file. When you run `terraform apply`, Terraform pulls the latest remote state from the bucket and shows the plan of the changes. # Working with Object Storage buckets and objects using the AWS CLI Source: https://docs.nebius.com/object-storage/interfaces/aws-cli.md Object Storage is compatible with the Amazon S3 API, which allows you to operate resources using AWS CLI. This Nebius AI Cloud reference shows you how to set up and configure AWS CLI and how to use it to work with [buckets](https://docs.nebius.com/object-storage/interfaces/aws-cli.md#working-with-buckets) and [objects](https://docs.nebius.com/object-storage/interfaces/aws-cli.md#working-with-objects) complemented with useful [parameters](https://docs.nebius.com/object-storage/interfaces/aws-cli.md#useful-parameters-for-aws-cli-commands) you can apply. For the list of supported Amazon S3 features and the few exceptions, see [Amazon S3 API Compatibility Reference](https://docs.nebius.com/object-storage/interfaces/s3-api-compatibility.md). ## Configuring AWS CLI This section explains how to create a service account, grant it access to manage your resources and set up the AWS CLI to perform actions on the service account's behalf. This section also covers other settings that connect the AWS CLI with Nebius AI Cloud and Object Storage. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [accordion] AWS CLI setup instructions > > 1. Create a service account and save its ID to an environment variable: > > ```bash > export SA_ID=$(nebius iam service-account create \ > --name object-storage-sa \ > --format jsonpath='{.metadata.id}') > ``` > > 2. Grant edit access to the service account: > > 1. Get the tenant ID: > > ```bash > export PROJECT_ID=$(nebius config get parent-id) > export TENANT_ID=$(nebius iam project get $PROJECT_ID --format jsonpath='{.metadata.parent_id}') > ``` > > 2. Get the ID of the default `editors` group: > > ```bash > export EDITORS_GROUP_ID=$(nebius iam group get-by-name \ > --name editors --parent-id $TENANT_ID \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Add the service account to `editors` group: > > ```bash > nebius iam group-membership create \ > --parent-id $EDITORS_GROUP_ID \ > --member-id $SA_ID > ``` > > 3. Create an [access key](https://docs.nebius.com/iam/service-accounts/access-keys.md) for the service account and get its AWS-like ID and contents: > > ```bash > export ACCESS_KEY_ID=$(nebius iam v2 access-key create \ > --account-service-account-id $SA_ID \ > --description 'AWS CLI' \ > --format json | jq -r '.metadata.id') > export ACCESS_KEY_AWS_ID=$(nebius iam v2 access-key get \ > --id $ACCESS_KEY_ID \ > --format json | jq -r '.status.aws_access_key_id') > export SECRET_ACCESS_KEY=$(nebius iam v2 access-key get \ > --id $ACCESS_KEY_ID \ > --format json | jq -r '.status.secret') > ``` > > 4. Add the key to the AWS CLI configuration: > > ```bash > aws configure set aws_access_key_id $ACCESS_KEY_AWS_ID > aws configure set aws_secret_access_key $SECRET_ACCESS_KEY > ``` > > 5. Depending on your project [region](https://docs.nebius.com/overview/regions.md), add the Nebius AI Cloud region ID and the Object Storage endpoint URL to the AWS CLI configuration: > > ```bash > aws configure set region > aws configure set endpoint_url https://storage..nebius.cloud > ``` > > For example, run the following commands for a project in `eu-north1`: > > ```bash > aws configure set region eu-north1 > aws configure set endpoint_url https://storage.eu-north1.nebius.cloud > ``` ## Working with buckets In Object Storage, you store your files in containers called *buckets*. ### Create a bucket Use the [s3 mb](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/mb.html) ("make bucket") command to create a bucket: ```bash aws s3 mb s3:// ``` > [accordion] Usage example > > Run: > > ```bash > aws s3 mb s3://example-bucket > ``` > > Output: > > ```bash > make_bucket: example-bucket > ``` ### List your buckets Use the [s3 ls](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/ls.html) ("LiSt") command to see all your available buckets: ```bash aws s3 ls ``` ### Delete a bucket Use the [s3 rb](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rb.html) ("remove bucket") command to delete an empty bucket: ```bash aws s3 rb s3:// ``` A bucket you want to delete must be completely empty. If you still have objects in your bucket, use the `--force` parameter to remove a non-empty bucket: ```bash aws s3 rb s3:// --force ``` > [accordion] Usage examples > > > [tab] Empty bucket > > > > Run: > > > > ```bash > > aws s3 rb s3://example-bucket > > ``` > > > > Output: > > > > ```bash > > remove_bucket: example-bucket > > ``` > > > [tab] Non-empty bucket (force delete) > > > > In this example, the bucket `example-bucket` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt`. > > > > Run: > > > > ```bash > > aws s3 rb s3://example-bucket --force > > ``` > > > > Output: > > > > ```bash > > delete: s3://example-bucket/euismod.txt > > delete: s3://example-bucket/litora.txt > > delete: s3://example-bucket/lorem.txt > > remove_bucket: example-bucket > > ``` ### Configure lifecycle rules You can use the AWS CLI to configure lifecycle rules for object expiration and storage-class transitions in a bucket. When you update a bucket lifecycle configuration, provide the full configuration in JSON, including all existing rules that you want to keep. If you omit a rule or some of its parameters, the new configuration replaces the old one and the omitted data is removed. To review the current lifecycle configuration of a bucket, run: ```bash aws s3api get-bucket-lifecycle-configuration --bucket ``` To change a lifecycle configuration, prepare a JSON file that states a new configuration and apply this file: ```bash aws s3api put-bucket-lifecycle-configuration \ --bucket \ --lifecycle-configuration file://lifecycle.json ``` > [accordion] Examples of JSON files > > > [tab] Expiration > > > > This example shows a lifecycle rule that deletes all objects in the bucket five days after their upload. > > > > ```json > > { > > "Rules": [ > > { > > "ID": "", > > "Status": "Enabled", > > "Filter": {}, > > "Expiration": { > > "Days": 5 > > } > > } > > ] > > } > > ``` > > > [tab] Transition of storage class > > > > This example shows a lifecycle rule that transitions objects with the `expiring/` prefix to the `STANDARD` storage class after 30 days. > > > > ```json > > { > > "Rules": [ > > { > > "ID": "", > > "Status": "Enabled", > > "Filter": { > > "Prefix": "expiring/" > > }, > > "Transitions": [ > > { > > "StorageClass": "STANDARD", > > "Days": 30 > > } > > ] > > } > > ] > > } > > ``` For more information, see [How to configure lifecycle rules in Object Storage](https://docs.nebius.com/object-storage/objects/configure-lifecycle-rules.md). ## Working with objects In Object Storage, you work with files and folders called *objects*. ### Upload objects > [!WARNING] > > The AWS CLI does not support uploading objects to a [storage class](https://docs.nebius.com/object-storage/storage-classes.md) that differs from the bucket's default. To do that, use [s5cmd](https://github.com/peak/s5cmd). For details, see [How to upload](https://docs.nebius.com/object-storage/objects/upload-download.md#how-to-upload). You can choose to upload a single file or a whole folder containing any number of files: > [tab] Single file > > Use the [s3 cp](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html) ("CoPy") command to upload a specified local file to your Object Storage bucket with a specified prefix: > > ```bash > aws s3 cp s3:/// > ``` > > > [accordion] Usage example > > > > Run: > > > > ```bash > > aws s3 cp lorem-ipsum/lorem.txt s3://example-bucket/lorem-ipsum/ > > ``` > > > > Output: > > > > ```bash > > upload: lorem-ipsum/lorem.txt to s3://example-bucket/lorem-ipsum/lorem.txt > > ``` > [tab] Folder > > There are two ways to upload the contents of a specified local folder to your Object Storage bucket with a specified prefix: > > * [s3 cp](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html) ("CoPy") command copies all the files from the source to the target: > > ```bash > aws s3 cp --recursive \ > s3:///[]/ > ``` > > The `--recursive` parameter used in the command above keeps copying files from the local folder until all available files have been copied. > > > [accordion] Usage example > > > > In this example, the local folder `lorem-ipsum/` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt`. > > > > Run: > > > > ```bash > > aws s3 cp lorem-ipsum/ s3://example-bucket/lorem-ipsum/ --recursive > > ``` > > > > Output: > > > > ```bash > > upload: lorem-ipsum/lorem.txt to s3://example-bucket/lorem-ipsum/lorem.txt > > upload: lorem-ipsum/litora.txt to s3://example-bucket/lorem-ipsum/litora.txt > > upload: lorem-ipsum/euismod.txt to s3://example-bucket/lorem-ipsum/euismod.txt > > ``` > > * [s3 sync](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/sync.html) command only copies new and updated files compared to the target: > > ```bash > aws s3 sync s3:///[]/ > ``` > > > [accordion] Usage example > > > > In this example, the local folder `lorem-ipsum/` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt`. > > > > Run: > > > > ```bash > > aws s3 sync lorem-ipsum/ s3://example-bucket/lorem-ipsum/ > > ``` > > > > Output: > > > > ```bash > > upload: lorem-ipsum/lorem.txt to s3://example-bucket/lorem-ipsum/lorem.txt > > upload: lorem-ipsum/litora.txt to s3://example-bucket/lorem-ipsum/litora.txt > > upload: lorem-ipsum/euismod.txt to s3://example-bucket/lorem-ipsum/euismod.txt > > ``` > > If the name of your local folder contains spaces, put it in single quotation marks. For example: `Documents/'My ML configurations'/`. ### List objects in your bucket Use the [s3 ls](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/ls.html) ("LiSt") command with a `` and a `[]` to see all your available objects: ```bash aws s3 ls s3:///[] --recursive --human-readable --summarize ``` The command contains the following parameters: * `--recursive` keeps listing objects in the bucket under all available object keys until all have been listed. * `--human-readable` clearly defines data capacity units and rounds them up if necessary. * `--summarize` below the list of objects, shows the total number and the total size of all the objects in the bucket. > [accordion] Usage example > > In this example, your Object Storage `example-bucket` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt` under the object key `lorem-ipsum/`. > > Run: > > ```bash > aws s3 ls s3://example-bucket/ --recursive --human-readable --summarize > ``` > > Output: > > ```bash > 2024-09-05 16:35:34 458 Bytes lorem-ipsum/euismod.txt > 2024-09-05 16:35:35 442 Bytes lorem-ipsum/litora.txt > 2024-09-05 16:35:35 505 Bytes lorem-ipsum/lorem.txt > > Total Objects: 3 > Total Size: 1.4 KiB > ``` ### Move objects between buckets Use the [s3 mv](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/mv.html) ("MoVe") command to copy objects with a specified prefix from the source bucket to another destination bucket with a new prefix within your Object Storage cluster, then remove the objects at the origin: ```bash aws s3 mv s3:///[]/ s3:///[]/ --recursive ``` The `--recursive` parameter used in the command above keeps listing objects in the bucket under all available object keys until all have been listed. > [accordion] Usage example > > In this example, your Object Storage `example-bucket` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt` under the object key `lorem-ipsum/`. You need to move these objects to `another-example-bucket` under the prefix `lorem-ipsum-mv/`. > > Run: > > ```bash > aws s3 mv s3://example-bucket/lorem-ipsum/ s3://another-example-bucket/lorem-ipsum-mv --recursive > ``` > > Output: > > ```bash > move: s3://example-bucket/lorem-ipsum/litora.txt to s3://another-example-bucket/lorem-ipsum-mv/litora.txt > move: s3://example-bucket/lorem-ipsum/lorem.txt to s3://another-example-bucket/lorem-ipsum-mv/lorem.txt > move: s3://example-bucket/lorem-ipsum/euismod.txt to s3://another-example-bucket/lorem-ipsum-mv/euismod.txt > ``` ### Download objects > [tab] Single object > > Use the [s3 cp](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html) ("CoPy") command to download a specified object with a prefix from your Object Storage bucket to a destination on your local machine: > > ```bash > aws s3 cp s3:/// > ``` > > You can set a different name for a file you want to download in ``. > > > [accordion] Usage example > > > > In this example, you'll download the `lorem.txt` file from the Object Storage `example-bucket` to the local `example-download/` folder as `lorem-download.txt`. > > > > Run: > > > > ```bash > > aws s3 cp s3://example-bucket/lorem-ipsum/lorem.txt example-download/lorem-download.txt > > ``` > > > > Output: > > > > ```bash > > download: s3://quickstart-bucket/lorem-ipsum/lorem.txt to example-download/lorem-download.txt > > ``` > [tab] All objects with a prefix > > There are two ways to download all the objects with a specified prefix from your Object Storage bucket to a destination on your local machine: > > * [s3 cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) ("CoPy") command copies all the objects with a specified prefix from your Object Storage bucket to a destination on your local machine: > > ```bash > aws s3 cp --recursive \ > s3:///[] > ``` > > > [accordion] Usage example > > > > In this example, your Object Storage `example-bucket` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt` under the object key `lorem-ipsum/`. They need to be downloaded into the local `example-download/` folder. > > > > Run: > > > > ```bash > > aws s3 cp --recursive s3://example-bucket/lorem-ipsum/ example-download/ > > ``` > > > > Output: > > > > ```bash > > download: s3://example-bucket/lorem-ipsum/lorem.txt to example-download/lorem.txt > > download: s3://example-bucket/lorem-ipsum/litora.txt to example-download/litora.txt > > download: s3://example-bucket/lorem-ipsum/euismod.txt to example-download/euismod.txt > > ``` > > * [s3 sync](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) command copies new and updated files from your Object Storage bucket compared to a destination on your local machine: > > ```bash > aws s3 sync s3:///[] > ``` > > > [accordion] Usage example > > > > In this example, your Object Storage `example-bucket` contains three text files: `lorem.txt`, `euismod.txt` and `litora.txt` under the object key `lorem-ipsum/`. They need to be downloaded into the local `example-download/` folder. > > > > Run: > > > > ```bash > > aws s3 sync s3://example-bucket/lorem-ipsum/ example-download/ > > ``` > > > > Output: > > > > ```bash > > download: s3://example-bucket/lorem-ipsum/lorem.txt to example-download/lorem.txt > > download: s3://example-bucket/lorem-ipsum/litora.txt to example-download/litora.txt > > download: s3://example-bucket/lorem-ipsum/euismod.txt to example-download/euismod.txt > > ``` If the name of your local folder contains spaces, put it in single quotation marks. For example: `Documents/'My ML configurations'/`. ### Delete objects Use the [s3 rm](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rm.html) ("ReMove") command to delete objects from your Object Storage bucket. > [tab] Single object > > ```bash > aws s3 rm s3:/// > ``` > [tab] All objects with a prefix > > ```bash > aws s3 rm s3:///[] --recursive > ``` > > The `--recursive` parameter used in the command above keeps deleting objects in the bucket under the specified object key until all have been deleted. ## Useful parameters for AWS CLI commands This section describes useful parameters you can use with most of the commands listed above. ### Include When you use the [s3 cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html), [s3 sync](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html), [s3 mv](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/mv.html) or [s3 rm](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rm.html) command, you can apply the `--include` parameter to set the rule to **only** include parameters specified. For example, your Object Storage bucket contains images and text files, but you want to download text files only. Set the rule as follows: ```bash aws s3 cp s3:///[] \ --recursive \ --include "*.txt" ``` In the command above: * `--recursive` copies all the objects available at the source. * `--include "*.txt"` applies the command only to `.txt` files. Note that you need to use multiple `--include` parameters to define more than one condition. ### Exclude When you use the [s3 cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html), [s3 sync](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html), [s3 mv](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/mv.html) or [s3 rm](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/rm.html) command, you can apply the `--exclude` parameter to set the rule to include all the files **except** the parameters specified. For example, your Object Storage bucket contains images in `.png` and `.jpg` formats together with text files, but you want to download text files only. Set the rule as follows: ```bash aws s3 cp s3:///[] \ --recursive \ --exclude "*.png" --exclude "*.jpg" ``` In the command above: * `--recursive` copies all the objects available at the source. * `--exclude "*.png" --exclude "*.jpg"` applies the command to all file formats except `.png` and `.jpg`. Note that you need to use multiple `--exclude` parameters to define more than one condition. # Mountpoint for Amazon S3: Mounting buckets as local filesystems Source: https://docs.nebius.com/object-storage/interfaces/mountpoint-s3.md [Mountpoint for Amazon S3](https://github.com/awslabs/mountpoint-s3) is an open-source client for mounting S3 buckets as local filesystems. You can use Mountpoint for Amazon S3 to mount Object Storage buckets to your local machines, and to resources in Nebius AI Cloud (Compute virtual machines, Kubernetes clusters) and other cloud providers. ## Use cases and limitations Mountpoint for Amazon S3 is optimized for specific use cases like machine learning training which often involve reading large datasets with high throughput. For example, it is a good fit for data lake applications that read large objects without using other filesystem features like locking or POSIX permissions, or write objects sequentially from a single node. Mountpoint for Amazon S3 achieves this by parallelizing requests, both to each single file and to multiple files. Tests in Nebius AI Cloud show that Mountpoint for Amazon S3 can show performance that is close to clients that natively implement S3 APIs. > [!WARNING] > > Mountpoint for Amazon S3 doesn't implement all features of a POSIX filesystem. This means certain file operations, such as file locks, directory renaming, symlinks, hardlinks and full control over file modes, owners and groups, are not fully supported or may behave differently than expected in a traditional filesystem. If your applications require these features or collaborative editing across multiple instances and users, use [Compute shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems). See [Mountpoint file system behavior](https://github.com/awslabs/mountpoint-s3/blob/main/doc/SEMANTICS.md) for a detailed description of Mountpoint for Amazon S3's behavior and POSIX support and how they could affect your application. To troubleshoot file operations that may not be supported by Mountpoint for Amazon S3, see the [troubleshooting documentation](https://github.com/awslabs/mountpoint-s3/blob/main/doc/TROUBLESHOOTING.md). ## Installing and mounting buckets ### Prerequisites 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. [Create a service account](https://docs.nebius.com/iam/service-accounts/manage.md) and [add it to a group](https://docs.nebius.com/iam/authorization/groups/members.md) that grants the required level of access, for example, the [default](https://docs.nebius.com/iam/authorization/groups.md#default-groups) `viewers` or `editors` group. 3. [Create an access key pair](https://docs.nebius.com/iam/service-accounts/access-keys.md) for the service account and save the key ID and the secret key. > [accordion] Example > > > [tab] CLI > > > > The following commands create a service account, add it to the default `viewers` group and create an access key for it. Specify your tenant and project IDs in the commands: > > > > * `TENANT_ID`: [Tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-cli). > > * `PROJECT_ID`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli). > > > > ```bash > > TENANT_ID= > > PROJECT_ID= > > > > export SA_ID=$(nebius iam service-account create \ > > --parent-id "$PROJECT_ID" \ > > --name s3-mountpoint \ > > --format jsonpath='{.metadata.id}') > > > > export VIEWERS_ID=$(nebius iam group get-by-name \ > > --parent-id "${TENANT_ID}" \ > > --name 'viewers' \ > > --format jsonpath='{.metadata.id}') > > nebius iam group-membership create \ > > --parent-id "$VIEWERS_ID" \ > > --member-id "$SA_ID" > > > > export ACCESS_KEY_ID=$(nebius iam v2 access-key create \ > > --parent-id "$PROJECT_ID" \ > > --name "s3-mountpoint" \ > > --account-service-account-id "$SA_ID" \ > > --description "Amazon S3 Mountpoint CSI Driver" \ > > --format jsonpath='{.metadata.id}') > > export AWS_ACCESS_KEY_ID=$(nebius iam v2 access-key get \ > > --id "${ACCESS_KEY_ID}" \ > > --format json \ > > | jq -r '.status.aws_access_key_id') > > export AWS_SECRET_ACCESS_KEY=$(nebius iam v2 access-key get \ > > --id "${ACCESS_KEY_ID}" \ > > --format json \ > > | jq -r '.status.secret') > > ``` ### Local and virtual machines > [!NOTE] > > Mountpoint for Amazon S3 is only available for Linux operating systems. To mount an Object Storage bucket on your local machine or a Compute VM: 1. Install Mountpoint for Amazon S3: > [tab] RPM-based (Fedora, CentOS, RHEL, etc.) > > ```bash > wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm > sudo yum install -y ./mount-s3.rpm > ``` > [tab] DEB-based (Ubuntu, Debian) > > ```bash > wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.deb > sudo apt-get install -y ./mount-s3.deb > ``` For more installation instructions and details, see [Getting started](https://github.com/awslabs/mountpoint-s3/tree/main?tab=readme-ov-file#getting-started) and [Installing Mountpoint for Amazon S3](https://github.com/awslabs/mountpoint-s3/blob/main/doc/INSTALL.md) in Mountpoint for Amazon S3 documentation. 2. Create a credentials file, `~/.aws/credentials`, with your access key pair: ```bash cat < ~/.aws/credentials [default] aws_access_key_id= aws_secret_access_key= ``` This ensures that the credentials are persistent between shell sessions. If you have the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables defined, they override `~/.aws/credentials`. For more details, see [AWS credentials](https://github.com/awslabs/mountpoint-s3/blob/main/doc/CONFIGURATION.md#aws-credentials) in Mountpoint for Amazon S3 documentation. 3. Mount the bucket: ```bash mount-s3 \ --region \ --endpoint-url https://storage..nebius.cloud:443 \ --maximum-throughput-gbps 10000 --max-threads 64 ``` Replace the following values: * ``: Name of your bucket. * ``: Path to the directory on your machine where the bucket should be mounted. * `--region`: [Nebius AI Cloud region](https://docs.nebius.com/overview/regions.md) where the parent project of your bucket is located. To get the region of a project, go to the [web console](https://console.nebius.com) and then expand the list of tenants; the region, for example `eu-north1`, is displayed next to the project's name. * `--endpoint-url`: Object Storage endpoint in the region. All the endpoints have the `https://storage..nebius.cloud:443` format. For example, for buckets in the `eu-north1` region, the endpoint is `https://storage.eu-north1.nebius.cloud:443`. `--maximum-throughput-gbps 10000` and `--max-threads 64` are recommended performance settings. For more details, see [Performance](https://docs.nebius.com/object-storage/interfaces/mountpoint-s3.md#performance). You can add more parameters to the command, for example, `--foreground` to run Mountpoint for Amazon S3 in the foreground instead of the background. For more details, see [Configuring Mountpoint for Amazon S3](https://github.com/awslabs/mountpoint-s3/blob/main/doc/CONFIGURATION.md). ### Kubernetes clusters > [!WARNING] > > Before making any changes to a production environment, [contact support](https://console.nebius.com/support/create-ticket) or your personal manager. 1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) and configure it to work with your cluster. For Managed Kubernetes clusters in Nebius AI Cloud, see [How to connect to Managed Service for Kubernetes® clusters using kubectl](https://docs.nebius.com/kubernetes/connect.md). 2. Create a Kubernetes Secret with your access key pair: ```bash kubectl create secret generic aws-secret \ --namespace kube-system \ --from-literal "key_id=" \ --from-literal "access_key=" ``` 3. [Install Helm](https://helm.sh/docs/intro/install/). 4. Install the Mountpoint for Amazon S3 CSI Driver: ```bash helm repo add aws-mountpoint-s3-csi-driver https://awslabs.github.io/mountpoint-s3-csi-driver helm repo update helm upgrade --install aws-mountpoint-s3-csi-driver \ --namespace kube-system \ aws-mountpoint-s3-csi-driver/aws-mountpoint-s3-csi-driver ``` For more installation details and instructions, see [Installing Mountpoint for Amazon S3 CSI Driver](https://github.com/awslabs/mountpoint-s3-csi-driver/blob/main/docs/INSTALL.md). 5. Create a PersistentVolume (PV): ```bash REGION= kubectl apply -f - < # Must be unique per volume volumeAttributes: bucketName: EOF ``` Replace the following values: * `REGION`: [Nebius AI Cloud region](https://docs.nebius.com/overview/regions.md) where the parent project of your bucket is located. To get the region of a project, go to the [web console](https://console.nebius.com) and then expand the list of tenants; the region, for example `eu-north1`, is displayed next to the project's name. * `.spec.accessModes`: List of [access modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) supported by the PV. Supported modes are `ReadOnlyMany` (multiple nodes can mount the PV as read-only) and `ReadWriteMany` (multiple nodes can mount the PV as read-write). > [!NOTE] > > If your application requires the `ReadWriteMany` mode, [contact support](https://console.nebius.com/support/create-ticket) before creating the PV. * `.spec.csi.volumeHandle`: String that identifies the PV. The volume handle must be unique for each volume in your cluster. * `.spec.csi.volumeAttributes.bucketName`: Name of your bucket. `.spec.mountOptions.maximum-throughput-gbps` and `.spec.mountOptions.max-threads` are recommended performance settings. For more details, see [Performance](https://docs.nebius.com/object-storage/interfaces/mountpoint-s3.md#performance). 6. Create a PersistentVolumeClaim (PVC): ```bash kubectl apply -f - <> /data/out.txt; sleep 5; done"] volumeMounts: - name: bucket mountPath: /data EOF ``` ## Performance To optimize performance when mounting buckets, you can configure the following parameters: ### maximum-throughput-gbps The `--maximum-throughput-gbps` parameter raises the maximum throughput limit. The default limit is 1.25 GB/s (10 Gbps). For example, to set it to 10000 Gbps: ```bash mount-s3 bucket ./bucket --maximum-throughput-gbps 10000 ``` In Kubernetes, specify this in the `mountOptions` of your PersistentVolume: ```yaml mountOptions: - maximum-throughput-gbps 10000 ``` ### max-threads The `--max-threads` parameter raises the maximum number of threads. The default is 16. For example, to set it to 64: ```bash mount-s3 bucket ./bucket --max-threads 64 ``` In Kubernetes, specify this in the `mountOptions` of your PersistentVolume: ```yaml mountOptions: - max-threads 64 ``` ### metadata-ttl The `--metadata-ttl` parameter controls how long metadata is cached. Consider setting it to 120 seconds for better performance. For example: ```bash mount-s3 bucket ./bucket --metadata-ttl 120 ``` For more information, see the [official documentation](https://github.com/awslabs/mountpoint-s3/blob/main/doc/CONFIGURATION.md#metadata-cache). ### UNSTABLE\_MOUNTPOINT\_MAX\_PREFETCH\_WINDOW\_SIZE If you need to maximize the throughput within a single file, you can set the `UNSTABLE_MOUNTPOINT_MAX_PREFETCH_WINDOW_SIZE` environment variable. For example: ```bash UNSTABLE_MOUNTPOINT_MAX_PREFETCH_WINDOW_SIZE=8589934592 mount-s3 bucket ./bucket ``` > [!WARNING] > > This feature is unstable and not recommended for default use, as it can lead to uncontrollable memory consumption. # Compatibility of Amazon S3 API with Object Storage Source: https://docs.nebius.com/object-storage/interfaces/s3-api-compatibility.md Object Storage is compatible with the Amazon S3 API, so you can use your existing S3 tools, SDKs, and workflows without additional configuration. This reference outlines the boundaries of that compatibility. For bucket-level operations such as creating buckets or enabling versioning, S3-compatible tools generally work, but [Nebius AI Cloud API](https://docs.nebius.com/grpc-api/index.md), [CLI](https://docs.nebius.com/cli/index.md), and [Terraform provider](https://docs.nebius.com/terraform-provider.md) offer the most complete feature coverage. ## Unsupported S3 features The following S3 features are not supported in Object Storage: * **Object ACLs**: Per-object access control lists are not supported. Use [bucket policies](https://docs.nebius.com/object-storage/buckets/bucket-policy.md) for access control. * **SSE-KMS and SSE-S3 encryption**: AWS-managed server-side encryption is not supported. All data stored in buckets is [encrypted](https://docs.nebius.com/security/encryption.md#buckets-in-object-storage) at both the service and infrastructure levels. * **Object Lock and Legal Hold**: Write-once-read-many (WORM) retention policies are not supported. * **S3 Select**: Query-in-place functionality is not supported. AWS has also discontinued S3 Select. * **Static website hosting**: Serving bucket contents as a static website is not supported. * **Bucket inventory**: S3 API actions for inventory configurations are not supported. To get scheduled reports on bucket contents, use [inventory configurations](https://docs.nebius.com/object-storage/buckets/inventory.md) in the [web console](https://console.nebius.com). * **Replication**: Cross-region and cross-bucket replication rules are not supported. Use [data transfers](https://docs.nebius.com/object-storage/transfer/overview.md) to replicate data between buckets. * **Event notifications**: S3 Event Notifications are not supported. * **Object Ownership**: S3 Object Ownership is not supported. ## Behavioral differences Object Storage behaves differently from S3 in the following cases: * **ETag format**: In some cases, Object Storage computes ETag values with a non-MD5 algorithm. The ETag still changes whenever the object's content changes, but it is not always the MD5 hash of that content, so don't rely on it for integrity checks. For regular buckets, use the checksum headers (`X-Amz-Checksum-*`) to verify object integrity instead. For [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md), ETags are not based on object content, and integrity checksums are not supported: objects with the same content can have different ETags, and objects with different content can have the same ETag. MD5-based ETags can be enabled per bucket for simple objects and multipart upload parts on request — [contact support](https://console.nebius.com/support/create-ticket) to discuss your use case. * **Conditional writes**: On `PutObject` requests that include `If-None-Match: "*"`, Object Storage checks whether the object exists *before* reading the request body, whereas S3 reads the full body first and checks the condition afterward. This reduces unnecessary data transfer when the condition fails, but a client that doesn't support the [Expect: 100-continue](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Expect) header might see unexpected errors. * **Plain HTTP access**: By default, Object Storage accepts S3 API requests over HTTPS only. For selected buckets, you can request [HTTP access](https://docs.nebius.com/object-storage/http-access.md) for object data requests, such as `GetObject`, `PutObject` and `ListObjects`, and for the following bucket information requests: `HeadBucket`, `GetBucketVersioning` and `GetBucketLocation`. * **Object versioning**: Only the current version of an object can have a `null` version ID. Once an object version becomes non-current, it's assigned a specific version identifier. * **ListObjectVersions**: In `ListObjectVersions` responses, the `NextKeyMarker` and `NextVersionIdMarker` fields are opaque tokens that are only valid when passed back exactly as received from the previous `ListObjectVersions` response. * **ListMultipartUploads**: `ListMultipartUploads` doesn't support the `delimiter` parameter, and common prefixes are not returned in responses. * **Lifecycle configuration**: The deprecated XML format is not supported. Use the current format described in [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html). ## Supported S3 API methods Object Storage supports the following S3 API methods. **Partial** means the method works with the limitation noted. | Method | Support | Notes | | - | - | - | | `GetObject` | Partial | For [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md), the `partNumber` parameter is not supported. | | `HeadObject` | Partial | For [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md), the `partNumber` parameter is not supported. | | `PutObject` | Yes | | | `CopyObject` | Yes | | | `DeleteObject` | Yes | | | `DeleteObjects` | Yes | | | `GetObjectACL` | No | | | `ListObjectsV2` | Yes | | | `ListObjects` | Partial | Supported for backward compatibility; `ListObjectsV2` is recommended. | | `ListObjectVersions` | Yes | | | `PostObject` | Partial | Supported for basic use cases. [Contact support](https://console.nebius.com/support/create-ticket) if your workload depends on this method. | | `GetObjectTagging` | Partial | Not supported for [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). | | `PutObjectTagging` | Partial | Not supported for [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). | | `DeleteObjectTagging` | Partial | Not supported for [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). | | `CreateMultipartUpload` | Yes | | | `UploadPart` | Yes | | | `UploadPartCopy` | Yes | | | `CompleteMultipartUpload` | Partial | For [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md), multipart uploads larger than 1 TB are not recommended. | | `AbortMultipartUpload` | Yes | | | `ListMultipartUploads` | Yes | | | `CreateBucket` | Yes | | | `HeadBucket` | Yes | | | `GetBucketLocation` | Yes | | | `GetBucketVersioning` | Yes | | | `PutBucketVersioning` | Partial | Not supported for [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). | | `GetBucketLifecycleConfiguration` | Yes | Only S3-compatible lifecycle rules are supported. | | `PutBucketLifecycleConfiguration` | Partial | Not supported for [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md). | | `PutBucketCORS` | Yes | | ## Supported S3 headers Object Storage supports the following S3-compatible HTTP headers: * `X-Amz-Copy-Source` * `X-Amz-Copy-Source-If-Match` * `X-Amz-Copy-Source-Range` * `X-Amz-Date` * `X-Amz-Delete-Marker` * `X-Amz-Expiration` * `X-Amz-Metadata-Directive` * `X-Amz-Mp-Parts-Count` * `X-Amz-Request-Id` * `X-Amz-Storage-Class` * `X-Amz-Version-Id` * `X-Amz-Bucket-Region` * `X-Amz-Meta-*` * `If-Match`: Supported in `GetObject`, `PutObject`, `DeleteObject` * `If-None-Match`: Supported in `GetObject`, `PutObject` * `If-Modified-Since`, `If-Unmodified-Since`: Supported in `GetObject` * `Access-Control-*` * `X-Amz-Checksum-*`: Not supported for [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md) > [!NOTE] > > For [filesystem buckets](https://docs.nebius.com/object-storage/buckets/filesystem-buckets.md), conditional requests with `If-*` headers have best-effort behavior: Object Storage can't atomically verify that an object wasn't modified between checking the condition and completing the operation. ## See also * [Working with Object Storage buckets and objects using the AWS CLI](https://docs.nebius.com/object-storage/interfaces/aws-cli.md) * [Actions supported by Object Storage roles](https://docs.nebius.com/object-storage/supported-actions.md) * [How data transfers work in Object Storage](https://docs.nebius.com/object-storage/transfer/overview.md) # HTTP access to the Object Storage S3 API Source: https://docs.nebius.com/object-storage/http-access.md By default, Object Storage accepts S3 API requests over HTTPS only. For selected buckets, you can request plain HTTP access and use `http://` instead of `https://` in the S3 API endpoint. Plain HTTP access can reduce encryption-related performance overhead in workloads that send many S3 API requests or use clients where TLS certificate configuration is resource-intensive. Use it only when the security tradeoff is acceptable, as HTTP doesn't encrypt object data, request metadata, or request headers in transit. ## How HTTP access works HTTP access is a bucket-level setting and is disabled by default. [Contact support](https://console.nebius.com/support/create-ticket) if you want to enable it for a specific bucket. When you request HTTP access, provide the bucket ID or name, the bucket [region](https://docs.nebius.com/overview/regions.md) and one of the following access modes: * **Disabled**: HTTP access is not allowed. This is the default mode. * **Region-local**: HTTP access is allowed only from Nebius AI Cloud virtual machines (VMs) in the same region as the bucket. Requests from other regions and from outside Nebius AI Cloud are rejected. * **All**: HTTP access is allowed from any source, including VMs in any region and clients outside Nebius AI Cloud. > [accordion] How to check the bucket HTTP access mode > > > [tab] Web console > > > > 1. Go to **Storage** → **Object Storage**. > > 2. On the **Buckets** tab, check the bucket label. Buckets with HTTP access enabled show **HTTP - Region** or **HTTP - All**. > > > [tab] CLI > > > > Run the following command: > > > > ```bash > > nebius storage bucket get --id storagebucket-e*** > > ``` > > > > The bucket's HTTP access mode is returned in the `.status.insecure_endpoint.mode` field: > > > > ```yaml highlight={9-10} > > metadata: > > id: storagebucket-e*** > > parent_id: project-e00*** > > name: > > resource_version: "1" > > ... > > status: > > ... > > insecure_endpoint: > > mode: REGION_LOCAL > > ``` After HTTP access is enabled, use the same Object Storage endpoint as for HTTPS, but replace `https://` with `http://`. > For example, if your HTTPS endpoint is `https://storage.eu-north1.nebius.cloud`, the HTTP endpoint is `http://storage.eu-north1.nebius.cloud`. ## Authentication Plain HTTP access supports only [access key pair](https://docs.nebius.com/iam/service-accounts/access-keys.md) authentication. > [!WARNING] > > Authentication with an IAM token is not allowed over HTTP because HTTP does not use encryption. If an application sends an IAM token over HTTP, consider the token compromised: revoke it and configure the application to use access key pair authentication instead. ## Supported requests Plain HTTP access is supported for S3 API requests that work with objects, such as `GetObject`, `PutObject`, `DeleteObject` or `ListObjects`. The following bucket information requests are also supported over HTTP: * `HeadBucket` * `GetBucketLocation` * `GetBucketVersioning` Use HTTPS for all other requests. ## Limitations * [Chunked uploads](https://docs.aws.amazon.com/AmazonS3/latest/developerguide/sigv4-streaming.html) are not supported over HTTP. Use HTTPS for these uploads. * HTTP access doesn't change Object Storage encryption at rest. Stored objects remain encrypted by default. # Monitoring buckets in Nebius AI Cloud Source: https://docs.nebius.com/object-storage/monitoring.md You can monitor bucket status on the dashboards in the Nebius AI Cloud web console. There are two ways to find the required dashboard: * Go to **Observability** → [Metrics](https://console.nebius.com/observability/metrics) and select the resource you would like to review. * Go to the page of the bucket you would like to review and switch to the **Metrics** tab. Use the dashboard to monitor current resource utilization, get information to schedule [quota](https://docs.nebius.com/object-storage/resources/quotas-limits.md) increases and quickly identify anomalies. In case of object storage issues, dashboards help the Nebius support team investigate the issue. Data for the dashboard is collected automatically. The bucket usage data becomes available 5–10 minutes after the bucket is created. ## Dashboard filters Use time filters to view a specific period of usage. By default, the data is refreshed every 15 seconds. You can configure this interval next to the time filters. ## Bucket monitoring metrics * **Traffic** Amount of data transferred to and from storage. Measured in bytes per second. * **Total bucket size** Storage space used by all objects in a bucket. * **Read requests** Number of requests made to retrieve object contents from storage. Measured in requests per second. * **Modify requests** Number of requests made to upload objects or modify object contents. Measured in requests per second. * **Space by storage class** Storage space used by objects by [storage class](https://docs.nebius.com/object-storage/storage-classes.md). Measured in GiB. * **Space by object type** Amount of storage used for objects of different types. * **Object counts** Number of stored objects by type. * **Object counts by storage class** Number of objects by storage class. * **API Errors** Number of API errors by type of error. * **Transition lifecycle failures** Number of failed storage class transitions caused by [transition lifecycle rules](https://docs.nebius.com/object-storage/objects/lifecycles.md#transition-lifecycle-rules). # Logs in Object Storage Source: https://docs.nebius.com/object-storage/logs.md Object Storage keeps logs of actions that are performed on buckets and objects. You can view and analyze these logs as events in the [Audit Logs](https://docs.nebius.com/audit-logs/index.md) service. There are two types of logs in Object Storage: * *Control plane logs* describe actions on buckets, such as creating and deleting buckets or getting and updating buckets' settings. Control plane logs are always available for all buckets. * *Data plane logs* describe actions on objects, such as uploading, downloading, and deleting objects. By default, Object Storage does not keep data plane logs for your buckets. For each individual bucket, you can enable partial or full data plane logging. This can help you identify object usage patterns to optimize storage costs, improve performance of critical parts of your applications, and comply with regulations, such as the [Health Insurance Portability and Accountability Act](https://www.hhs.gov/hipaa/index.html) (HIPAA). > [!NOTE] > > Data plane logs are in [preview](https://docs.nebius.com/overview/services.md#preview). Before enabling them, [contact support](https://console.nebius.com/support/create-ticket). Audit Logs has a throughput quota for data plane logs. Logs beyond that quota are not recorded. You can monitor data plane events to avoid exceeding the quota. For more information, see [Quotas in Audit Logs](https://docs.nebius.com/audit-logs/resources/quotas-limits.md). ## Prerequisites If you use the web console, you don't need to complete any prerequisites. > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to configure data plane logs To configure data plane logs for a bucket, you need the `admin` [role](https://docs.nebius.com/iam/authorization/roles.md) for the bucket, its parent project, or tenant. > [tab] Web console > > You can configure data plane logs when [creating a bucket](https://console.nebius.com/storage/create) or on the **Settings** page of an existing bucket: > > 1. Enable or disable the **Data plane Audit Logs** setting. > 2. If the setting is on, choose whether to log all actions or only actions that change objects. See the [list of logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). > [tab] Nebius AI Cloud CLI > > To configure data plane logs when [creating](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets-nebius-ai-cloud-cli) (`nebius storage bucket create`) or [modifying buckets](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-modify-buckets-nebius-ai-cloud-cli) (`nebius storage bucket update`), add the `--object-audit-logging` parameter to the command: > > * `--object-audit-logging all`: All data plane actions are logged. > * `--object-audit-logging mutate_only`: Only data plane actions that change objects are logged. > * `--object-audit-logging none` (default): Data plane actions are not logged. > > See the [list of logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). > > For example, to enable full data plane logging in an existing bucket, run the following command: > > ```bash > nebius storage bucket update \ > --id \ > --object-audit-logging all > ``` > [tab] Terraform > > To configure data plane logs when [creating](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets) or [modifying buckets](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-modify-buckets), add the `object_audit_logging` parameter to the `nebius_storage_v1_bucket` resource: > > * `object_audit_logging = "all"`: All data plane actions are logged. > * `object_audit_logging = "mutate_only"`: Only data plane actions that change objects are logged. > * `object_audit_logging = "none"` (default): Data plane actions are not logged. > > See the [list of logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). > > For example, to enable full data plane logging in a bucket, use the following configuration: > > ```hcl > resource "nebius_storage_v1_bucket" "my_bucket" { > name = "" > parent_id = "" > object_audit_logging = "all" > } > ``` > > For more information about the `nebius_storage_v1_bucket` resource, see the [Terraform provider documentation](https://docs.nebius.com/terraform-provider/reference/resources/storage_v1_bucket.md). > [tab] Go SDK > > To configure data plane logs when [creating](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets-go-sdk) or [modifying buckets](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-modify-buckets-go-sdk), set `ObjectAuditLogging` on the bucket specification. > > The example below enables full data plane logging for an existing bucket: > > ```go > loggingService := sdk.Services().Storage().V1().Bucket() > loggingBucket, err := loggingService.Get( > ctx, > &storage.GetBucketRequest{Id: ""}, > ) > if err != nil { > return err > } > loggingBucket.Spec.ObjectAuditLogging = storage.BucketSpec_ALL > loggingOperation, err := loggingService.Update( > ctx, > &storage.UpdateBucketRequest{ > Metadata: loggingBucket.Metadata, > Spec: loggingBucket.Spec, > }, > ) > if err != nil { > return err > } > if _, err = loggingOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: Bucket ID. > * `ObjectAuditLogging`: Logging mode. The example sets `BucketSpec_ALL`, which logs all data plane actions. > > See the [list of logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). > [tab] Python SDK > > To configure data plane logs when [creating](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets-python-sdk) or [modifying buckets](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-modify-buckets-python-sdk), set `object_audit_logging` on the bucket specification. > > The example below enables full data plane logging for an existing bucket: > > ```python > logging_service = BucketServiceClient(sdk) > logging_bucket = await logging_service.get( > GetBucketRequest(id=""), > ) > logging_bucket.spec.object_audit_logging = ( > BucketSpec.ObjectAuditLogging.ALL > ) > logging_operation = await logging_service.update( > UpdateBucketRequest( > metadata=logging_bucket.metadata, > spec=logging_bucket.spec, > ), > ) > await logging_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `object_audit_logging`: Logging mode. The example sets `BucketSpec.ObjectAuditLogging.ALL`, which logs all data plane actions. > > See the [list of logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). > [tab] JavaScript SDK > > To configure data plane logs when [creating](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets-javascript-sdk) or [modifying buckets](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-modify-buckets-javascript-sdk), set `objectAuditLogging` on the bucket specification. > > The example below enables full data plane logging for an existing bucket: > > ```ts > const loggingService = new BucketService(sdk); > const loggingBucket = await loggingService.get( > GetBucketRequest.create({ id: "" }), > ).result; > loggingBucket.spec.objectAuditLogging = > BucketSpec_ObjectAuditLogging.ALL; > const loggingOperation = await loggingService.update( > UpdateBucketRequest.create({ > metadata: loggingBucket.metadata, > spec: loggingBucket.spec, > }), > ).result; > await loggingOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: Bucket ID. > * `objectAuditLogging`: Logging mode. The example sets `BucketSpec_ObjectAuditLogging.ALL`, which logs all data plane actions. > > See the [list of logged data plane actions](https://docs.nebius.com/object-storage/logs.md#logged-data-plane-actions). Changes to existing buckets may take some time to apply. For example, if you enable data plane logs in an existing bucket, there may be a delay before logging begins. ### Logged data plane actions Depending on whether you enabled all data plane logs (`all`) or only logs for actions that change objects (`mutate_only`), Object Storage logs actions that are performed by using the following [S3 API methods](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html): | Method | `all` | `mutate_only` | | - | - | - | | `PutObject` | ✓ | ✓ | | `CopyObject` | ✓ | ✓ | | `CreateMultipartUpload` | ✓ | ✓ | | `UploadPart` | ✓ | ✓ | | `UploadPartCopy` | ✓ | ✓ | | `AbortMultipartUpload` | ✓ | ✓ | | `CompleteMultipartUpload` | ✓ | ✓ | | `DeleteObject` | ✓ | ✓ | | `DeleteObjects` | ✓ | ✓ | | `DeleteObjectVersion` | ✓ | ✓ | | `GetObject` | ✓ | — | | `HeadObject` | ✓ | — | | `ListParts` | ✓ | — | | `ListObjectVersions` | ✓ | — | | `ListObjects` | ✓ | — | | `ListMultipartUploads` | ✓ | — | Actions that do not create, read, update or delete objects themselves, such as `GetObjectAcl` or `PutObjectTagging`, are not logged, even if Object Storage supports them. Requests that result in HTTP client errors `400 Bad Request` and `429 Too Many Requests` are also not logged. ## How to view logs You can view control plane logs and data plane logs from buckets that have them enabled in Audit Logs: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **Audit Logs**. > 2. Select the region to search for Object Storage audit events. > 3. Select **Control plane** or **Data plane**. > 4. Filter events by the `STORAGE` service. If this filter is not displayed, click **Filters** and then select **Service**. > [tab] Nebius AI Cloud CLI > > Run [nebius audit v2 audit-event list](https://docs.nebius.com/cli/reference/audit/v2/audit-event/list.md) to get control plane logs: > > ```bash > nebius audit v2 audit-event list \ > --parent-id \ > --start \ > --end \ > --filter "service.name='STORAGE'" \ > --event-type control_plane \ > --region > ``` > > In the command above, specify: > > * `--parent-id`: [Tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-cli). > * `--start`: Start time for the search, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. > * `--end`: End time for the search, in the ISO 8601 format. > * `--region`: [Region](https://docs.nebius.com/overview/regions.md) to search for Object Storage audit events. > * `--filter`: Filter expression. Set it to `service.name='STORAGE'` to return only Object Storage events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md). > * `--event-type`: Type of audit event. Set it to `control_plane` to return control plane logs. > > To get data plane logs, replace `--event-type control_plane` with `--event-type data_plane`: > > ```bash > nebius audit v2 audit-event list \ > --parent-id \ > --start \ > --end \ > --filter "service.name='STORAGE'" \ > --event-type data_plane \ > --region > ``` > [tab] Go SDK > > List control plane events: > > ```go > controlStartText := "" > controlStart, err := time.Parse(time.RFC3339, controlStartText) > if err != nil { > return err > } > controlEnd, err := time.Parse(time.RFC3339, "") > if err != nil { > return err > } > controlService := sdk.Services().Audit().V2().AuditEvent() > controlEvents, err := controlService.List( > ctx, > &audit.ListAuditEventRequest{ > ParentId: "", > Start: timestamppb.New(controlStart), > End: timestamppb.New(controlEnd), > Filter: "service.name='STORAGE'", > EventType: audit.EventType_CONTROL_PLANE, > Region: "", > }, > ) > if err != nil { > return err > } > fmt.Println(controlEvents) > ``` > > In the code, set the following parameters: > > * `ParentId`: [Tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-go-sdk). > * `Start`: Start time for the search, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. The code parses this value as RFC 3339. > * `End`: End time for the search, in the ISO 8601 format. The code parses this value as RFC 3339. > * `Filter`: Filter expression. The example uses `service.name='STORAGE'` to return only Object Storage events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-go-sdk). > * `EventType`: Type of audit event. The example sets `EventType_CONTROL_PLANE` to return control plane logs. > * `Region`: [Region](https://docs.nebius.com/overview/regions.md) to search for Object Storage audit events. > > To get data plane logs, set `EventType` to `EventType_DATA_PLANE`: > > ```go > dataStart, err := time.Parse(time.RFC3339, "") > if err != nil { > return err > } > dataEnd, err := time.Parse(time.RFC3339, "") > if err != nil { > return err > } > dataService := sdk.Services().Audit().V2().AuditEvent() > dataEvents, err := dataService.List( > ctx, > &audit.ListAuditEventRequest{ > ParentId: "", > Start: timestamppb.New(dataStart), > End: timestamppb.New(dataEnd), > Filter: "service.name='STORAGE'", > EventType: audit.EventType_DATA_PLANE, > Region: "", > }, > ) > if err != nil { > return err > } > fmt.Println(dataEvents) > ``` > [tab] Python SDK > > List control plane events: > > ```python > control_service = AuditEventServiceClient(sdk) > control_events = await control_service.list( > ListAuditEventRequest( > parent_id="", > start=datetime.fromisoformat(""), > end=datetime.fromisoformat(""), > filter="service.name='STORAGE'", > event_type=EventType.CONTROL_PLANE, > region="", > ), > ) > print(control_events) > ``` > > In the code, set the following parameters: > > * `parent_id`: [Tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-python-sdk). > * `start`: Start time for the search, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. > * `end`: End time for the search, in the ISO 8601 format. > * `filter`: Filter expression. The example uses `service.name='STORAGE'` to return only Object Storage events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-python-sdk). > * `event_type`: Type of audit event. The example sets `EventType.CONTROL_PLANE` to return control plane logs. > * `region`: [Region](https://docs.nebius.com/overview/regions.md) to search for Object Storage audit events. > > To get data plane logs, set `event_type` to `EventType.DATA_PLANE`: > > ```python > data_service = AuditEventServiceClient(sdk) > data_events = await data_service.list( > ListAuditEventRequest( > parent_id="", > start=datetime.fromisoformat(""), > end=datetime.fromisoformat(""), > filter="service.name='STORAGE'", > event_type=EventType.DATA_PLANE, > region="", > ), > ) > print(data_events) > ``` > [tab] JavaScript SDK > > List control plane events: > > ```ts > const controlService = new AuditEventService(sdk); > const controlEvents = await controlService.list( > ListAuditEventRequest.create({ > parentId: "", > start: new Date(""), > end: new Date(""), > filter: "service.name='STORAGE'", > eventType: EventType.CONTROL_PLANE, > region: "", > }), > ).result; > console.log(controlEvents); > ``` > > In the code, set the following parameters: > > * `parentId`: [Tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-javascript-sdk). > * `start`: Start time for the search, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. > * `end`: End time for the search, in the ISO 8601 format. > * `filter`: Filter expression. The example uses `service.name='STORAGE'` to return only Object Storage events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-javascript-sdk). > * `eventType`: Type of audit event. The example sets `EventType.CONTROL_PLANE` to return control plane logs. > * `region`: [Region](https://docs.nebius.com/overview/regions.md) to search for Object Storage audit events. > > To get data plane logs, set `eventType` to `EventType.DATA_PLANE`: > > ```ts > const dataService = new AuditEventService(sdk); > const dataEvents = await dataService.list( > ListAuditEventRequest.create({ > parentId: "", > start: new Date(""), > end: new Date(""), > filter: "service.name='STORAGE'", > eventType: EventType.DATA_PLANE, > region: "", > }), > ).result; > console.log(dataEvents); > ``` For more details, see [Viewing events in Audit Logs](https://docs.nebius.com/audit-logs/events/view.md). Parameters of an action, such as the bucket name and the object key, are returned in the `.request.parameters` field of the Audit Logs event. For example: ```json { "request": { "parameters": { "bucket_name": "bucket-test", "object_key": "data/config.yaml", "version": "0[isNull=true,isLatest=false]" } } } ``` For more details, see [Structure and fields of events in Audit Logs](https://docs.nebius.com/audit-logs/events/reference.md). # Quotas and constraints in Object Storage Source: https://docs.nebius.com/object-storage/resources/quotas-limits.md ## Quotas Object Storage has quotas on buckets, storage size and inventory configurations for your [tenant](https://docs.nebius.com/iam/overview.md#tenants). Storage size quotas depend on the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) of an object. Object Storage quota values depend on your [quota tier](https://docs.nebius.com/overview/quotas.md#quota-tiers). When the default and full values of a quota differ, the **Tier** column shows a separate row for each tier. **All** means the same value applies to all tiers. | Quota name | Tier | `eu-north1`, `eu-west1`, `eu-west2`, `eu-south1`, `me-west1`, `uk-south1`, `uk-south2`, `us-central1`, `us-north1` | `eu-north2` | | - | - | - | - | | Total size of objects in Standard storage | Default | 10 TiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) | 0 | | | Full | 10 TiB | 5 TiB | | Total size of objects in Enhanced Throughput storage | Default | 10 TiB | 0 | | | Full | 10 TiB | 5 TiB | | Total size of objects in Intelligent storage | Default | 10 TiB | 0 | | | Full | 10 TiB | 5 TiB | | Buckets | All | 200 | 50 | For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). ## Constraints ### Number of objects The total number of objects in a bucket cannot exceed 1 billion. If you exceed this limit, the request fails with the `BucketObjectsCountExceeded` error (`HTTP 400`). If the bucket has [versioning](https://docs.nebius.com/object-storage/buckets/versioning.md) enabled, the total number of object versions in the bucket cannot exceed 100 million. This limit includes current and noncurrent versions. To increase this limit for a specific bucket, [contact support](https://console.nebius.com/support). ### Number of inventory configurations The total number of inventory configurations is limited to five per bucket and 100 per tenant. # Pricing in Object Storage Source: https://docs.nebius.com/object-storage/resources/pricing.md This article provides detailed pricing for the Object Storage service in Nebius AI Cloud. ## How charges and prices work Each group of chargeable items in this article has two time units associated with it: * **Billing unit**: Minimum unit of usage for which you can be charged. * **Pricing unit**: Unit of usage for which the prices are shown. Charges for units smaller than the pricing unit are calculated proportionally. > For example, for GPUs on running VMs, the **billing unit** is 1 second, and the **pricing unit** is 1 hour (3600 seconds). For 30 minutes of usage, you will be charged half the hourly price. Prices in US dollars (USD, \$) apply to all customers except for companies from Israel, where prices in Israeli shekels (ILS, ₪) apply instead. All prices are shown without any applicable taxes, including VAT. Due to rounding errors, usage costs shown in the web console and final charges may slightly differ from calculations based on the prices in this article. ## Prices ### Storing data You are charged for storing data in your Object Storage buckets. Pricing depends on the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) of a stored object. * **Billing unit**: 1 byte per 1 second * **Pricing unit**: 1 GiB per 730 hours (230 bytes per 2,628,000 seconds \~ 1 month) > [tab] USD > > | Item | Price per 1 GiB per 730 hours | > | - | - | > | Used space in Standard storage | \$0.0147 | > | Used space in Enhanced Throughput storage | \$0.11 | > | Used space in Intelligent storage, Warm tier | \$0.03 | > | Used space in Intelligent storage, Cold tier | \$0.01 | > [tab] ILS > > | Item | Price per 1 GiB per 730 hours | > | - | - | > | Used space in Standard storage | ₪0.046 | > | Used space in Enhanced Throughput storage | ₪0.341 | > | Used space in Intelligent storage, Warm tier | ₪0.093 | > | Used space in Intelligent storage, Cold tier | ₪0.031 | ### HTTP requests on data You are charged for performing HTTP requests on objects in your Object Storage buckets. Pricing depends on the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) of an object on which you perform requests. All requests are divided into two classes by their HTTP method. A request using any method in a class counts toward the billing item for the class. > For example, when 5 PUT requests and 5 DELETE requests are made, this adds 10 requests total to the class A operations (PUT, POST, DELETE) item. You are not charged for requests on buckets (for example, requests that create or delete buckets, change bucket settings or list objects). * **Billing unit**: 1 request * **Pricing unit**: 1000 requests > [tab] USD > > | Item | Price per 1000 requests | > | - | - | > | Standard storage — class A operations (PUT, POST, DELETE) | \$0.0034 | > | Standard storage — class B operations (GET, HEAD) | \$0.00028 | > | Enhanced Throughput storage — class A operations (PUT, POST, DELETE) | Free | > | Enhanced Throughput storage — class B operations (GET, HEAD) | Free | > | Intelligent storage — class A operations (PUT, POST, DELETE) | Free | > | Intelligent storage — class B operations (GET, HEAD) | Free | > [tab] ILS > > | Item | Price per 1000 requests | > | - | - | > | Standard storage — class A operations (PUT, POST, DELETE) | ₪0.01054 | > | Standard storage — class B operations (GET, HEAD) | ₪0.000868 | > | Enhanced Throughput storage — class A operations (PUT, POST, DELETE) | Free | > | Enhanced Throughput storage — class B operations (GET, HEAD) | Free | > | Intelligent storage — class A operations (PUT, POST, DELETE) | Free | > | Intelligent storage — class B operations (GET, HEAD) | Free | ### Egress traffic You are charged for egress traffic from your Object Storage buckets, that is, traffic to the internet and traffic to another [region](https://docs.nebius.com/overview/regions.md). Pricing depends on the [storage class](https://docs.nebius.com/object-storage/storage-classes.md) of an object. * **Billing unit**: 1 byte * **Pricing unit**: 1 GiB (230 bytes) > [tab] USD > > | Item | Price per 1 GiB | > | - | - | > | Egress traffic from Standard storage to the internet or another region in Nebius AI Cloud | \$0.015 | > | Egress traffic from Enhanced Throughput storage to the internet or another region in Nebius AI Cloud | Free | > | Egress traffic within the same Nebius AI Cloud region | Free | > [tab] ILS > > | Item | Price per 1 GiB | > | - | - | > | Egress traffic from Standard storage to the internet or another region in Nebius AI Cloud | ₪0.0465 | > | Egress traffic from Enhanced Throughput storage to the internet or another region in Nebius AI Cloud | Free | > | Egress traffic within the same Nebius AI Cloud region | Free | #### Egress traffic from the Intelligent storage class For Intelligent storage class, free egress traffic is limited to three times the customer's monthly average used storage capacity. If this limit is exceeded, Nebius may limit read and write bandwidth and/or apply charges according to Object Storage pricing. > For example, if the monthly average used storage capacity is 1 TiB and egress traffic took more than 3 TiB, the read and write bandwidth may become limited, and charges for the egress traffic may apply. * **Billing unit**: 1 byte * **Pricing unit**: 1 GiB (230 bytes) > [tab] USD > > | Item | Price per 1 GiB | > | - | - | > | Egress traffic from Intelligent storage, less than 3x the monthly average used storage capacity | Free | > | Egress traffic from Intelligent storage, more than or equal to 3x the monthly average used storage capacity | \$0.05 | > [tab] ILS > > | Item | Price per 1 GiB | > | - | - | > | Egress traffic from Intelligent storage, less than 3x the monthly average used storage capacity | Free | > | Egress traffic from Intelligent storage, more than or equal to 3x the monthly average used storage capacity | ₪0.155 | ### Managed Service for PostgreSQL® # Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/index.md Modern AI and ML workloads operate with sizable datasets. Managed Service for PostgreSQL allows you to apply its flexibility and dataset management capabilities to enhance the performance of your projects in Nebius AI Cloud. The service is available in the following [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md): * `eu-north1`: Finland * `eu-west1`: France * `me-west1`: Israel * `us-central1`: Kansas City, Missouri, US * `uk-south1`: United Kingdom * `eu-west2`: France *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* > [card] [Getting started](https://docs.nebius.com/postgresql/quickstart.md) > > Create a Managed PostgreSQL cluster, connect to it, create a database, and perform basic operations on it > [card] [Managing your Managed PostgreSQL cluster](https://docs.nebius.com/postgresql/clusters/manage.md) > > Create and delete clusters > [card] [Users and their privileges](https://docs.nebius.com/postgresql/databases/users.md) > > Create and manage users with different privileges > [card] [Migration from or to a Managed PostgreSQL cluster](https://docs.nebius.com/postgresql/data-transfers/migrate-data.md) > > Move data between clusters > [card] [Replication to a Managed PostgreSQL cluster](https://docs.nebius.com/postgresql/replication/from-external.md) > > Replicate data from external sources > [card] [Monitoring a Managed PostgreSQL cluster state](https://docs.nebius.com/postgresql/monitoring.md) > > Control resource usage and database health of your cluster # Getting started with Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/quickstart.md Modern AI and ML workloads operate with sizable datasets. Managed Service for PostgreSQL allows you to apply its flexibility and dataset management capabilities to enhance the performance of your projects in Nebius AI Cloud. This guide will get you started with Managed Service for PostgreSQL. You will: * Install and configure CLIs to work with Managed Service for PostgreSQL * Create your first cluster * Connect to the cluster * Perform basic operations with a PostgreSQL database > [!TIP] > > If you want to move data from an external PostgreSQL cluster to a Managed PostgreSQL cluster, use [migration](https://docs.nebius.com/postgresql/data-transfers/migrate-data.md) or [replication](https://docs.nebius.com/postgresql/replication/from-external.md). ## Prepare your environment Before moving on with this guide, make sure you have the `postgresql` package installed. You will need it to [connect to your cluster](https://docs.nebius.com/postgresql/quickstart.md#connect-to-your-cluster) and [test a database within it](https://docs.nebius.com/postgresql/quickstart.md#perform-operations-with-a-test-database). ### Install postgresql package > [tab] macOS > > 1. Ensure you have [Homebrew](https://brew.sh) installed. > > 2. Run the command to install PostgreSQL CLI: > > ```sh > brew install libpq > ``` > [tab] Ubuntu > > Run the command to install PostgreSQL CLI: > > ```sh > sudo apt update && sudo apt install -y postgresql-client > ``` ### (Optional) Install a Nebius developer tool To manage clusters and other Nebius AI Cloud resources from the command line, with Terraform, or with an SDK, install and configure the corresponding Nebius developer tool: * [Nebius AI Cloud CLI](https://docs.nebius.com/cli/install.md) * [Nebius AI Cloud provider for Terraform](https://docs.nebius.com/terraform-provider/install.md) * [Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md) * [Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md) * [Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md) ## Create a cluster > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > > 2. Click  **Create cluster**. > > 3. On the page that opens: > > 1. Specify the **Name** for your cluster. Do not use spaces in cluster names. > > 2. Write a short **Description** of your cluster. For example, `My first Managed Service for PostgreSQL cluster`. > > 3. In the **Username** field, type the username. > > 4. In the **Password** field, come up with a secure password. Such a password must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > 5. Keep all the other settings with their default values — they will be more than enough for the purposes of this guide. > > 6. Click **Create cluster**. > > On the **Managed Service for PostgreSQL®** page, you will see your cluster with the `Provisioning` status. > > Please wait until its status changes to `Running` before trying to perform any operations on your new cluster. > [tab] CLI > > 1. Prepare environment variables: > > 1. Come up with a name for your Managed Service for PostgreSQL cluster: > > ```bash > export CLUSTER_NAME= > ``` > > Do not use spaces in your cluster names. > > 2. Copy the network ID from the [Network](https://console.nebius.com/network) section of the web console and save it to an environment variable: > > ```bash > export NETWORK_ID= > ``` > > 3. Set the credentials for your Managed Service for PostgreSQL database: database name, your username and database password: > > ```bash > export BOOTSTRAP_DB_NAME= > export BOOTSTRAP_USER_NAME= > export BOOTSTRAP_USER_PASSWORD= > ``` > > 2. Run the command to create a cluster: > > ```bash > nebius msp postgresql v1alpha1 cluster create \ > --name $CLUSTER_NAME \ > --description "My first PostgreSQL cluster" \ > --network-id $NETWORK_ID \ > --bootstrap-db-name $BOOTSTRAP_DB_NAME \ > --bootstrap-user-name $BOOTSTRAP_USER_NAME \ > --bootstrap-user-password $BOOTSTRAP_USER_PASSWORD \ > --config-version 16 \ > --config-template-disk-type network-ssd \ > --config-template-disk-size-gibibytes 96 \ > --config-template-resources-platform cpu-e2 \ > --config-template-resources-preset 2vcpu-8gb \ > --config-template-hosts-count 1 \ > --config-public-access > ``` > > 3. Wait for the operation to complete. > [tab] Terraform > > The configuration below assumes that the [project](https://docs.nebius.com/iam/overview.md#projects) is stored in the [`project_id` input variable](https://developer.hashicorp.com/terraform/language/values/variables). > > For more information about how to get the network ID, see the [instructions](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id). > > ```hcl > resource "nebius_msp_postgresql_v1alpha1_cluster" "example_cluster" { > parent_id = var.project_id > description = "My first Managed PostgreSQL cluster" > name = "postgres_cluster_example" > network_id = "" > > bootstrap = { > db_name = "" > user_name = "" > user_password = "" > } > > config = { > template = { > resources = { > platform = "cpu-e2" > preset = "2vcpu-8gb" > } > disk = { > size_gibibytes = 96 > type = "network-ssd" > } > hosts = { > count = 1 > } > } > version = "16" > > public_access = true > } > } > ``` > > For details about the `nebius_msp_postgresql_v1alpha1_cluster` Terraform resource, see the [provider reference](https://docs.nebius.com/terraform-provider/reference/resources/msp_postgresql_v1alpha1_cluster.md). > [tab] Go SDK > > ```go > createService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > createRequest := &pg.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &pg.ClusterSpec{ > Description: "My first PostgreSQL cluster", > NetworkId: "", > Config: &pg.ConfigSpec{ > Version: "16", > PublicAccess: true, > Template: &pg.TemplateSpec{ > Resources: &resource.ResourcesSpec{ > Platform: "cpu-e2", > Preset: "2vcpu-8gb", > }, > Disk: &resource.DiskSpec{ > Type: "network-ssd", > SizeGibibytes: 96, > }, > Hosts: &resource.HostSpec{ > Count: 1, > }, > }, > }, > Bootstrap: &pg.BootstrapSpec{ > DbName: "", > UserName: "", > UserPassword: "", > }, > }, > } > createOperation, err := createService.Create( > ctx, createRequest, > ) > if err != nil { > return fmt.Errorf("create cluster: %w", err) > } > _, err = createOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for cluster creation: %w", err) > } > ``` > > In the code, update the following values: > > * `Metadata.ParentId`: Project ID. > * `Metadata.Name`: Cluster name. Don't use spaces in cluster names. > * `Spec.Description`: Cluster description. > * `Spec.NetworkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk). > * `Spec.Config.PublicAccess`: Whether the cluster has a public IP address and is accessible from the internet. > * `Spec.Config.Template.Resources.Preset`: Resource preset. > * `Spec.Config.Template.Disk.SizeGibibytes`: Cluster storage disk size, in gibibytes. > * `Spec.Bootstrap.DbName`: Database name. > * `Spec.Bootstrap.UserName`: Username. > * `Spec.Bootstrap.UserPassword`: Database password. > [tab] Python SDK > > ```python > create_service = pg.ClusterServiceClient(sdk) > create_request = pg.CreateClusterRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=pg.ClusterSpec( > description="My first PostgreSQL cluster", > network_id="", > config=pg.ConfigSpec( > version="16", > public_access=True, > template=pg.TemplateSpec( > resources=resource.ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > disk=resource.DiskSpec( > type="network-ssd", > size_gibibytes=96, > ), > hosts=resource.HostSpec( > count=1, > ), > ), > ), > bootstrap=pg.BootstrapSpec( > db_name="", > user_name="", > user_password="", > ), > ), > ) > create_operation = await create_service.create(create_request) > await create_operation.wait() > ``` > > In the code, update the following values: > > * `metadata.parent_id`: Project ID. > * `metadata.name`: Cluster name. Don't use spaces in cluster names. > * `spec.description`: Cluster description. > * `spec.network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk). > * `spec.config.public_access`: Whether the cluster has a public IP address and is accessible from the internet. > * `spec.config.template.resources.preset`: Resource preset. > * `spec.config.template.disk.size_gibibytes`: Cluster storage disk size, in gibibytes. > * `spec.bootstrap.db_name`: Database name. > * `spec.bootstrap.user_name`: Username. > * `spec.bootstrap.user_password`: Database password. > [tab] JavaScript SDK > > ```ts > const createService = new pg.ClusterService(sdk); > const createRequest = pg.CreateClusterRequest.create({ > metadata: { > parentId: "", > name: "", > }, > spec: { > description: "My first PostgreSQL cluster", > networkId: "", > config: { > version: "16", > publicAccess: true, > template: { > resources: { > platform: "cpu-e2", > preset: "2vcpu-8gb", > }, > disk: { > type: "network-ssd", > sizeGibibytes: Long.fromNumber(96), > }, > hosts: { > count: Long.fromNumber(1), > }, > }, > }, > bootstrap: { > dbName: "", > userName: "", > userPassword: "", > }, > }, > }); > const createOperation = await createService.create( > createRequest, > ).result; > await createOperation.wait(); > ``` > > In the code, update the following values: > > * `metadata.parentId`: Project ID. > * `metadata.name`: Cluster name. Don't use spaces in cluster names. > * `spec.description`: Cluster description. > * `spec.networkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk). > * `spec.config.publicAccess`: Whether the cluster has a public IP address and is accessible from the internet. > * `spec.config.template.resources.preset`: Resource preset. > * `spec.config.template.disk.sizeGibibytes`: Cluster storage disk size, in gibibytes. > * `spec.bootstrap.dbName`: Database name. > * `spec.bootstrap.userName`: Username. > * `spec.bootstrap.userPassword`: Database password. ## Connect to your cluster 1. Open your cluster's page. 2. Under the cluster name, click **How to connect**. 3. Follow the instructions in the dialog window. 4. To check the connection, list all the databases on your cluster with the command: ```sh \l ``` You should see the following output: > [accordion] Output > > ```sh > List of databases > Name | Owner | Encoding | Collate | Ctype | Access privileges > ------------+----------+----------+---------+-------+---------------------------------- > postgres | postgres | UTF8 | C | C | =Tc/postgres + > | | | | | postgres=CTc/postgres + > | | | | | cnpg_pooler_pgbouncer=c/postgres > template0 | postgres | UTF8 | C | C | =c/postgres + > | | | | | postgres=CTc/postgres > template1 | postgres | UTF8 | C | C | =c/postgres + > | | | | | postgres=CTc/postgres > ``` ## Perform operations with a test database In this guide, we'll use the `dellstore2` dataset. It contains a fictional store database with products, orders, inventory, and customer information. 1. Download the [dellstore2-normal-1.0.tar.gz](https://www.postgresql.org/ftp/projects/pgFoundry/dbsamples/dellstore2/dellstore2-normal-1.0/) file from the PostgreSQL website. 2. Extract the file into a folder. 3. From the folder to which you extracted the file, connect to your Managed Service for PostgreSQL cluster with the Nebius AI Cloud CLI and create a database on your cluster: ```sql CREATE DATABASE dellstore; ``` 4. Upload the dataset from the file onto your cluster: ```sh \i dellstore2-normal-1.0.sql; ``` 5. Check if the objects were created successfully: ```sh \d ``` You should see the following output: > [accordion] Output > > ```sh > List of relations > Schema | Name | Type | Owner > --------+--------------------------+----------+----------------- > public | categories | table | > public | categories_category_seq | sequence | > public | cust_hist | table | > public | customers | table | > public | customers_customerid_seq | sequence | > public | inventory | table | > public | items | table | > public | orderlines | table | > public | orders | table | > public | orders_orderid_seq | sequence | > public | products | table | > public | products_prod_id_seq | sequence | > public | reorder | table | > (13 rows) > ``` 6. Write a row into the `products` table: ```sql INSERT INTO products( prod_id, category, title, actor, price, special, common_prod_id ) VALUES ( 10001, 42, 'FUTURE INTELLIGENCE', 'FORD PREFECT', 42.42, 0, 1978 ); ``` 7. Query the database to see that your row was written correctly: ```sql SELECT * FROM products WHERE prod_id = 10001; ``` You should get the following output: ```sh prod_id | category | title | actor | price | special | common_prod_id ---------+----------+---------------------+--------------+-------+---------+---------------- 10001 | 42 | FUTURE INTELLIGENCE | FORD PREFECT | 42.42 | 0 | 1978 (1 row) ``` *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Working with your Managed Service for PostgreSQL® cluster Source: https://docs.nebius.com/postgresql/clusters/manage.md In Managed Service for PostgreSQL, databases are organized into collections called *clusters*. You can [create](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters), [modify](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-modify-clusters) or [delete](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-delete-clusters) clusters. > [!TIP] > > If you want to move data from an external PostgreSQL cluster to a Managed PostgreSQL cluster, use [migration](https://docs.nebius.com/postgresql/data-transfers/migrate-data.md) or [replication](https://docs.nebius.com/postgresql/replication/from-external.md). ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## How to create clusters > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > > 2. Click  **Create cluster**. > > 3. On the page that opens, enter the cluster name and an optional description. > > 4. (Optional) Select one of the pooling modes: > > * **Transaction**: A connection is allocated from a connection pool for every transaction. Once the transaction is completed, the connection returns to the pool. > > The transaction mode is suitable for a large number of idle connections. Additionally, this mode allows you to allocate a smaller pooling size in comparison with the session mode. > > However, the transaction mode offers a limited support of PostgreSQL features; not all PostgreSQL clients are compatible with this mode. > > * **Session** (set by default): A connection is allocated from a connection pool for every client session. Once the session is terminated, the connection returns to the pool. > > More PostgreSQL clients support the session mode, over the transaction mode. Moreover, the session mode does not limit the number of PostgreSQL features that you can use. > > However, a database has to consume more resources to maintain long-lasting connections. You may need to increase the pooling size. > > 5. (Optional) In the **Pooling size** field, specify the number of connections allowed in a pool for a single database. > > 6. In the **Access** field, select whether the cluster should have a public IP address and be accessible from the internet. > > 7. In the **Resources** section, configure the cluster resources: > > 1. Select the number of vCPUs and RAM to allocate to the cluster. > 2. Specify the storage capacity. > > 8. Set the number of the cluster hosts. > > 9. In the **Database** section, specify the parameters for the connection to the database: > > 1. Enter the database name. > > 2. Enter the username. > > The following usernames are reserved; do not specify them: `admin`, `repl`, `monitor`, `postgres`, `public` and `none`. > > 3. Enter the password. It must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > 10. (Optional) In the **Backup settings** section, configure the cluster backup: > > 1. Schedule the backup. The backup is created every day at the selected time. > 2. Specify how long, in days, every backup and [write-ahead logs (WALs)](https://www.postgresql.org/docs/current/wal-intro.html) should be kept. > > 11. (Optional) Configure PostgreSQL additional parameters. > > > [accordion] Supported PostgreSQL parameters > > > > * [Autovacuum work mem](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM) > > * [Autovacuum vacuum cost delay](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-DELAY) > > * [Autovacuum vacuum cost limit](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-LIMIT) > > * [Autovacuum naptime](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-NAPTIME) > > * [Autovacuum vacuum scale factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR) > > * [Autovacuum analyze scale factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR) > > * [Statement timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-STATEMENT-TIMEOUT) > > * [Idle in transaction session timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT) > > * [Search path](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-SEARCH-PATH) > > * [Default transaction read-only](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY) > > * [Maximum connections](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-MAX-CONNECTIONS) > > * [Shared buffers](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-SHARED-BUFFERS) > > 12. Click **Create cluster**. > > The cluster will have the `Provisioning` status while it is being created. Before you perform any operations, wait for the `Running` status. > [tab] CLI > > 1. Run the following command: > > ```bash > nebius msp postgresql v1alpha1 cluster create \ > --name \ > --description "" \ > --network-id \ > --config-version 16 \ > --config-pooler-config-pooling-mode \ > --config-pooler-config-max-pool-size \ > --config-public-access= \ > --config-template-resources-platform cpu-e2 \ > --config-template-resources-preset \ > --config-template-disk-type network-ssd \ > --config-template-disk-size-gibibytes \ > --config-template-hosts-count \ > --bootstrap-db-name \ > --bootstrap-user-name \ > --bootstrap-user-password \ > --backup-backup-window-start "" \ > --backup-retention-policy d \ > > ``` > > This command contains the following parameters: > > * `--name`: Cluster name. > > * `--description`: Cluster description. > > * `--network-id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli). > > * `--config-version`: PostgreSQL version. The service currently supports only version 16. > > * `--config-pooler-config-pooling-mode`: Mode for allocating connections from the database connection pool. Managed PostgreSQL supports the following options: > > * **Transaction**: A connection is allocated from a connection pool for every transaction. Once the transaction is completed, the connection returns to the pool. > > The transaction mode is suitable for a large number of idle connections. Additionally, this mode allows you to allocate a smaller pooling size in comparison with the session mode. > > However, the transaction mode offers a limited support of PostgreSQL features; not all PostgreSQL clients are compatible with this mode. > > * **Session** (set by default): A connection is allocated from a connection pool for every client session. Once the session is terminated, the connection returns to the pool. > > More PostgreSQL clients support the session mode, over the transaction mode. Moreover, the session mode does not limit the number of PostgreSQL features that you can use. > > However, a database has to consume more resources to maintain long-lasting connections. You may need to increase the pooling size. > > * `--config-pooler-config-max-pool-size`: Number of connections allowed in a pool for a single database. > > * `--config-public-access`: If `true`, the cluster has both a public and a private IP address and is accessible from the internet. > > * `--config-template-resources-platform`: Resource platform for the database hosts. Managed PostgreSQL currently supports only the `cpu-e2` platform. > > * `--config-template-resources-preset`: Resource preset. Specify one of the [presets available for](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-non-gpu-platforms) `cpu-e2`. > > * `--config-template-disk-type`: Disk type for the database hosts. Managed PostgreSQL currently supports only `network-ssd` disks. > > * `--config-template-disk-size-gibibytes`: Cluster storage disk size, in gibibytes. > > * `--config-template-hosts-count`: Number of cluster hosts. > > * `--bootstrap-db-name`: Database name. > > * `--bootstrap-user-name`: Username of the database user. > > The following usernames are reserved; do not specify them: `admin`, `repl`, `monitor`, `postgres`, `public` and `none`. > > * `--bootstrap-user-password`: Password for this user. The password must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > * `--backup-backup-window-start`: Backup schedule, in the `HH:MM:SS` format. The backup is created every day at the selected time. > > * `--backup-retention-policy`: How long, in days, every backup and [write-ahead logs (WALs)](https://www.postgresql.org/docs/current/wal-intro.html) should be kept. For example, `7d` or `30d`. > > To configure the database, you can also use PostgreSQL parameters. > > > [accordion] Supported PostgreSQL parameters > > > > * [--config-postgresql-config-16-autovacuum-work-mem](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM): From `-1` to `2147483647` (in kilobytes). > > * [--config-postgresql-config-16-autovacuum-vacuum-cost-delay](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-DELAY): From `-1` to `100` (in milliseconds). > > * [--config-postgresql-config-16-autovacuum-vacuum-cost-limit](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-LIMIT): From `-1` to `10000`. > > * [--config-postgresql-config-16-autovacuum-naptime](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-NAPTIME): From `1` to `2147483` (in seconds). > > * [--config-postgresql-config-16-autovacuum-vacuum-scale-factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR): From `0` to `100`. > > * [--config-postgresql-config-16-autovacuum-analyze-scale-factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR): From `0` to `100`. > > * [--config-postgresql-config-16-statement-timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-STATEMENT-TIMEOUT): From `0` to `2147483647` (in milliseconds). > > * [--config-postgresql-config-16-idle-in-transaction-session-timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT): From `0` to `2147483647` (in milliseconds). > > * [--config-postgresql-config-16-search-path](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-SEARCH-PATH) > > * [--config-postgresql-config-16-default-transaction-read-only](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY) > > * [--config-postgresql-config-16-max-connections](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-MAX-CONNECTIONS): From `100` to `12800`. > > * [--config-postgresql-config-16-shared-buffers](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-SHARED-BUFFERS): From `128` to `8589934584` (in kilobytes). > [tab] Terraform > > 1. Create the following configuration file: > > ```hcl > resource "nebius_msp_postgresql_v1alpha1_cluster" "" { > name = "" > description = "" > parent_id = "" > network_id = "" > > config = { > version = "16" > pooler_config = { > pooling_mode = "" > max_pool_size = > } > public_access = > template = { > resources = { > platform = "cpu-e2" > preset = "" > } > disk = { > type = "network-ssd" > size_gibibytes = > } > hosts = { > count = > } > } > postgresql_config_16 = { > > } > } > > bootstrap = { > db_name = "" > user_name = "" > user_password = "" > } > > backup = { > backup_window_start = "HH:MM:SS" > retention_policy = "d" > } > } > ``` > > The file contains the following parameters: > > * `name`: Cluster name. > > * `description`: Cluster description. > > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > > * `network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id). > > * `config`: Cluster configuration parameters: > > * `version`: PostgreSQL version. The service currently supports only version 16. > > * `pooler_config.pooling_mode`: Mode for allocating connections from the database connection pool. Managed PostgreSQL supports the following options: > > * **Transaction**: A connection is allocated from a connection pool for every transaction. Once the transaction is completed, the connection returns to the pool. > > The transaction mode is suitable for a large number of idle connections. Additionally, this mode allows you to allocate a smaller pooling size in comparison with the session mode. > > However, the transaction mode offers a limited support of PostgreSQL features; not all PostgreSQL clients are compatible with this mode. > > * **Session** (set by default): A connection is allocated from a connection pool for every client session. Once the session is terminated, the connection returns to the pool. > > More PostgreSQL clients support the session mode, over the transaction mode. Moreover, the session mode does not limit the number of PostgreSQL features that you can use. > > However, a database has to consume more resources to maintain long-lasting connections. You may need to increase the pooling size. > > * `pooler_config.max_pool_size`: Number of connections allowed in a pool for a single database. > > * `public_access`: If `true`, the cluster has both a public and a private IP address and is accessible from the internet. > > * `template.resources.platform`: Resource platform for the database hosts. Managed PostgreSQL currently supports only the `cpu-e2` platform. > > * `template.resources.preset`: Resource preset. Specify one of the [presets available for](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-non-gpu-platforms) `cpu-e2`. > > * `template.disk.type`: Disk type for the database hosts. Managed PostgreSQL currently supports only `network-ssd` disks. > > * `template.disk.size_gibibytes`: Cluster storage disk size, in gibibytes. > > * `template.hosts.count`: Number of cluster hosts. > > * `postgresql_config_16`: Additional PostgreSQL parameters for the database configuration. > > > [accordion] Supported PostgreSQL parameters > > > > ```hcl > > postgresql_config_16 = { > > autovacuum_work_mem = > > autovacuum_vacuum_cost_delay = > > autovacuum_vacuum_cost_limit = <> > > autovacuum_naptime = > > autovacuum_vacuum_scale_factor = <> > > autovacuum_analyze_scale_factor = <> > > statement_timeout = > > idle_in_transaction_session_timeout = > > search_path = "<>" > > default_transaction_read_only = > > max_connections = <> > > shared_buffers = > > } > > ``` > > > > Supported PostgreSQL parameters: > > > > * [autovacuum\_work\_mem](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM): From `-1` to `2147483647`. > > * [autovacuum\_vacuum\_cost\_delay](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-DELAY): From `-1` to `100`. > > * [autovacuum\_vacuum\_cost\_limit](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-LIMIT): From `-1` to `10000`. > > * [autovacuum\_naptime](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-NAPTIME): From `1` to `2147483`. > > * [autovacuum\_vacuum\_scale\_factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR): From `0` to `100`. > > * [autovacuum\_analyze\_scale\_factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR): From `0` to `100`. > > * [statement\_timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-STATEMENT-TIMEOUT): From `0` to `2147483647`. > > * [idle\_in\_transaction\_session\_timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT): From `0` to `2147483647`. > > * [search\_path](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-SEARCH-PATH) > > * [default\_transaction\_read\_only](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY) > > * [max\_connections](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-MAX-CONNECTIONS): From `100` to `12800`. > > * [shared\_buffers](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-SHARED-BUFFERS): From `128` to `8589934584`. > > * `bootstrap.db_name`: Database name. > > * `bootstrap.user_name`: Username of the database user. > > The following usernames are reserved; do not specify them: `admin`, `repl`, `monitor`, `postgres`, `public` and `none`. > > * `bootstrap.user_password`: Password for this user. The password must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > * `backup.backup_window_start`: Backup schedule, in the `HH:MM:SS` format. The backup is created every day at the specified time. > > * `backup.retention_policy`: How long, in days, every backup and [write-ahead logs (WALs)](https://www.postgresql.org/docs/current/wal-intro.html) should be kept. For example, `7d` or `30d`. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > createService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > createRequest := &pg.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &pg.ClusterSpec{ > Description: "", > NetworkId: "", > Config: &pg.ConfigSpec{ > Version: "16", > PoolerConfig: &pg.ConnectionPoolerConfig{ > PoolingMode: > pg.ConnectionPoolerConfig_TRANSACTION, > MaxPoolSize: proto.Int64(), > }, > PublicAccess: , > Template: &pg.TemplateSpec{ > Resources: &resource.ResourcesSpec{ > Platform: "cpu-e2", > Preset: "", > }, > Disk: &resource.DiskSpec{ > Type: "network-ssd", > SizeGibibytes: , > }, > Hosts: &resource.HostSpec{ > Count: , > }, > }, > }, > Bootstrap: &pg.BootstrapSpec{ > DbName: "", > UserName: "", > UserPassword: "", > }, > Backup: &pg.BackupSpec{ > BackupWindowStart: "", > RetentionPolicy: > fmt.Sprintf("%dd", ), > }, > }, > } > // Set additional PostgreSQL parameters in > // createRequest.Spec.Config. > createOperation, err := createService.Create( > ctx, createRequest, > ) > if err != nil { > return fmt.Errorf("create cluster: %w", err) > } > _, err = createOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for cluster creation: %w", err) > } > ``` > > In the code, update the following values: > > * `Metadata.ParentId`: Project ID. > * `Metadata.Name`: Cluster name. > * `Spec.Description`: Cluster description. > * `Spec.NetworkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk). > * `Spec.Config.PoolerConfig.PoolingMode`: Mode for allocating connections from the database connection pool. > * `Spec.Config.PoolerConfig.MaxPoolSize`: Number of connections allowed in a pool for a single database. > * `Spec.Config.PublicAccess`: Whether the cluster has a public IP address and is accessible from the internet. > * `Spec.Config.Template.Resources.Preset`: Resource preset. > * `Spec.Config.Template.Disk.SizeGibibytes`: Cluster storage disk size, in gibibytes. > * `Spec.Config.Template.Hosts.Count`: Number of cluster hosts. > * `Spec.Bootstrap.DbName`: Database name. > * `Spec.Bootstrap.UserName`: Username. > * `Spec.Bootstrap.UserPassword`: Database password. > * `Spec.Backup.BackupWindowStart`: Backup schedule, in `HH:MM:SS` format. > * `Spec.Backup.RetentionPolicy`: Backup retention period, for example `7d`. > > To configure the database, set additional PostgreSQL parameters in `createRequest.Spec.Config`. > [tab] Python SDK > > ```python > create_service = pg.ClusterServiceClient(sdk) > create_request = pg.CreateClusterRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=pg.ClusterSpec( > description="", > network_id="", > config=pg.ConfigSpec( > version="16", > pooler_config=pg.ConnectionPoolerConfig( > pooling_mode=( > pg.ConnectionPoolerConfig.PoolingMode. > TRANSACTION > ), > max_pool_size=, > ), > public_access=, > template=pg.TemplateSpec( > resources=resource.ResourcesSpec( > platform="cpu-e2", > preset="", > ), > disk=resource.DiskSpec( > type="network-ssd", > size_gibibytes=, > ), > hosts=resource.HostSpec( > count=, > ), > ), > ), > bootstrap=pg.BootstrapSpec( > db_name="", > user_name="", > user_password="", > ), > backup=pg.BackupSpec( > backup_window_start="", > retention_policy="d", > ), > ), > ) > # Set additional PostgreSQL parameters in > # create_request.spec.config. > create_operation = await create_service.create(create_request) > await create_operation.wait() > ``` > > In the code, update the following values: > > * `metadata.parent_id`: Project ID. > * `metadata.name`: Cluster name. > * `spec.description`: Cluster description. > * `spec.network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk). > * `spec.config.pooler_config.pooling_mode`: Mode for allocating connections from the database connection pool. > * `spec.config.pooler_config.max_pool_size`: Number of connections allowed in a pool for a single database. > * `spec.config.public_access`: Whether the cluster has a public IP address and is accessible from the internet. > * `spec.config.template.resources.preset`: Resource preset. > * `spec.config.template.disk.size_gibibytes`: Cluster storage disk size, in gibibytes. > * `spec.config.template.hosts.count`: Number of cluster hosts. > * `spec.bootstrap.db_name`: Database name. > * `spec.bootstrap.user_name`: Username. > * `spec.bootstrap.user_password`: Database password. > * `spec.backup.backup_window_start`: Backup schedule, in `HH:MM:SS` format. > * `spec.backup.retention_policy`: Backup retention period, for example `7d`. > > To configure the database, set additional PostgreSQL parameters in `create_request.spec.config`. > [tab] JavaScript SDK > > ```ts > const createService = new pg.ClusterService(sdk); > const createRequest = pg.CreateClusterRequest.create({ > metadata: { > parentId: "", > name: "", > }, > spec: { > description: "", > networkId: "", > config: { > version: "16", > poolerConfig: { > poolingMode: > pg.ConnectionPoolerConfig_PoolingMode.TRANSACTION, > maxPoolSize: Long.fromNumber(), > }, > publicAccess: , > template: { > resources: { > platform: "cpu-e2", > preset: "", > }, > disk: { > type: "network-ssd", > sizeGibibytes: Long.fromNumber(), > }, > hosts: { > count: Long.fromNumber(), > }, > }, > }, > bootstrap: { > dbName: "", > userName: "", > userPassword: "", > }, > backup: { > backupWindowStart: "", > retentionPolicy: "d", > }, > }, > }); > // Set additional PostgreSQL parameters in > // createRequest.spec.config. > const createOperation = await createService.create( > createRequest, > ).result; > await createOperation.wait(); > ``` > > In the code, update the following values: > > * `metadata.parentId`: Project ID. > * `metadata.name`: Cluster name. > * `spec.description`: Cluster description. > * `spec.networkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk). > * `spec.config.poolerConfig.poolingMode`: Mode for allocating connections from the database connection pool. > * `spec.config.poolerConfig.maxPoolSize`: Number of connections allowed in a pool for a single database. > * `spec.config.publicAccess`: Whether the cluster has a public IP address and is accessible from the internet. > * `spec.config.template.resources.preset`: Resource preset. > * `spec.config.template.disk.sizeGibibytes`: Cluster storage disk size, in gibibytes. > * `spec.config.template.hosts.count`: Number of cluster hosts. > * `spec.bootstrap.dbName`: Database name. > * `spec.bootstrap.userName`: Username. > * `spec.bootstrap.userPassword`: Database password. > * `spec.backup.backupWindowStart`: Backup schedule, in `HH:MM:SS` format. > * `spec.backup.retentionPolicy`: Backup retention period, for example `7d`. > > To configure the database, set additional PostgreSQL parameters in `createRequest.spec.config`. ### How to restore clusters from backups Managed PostgreSQL creates daily backups for each cluster, and you can create a new cluster from a backup. For more details and instructions, see [Backups in Managed Service for PostgreSQL®](https://docs.nebius.com/postgresql/backups.md). ## How to modify clusters > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > > 2. Open the page of the required cluster and then go to the **Settings** tab. > > 3. Change the database pooling mode. Managed PostgreSQL supports the following options: > > * **Transaction**: A connection is allocated from a connection pool for every transaction. Once the transaction is completed, the connection returns to the pool. > > The transaction mode is suitable for a large number of idle connections. Additionally, this mode allows you to allocate a smaller pooling size in comparison with the session mode. > > However, the transaction mode offers a limited support of PostgreSQL features; not all PostgreSQL clients are compatible with this mode. > > * **Session** (set by default): A connection is allocated from a connection pool for every client session. Once the session is terminated, the connection returns to the pool. > > More PostgreSQL clients support the session mode, over the transaction mode. Moreover, the session mode does not limit the number of PostgreSQL features that you can use. > > However, a database has to consume more resources to maintain long-lasting connections. You may need to increase the pooling size. > > 4. In the **Access** field, select whether the cluster should have a public IP address and be accessible from the internet. > > 5. In the **Resource preset** field, change the number of vCPUs and RAM that should be allocated to the cluster. > > 6. In the **Disk size** field, increase the size of the cluster storage disk. You cannot decrease the disk size. Managed PostgreSQL resizes the cluster disks without recreating the cluster. > > 7. Change the number of hosts in the cluster. > > 8. In the **Database** section, change the password of the database user. The password must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > 9. Configure PostgreSQL additional parameters. > > > [accordion] Supported PostgreSQL parameters > > > > * [Autovacuum work mem](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM) > > * [Autovacuum vacuum cost delay](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-DELAY) > > * [Autovacuum vacuum cost limit](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-LIMIT) > > * [Autovacuum naptime](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-NAPTIME) > > * [Autovacuum vacuum scale factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR) > > * [Autovacuum analyze scale factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR) > > * [Statement timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-STATEMENT-TIMEOUT) > > * [Idle in transaction session timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT) > > * [Search path](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-SEARCH-PATH) > > * [Default transaction read-only](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY) > > * [Maximum connections](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-MAX-CONNECTIONS) > > * [Shared buffers](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-SHARED-BUFFERS) > [tab] CLI > > 1. Get the ID of the cluster via its name: > > ```bash > export PG_CLUSTER_ID=$(nebius msp postgresql v1alpha1 cluster \ > get-by-name --name --format jsonpath='{.metadata.id}') > ``` > > Alternatively, you can use the listing command: `nebius msp postgresql v1alpha1 cluster list`. > > 2. Update the cluster settings: > > ```bash > nebius msp postgresql v1alpha1 cluster update \ > --id $PG_CLUSTER_ID \ > --config-pooler-config-pooling-mode \ > --config-pooler-config-max-pool-size \ > --config-public-access= \ > --config-template-resources-preset \ > --config-template-disk-size-gibibytes \ > --config-template-hosts-count \ > --bootstrap-user-password \ > > ``` > > The command contains the following parameters: > > * `--config-pooler-config-pooling-mode`: Mode for allocating connections from the database connection pool. Managed PostgreSQL supports the following options: > > * **Transaction**: A connection is allocated from a connection pool for every transaction. Once the transaction is completed, the connection returns to the pool. > > The transaction mode is suitable for a large number of idle connections. Additionally, this mode allows you to allocate a smaller pooling size in comparison with the session mode. > > However, the transaction mode offers a limited support of PostgreSQL features; not all PostgreSQL clients are compatible with this mode. > > * **Session** (set by default): A connection is allocated from a connection pool for every client session. Once the session is terminated, the connection returns to the pool. > > More PostgreSQL clients support the session mode, over the transaction mode. Moreover, the session mode does not limit the number of PostgreSQL features that you can use. > > However, a database has to consume more resources to maintain long-lasting connections. You may need to increase the pooling size. > > * `--config-pooler-config-max-pool-size`: Number of connections allowed in a pool for a single database. > > * `--config-public-access`: If `true`, the cluster has both a public and a private IP address, and the cluster is accessible through the internet. > > * `--config-template-resources-preset`: Resource preset. Specify one of the [presets available for](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-non-gpu-platforms) `cpu-e2`. > > * `--config-template-disk-size-gibibytes`: Cluster storage disk size, in gibibytes. You can only increase the disk size, not decrease it. Managed PostgreSQL resizes the cluster disks without recreating the cluster. > > * `--config-template-hosts-count`: Number of cluster hosts. > > * `--bootstrap-user-password`: Password for this user. The password must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > To configure the database, you can additionally use PostgreSQL parameters. > > > [accordion] Supported PostgreSQL parameters > > > > * [--config-postgresql-config-16-autovacuum-work-mem](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM): From `-1` to `2147483647` (in kilobytes). > > * [--config-postgresql-config-16-autovacuum-vacuum-cost-delay](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-DELAY): From `-1` to `100` (in milliseconds). > > * [--config-postgresql-config-16-autovacuum-vacuum-cost-limit](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-LIMIT): From `-1` to `10000`. > > * [--config-postgresql-config-16-autovacuum-naptime](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-NAPTIME): From `1` to `2147483` (in seconds). > > * [--config-postgresql-config-16-autovacuum-vacuum-scale-factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR): From `0` to `100`. > > * [--config-postgresql-config-16-autovacuum-analyze-scale-factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR): From `0` to `100`. > > * [--config-postgresql-config-16-statement-timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-STATEMENT-TIMEOUT): From `0` to `2147483647` (in milliseconds). > > * [--config-postgresql-config-16-idle-in-transaction-session-timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT): From `0` to `2147483647` (in milliseconds). > > * [--config-postgresql-config-16-search-path](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-SEARCH-PATH) > > * [--config-postgresql-config-16-default-transaction-read-only](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY) > > * [--config-postgresql-config-16-max-connections](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-MAX-CONNECTIONS): From `100` to `12800`. > > * [--config-postgresql-config-16-shared-buffers](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-SHARED-BUFFERS): From `128` to `8589934584` (in kilobytes). > > Only the parameters from the command above can be changed. To perform a full cluster update, add `--full` to the command. This will update all parameters with the default values or the values specified in the `--full` command. > [tab] Terraform > > 1. Modify the manifest with the deployed infrastructure: > > ```hcl > resource "nebius_msp_postgresql_v1alpha1_cluster" "" { > name = "" > > config = { > pooler_config = { > pooling_mode = "" > max_pool_size = > } > public_access = > template = { > resources = { > preset = "" > ... > } > disk = { > type = "network-ssd" > size_gibibytes = > } > hosts = { > count = > } > postgresql_config_16 = { > > } > ... > } > postgresql_config_16 = { > > } > ... > } > > bootstrap = { > user_password = "" > ... > } > ... > } > ``` > > You can change the following parameters: > > * `name`: Cluster name. > > * `config`: Cluster configuration parameters: > > * `pooler_config.pooling_mode`: Mode for allocating connections from the database connection pool. Managed PostgreSQL supports the following options: > > * **Transaction**: A connection is allocated from a connection pool for every transaction. Once the transaction is completed, the connection returns to the pool. > > The transaction mode is suitable for a large number of idle connections. Additionally, this mode allows you to allocate a smaller pooling size in comparison with the session mode. > > However, the transaction mode offers a limited support of PostgreSQL features; not all PostgreSQL clients are compatible with this mode. > > * **Session** (set by default): A connection is allocated from a connection pool for every client session. Once the session is terminated, the connection returns to the pool. > > More PostgreSQL clients support the session mode, over the transaction mode. Moreover, the session mode does not limit the number of PostgreSQL features that you can use. > > However, a database has to consume more resources to maintain long-lasting connections. You may need to increase the pooling size. > > * `pooler_config.max_pool_size`: Number of connections allowed in a pool for a single database. > > * `public_access`: If `true`, the cluster has both a public and a private IP address and is accessible from the internet. > > * `template.resources.preset`: Resource preset. Specify one of the [presets available for](https://docs.nebius.com/compute/virtual-machines/types.md#presets-for-non-gpu-platforms) `cpu-e2`. > > * `template.disk.size_gibibytes`: Cluster storage disk size, in gibibytes. You can only increase the disk size, not decrease it. Managed PostgreSQL resizes the cluster disks without recreating the cluster. > > * `template.hosts.count`: Number of cluster hosts. > > * `postgresql_config_16`: Additional PostgreSQL parameters for the database configuration. > > > [accordion] Supported PostgreSQL parameters > > > > ```hcl > > postgresql_config_16 = { > > autovacuum_work_mem = > > autovacuum_vacuum_cost_delay = > > autovacuum_vacuum_cost_limit = <> > > autovacuum_naptime = > > autovacuum_vacuum_scale_factor = <> > > autovacuum_analyze_scale_factor = <> > > statement_timeout = > > idle_in_transaction_session_timeout = > > search_path = "<>" > > default_transaction_read_only = > > max_connections = <> > > shared_buffers = > > } > > ``` > > > > Supported PostgreSQL parameters: > > > > * [autovacuum\_work\_mem](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM): From `-1` to `2147483647`. > > * [autovacuum\_vacuum\_cost\_delay](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-DELAY): From `-1` to `100`. > > * [autovacuum\_vacuum\_cost\_limit](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-COST-LIMIT): From `-1` to `10000`. > > * [autovacuum\_naptime](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-NAPTIME): From `1` to `2147483`. > > * [autovacuum\_vacuum\_scale\_factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR): From `0` to `100`. > > * [autovacuum\_analyze\_scale\_factor](https://www.postgresql.org/docs/16/runtime-config-autovacuum.html#GUC-AUTOVACUUM-ANALYZE-SCALE-FACTOR): From `0` to `100`. > > * [statement\_timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-STATEMENT-TIMEOUT): From `0` to `2147483647`. > > * [idle\_in\_transaction\_session\_timeout](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT): From `0` to `2147483647`. > > * [search\_path](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-SEARCH-PATH) > > * [default\_transaction\_read\_only](https://www.postgresql.org/docs/16/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY) > > * [max\_connections](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-MAX-CONNECTIONS): From `100` to `12800`. > > * [shared\_buffers](https://www.postgresql.org/docs/16/runtime-config-resource.html#GUC-SHARED-BUFFERS): From `128` to `8589934584`. > > * `bootstrap.user_password`: Password for this user. The password must contain at least: > > * 8 characters > > * One lowercase character > > * One uppercase character > > * One special character > > > [!WARNING] > > > > If you change other settings, the cluster will be destroyed and then recreated with the new configuration. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the cluster ID by name: > > ```go > lookupService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > lookupCluster, err := lookupService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return fmt.Errorf("get by name: %w", err) > } > clusterID := lookupCluster.GetMetadata().GetId() > fmt.Println(clusterID) > ``` > > 2. Update the cluster settings: > > ```go > updateService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > updateCluster, err := updateService.Get( > ctx, > &pg.GetClusterRequest{ > Id: "", > }, > ) > if err != nil { > return fmt.Errorf("get: %w", err) > } > updateSpec := updateCluster.Spec > updateSpec.Config.PoolerConfig = &pg.ConnectionPoolerConfig{ > PoolingMode: pg.ConnectionPoolerConfig_SESSION, > MaxPoolSize: proto.Int64(), > } > updateSpec.Config.PublicAccess = > updateSpec.Config.Template.Resources.Preset = "" > updateSpec.Config.Template.Disk.SizeGibibytes = > updateSpec.Config.Template.Hosts.Count = > if updateSpec.Bootstrap == nil { > updateSpec.Bootstrap = &pg.BootstrapSpec{} > } > updateSpec.Bootstrap.UserPassword = "" > // Set additional PostgreSQL parameters in updateSpec.Config. > updateOperation, err := updateService.Update( > ctx, > &pg.UpdateClusterRequest{ > Metadata: updateCluster.Metadata, > Spec: updateSpec, > }, > ) > if err != nil { > return fmt.Errorf("update: %w", err) > } > _, err = updateOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for update: %w", err) > } > ``` > > In the code, set `GetClusterRequest.Id` to the cluster ID that you got in the previous step. > > You can update the following parameters: > > * `updateSpec.Config.PoolerConfig.PoolingMode`: Mode for allocating connections from the database connection pool. > * `updateSpec.Config.PoolerConfig.MaxPoolSize`: Number of connections allowed in a pool for a single database. > * `updateSpec.Config.PublicAccess`: Whether the cluster has a public IP address and is accessible from the internet. > * `updateSpec.Config.Template.Resources.Preset`: Resource preset. > * `updateSpec.Config.Template.Disk.SizeGibibytes`: Cluster storage disk size, in gibibytes. > * `updateSpec.Config.Template.Hosts.Count`: Number of cluster hosts. > * `updateSpec.Bootstrap.UserPassword`: Password for the database user. > * `updateSpec.Config`: Additional PostgreSQL parameters for the database configuration. > [tab] Python SDK > > 1. Get the cluster ID by name: > > ```python > lookup_service = pg.ClusterServiceClient(sdk) > lookup_cluster = await lookup_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > cluster_id = lookup_cluster.metadata.id > print(cluster_id) > ``` > > 2. Update the cluster settings: > > ```python > update_service = pg.ClusterServiceClient(sdk) > update_cluster = await update_service.get( > pg.GetClusterRequest(id=""), > ) > update_spec = update_cluster.spec > update_spec.config.pooler_config = pg.ConnectionPoolerConfig( > pooling_mode=( > pg.ConnectionPoolerConfig.PoolingMode. > SESSION > ), > max_pool_size=, > ) > update_spec.config.public_access = > update_spec.config.template.resources.preset = "" > update_spec.config.template.disk.size_gibibytes = > update_spec.config.template.hosts.count = > update_spec.bootstrap.user_password = "" > # Set additional PostgreSQL parameters in update_spec.config. > update_operation = await update_service.update( > pg.UpdateClusterRequest( > metadata=update_cluster.metadata, > spec=update_spec, > ), > ) > await update_operation.wait() > ``` > > In the code, set `GetClusterRequest.id` to the cluster ID that you got in the previous step. > > You can update the following parameters: > > * `update_spec.config.pooler_config.pooling_mode`: Mode for allocating connections from the database connection pool. > * `update_spec.config.pooler_config.max_pool_size`: Number of connections allowed in a pool for a single database. > * `update_spec.config.public_access`: Whether the cluster has a public IP address and is accessible from the internet. > * `update_spec.config.template.resources.preset`: Resource preset. > * `update_spec.config.template.disk.size_gibibytes`: Cluster storage disk size, in gibibytes. > * `update_spec.config.template.hosts.count`: Number of cluster hosts. > * `update_spec.bootstrap.user_password`: Password for the database user. > * `update_spec.config`: Additional PostgreSQL parameters for the database configuration. > [tab] JavaScript SDK > > 1. Get the cluster ID by name: > > ```ts > const lookupService = new pg.ClusterService(sdk); > const lookupCluster = await lookupService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > const clusterId = lookupCluster.metadata.id; > console.log(clusterId); > ``` > > 2. Update the cluster settings: > > ```ts > const updateService = new pg.ClusterService(sdk); > const updateCluster = await updateService.get( > pg.GetClusterRequest.create({ id: "" }), > ).result; > const updateSpec = updateCluster.spec; > updateSpec.config.poolerConfig = pg.ConnectionPoolerConfig.create({ > poolingMode: pg.ConnectionPoolerConfig_PoolingMode. > SESSION, > maxPoolSize: Long.fromNumber(), > }); > updateSpec.config.publicAccess = ; > updateSpec.config.template.resources.preset = ""; > updateSpec.config.template.disk.sizeGibibytes = > Long.fromNumber(); > updateSpec.config.template.hosts.count = > Long.fromNumber(); > updateSpec.bootstrap ??= pg.BootstrapSpec.create(); > updateSpec.bootstrap.userPassword = ""; > // Set additional PostgreSQL parameters in updateSpec.config. > const updateOperation = await updateService.update( > pg.UpdateClusterRequest.create({ > metadata: updateCluster.metadata, > spec: updateSpec, > }), > ).result; > await updateOperation.wait(); > ``` > > In the code, set `GetClusterRequest.id` to the cluster ID that you got in the previous step. > > You can update the following parameters: > > * `updateSpec.config.poolerConfig.poolingMode`: Mode for allocating connections from the database connection pool. > * `updateSpec.config.poolerConfig.maxPoolSize`: Number of connections allowed in a pool for a single database. > * `updateSpec.config.publicAccess`: Whether the cluster has a public IP address and is accessible from the internet. > * `updateSpec.config.template.resources.preset`: Resource preset. > * `updateSpec.config.template.disk.sizeGibibytes`: Cluster storage disk size, in gibibytes. > * `updateSpec.config.template.hosts.count`: Number of cluster hosts. > * `updateSpec.bootstrap.userPassword`: Password for the database user. > * `updateSpec.config`: Additional PostgreSQL parameters for the database configuration. ## How to delete clusters > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > > 2. Click the cluster you want to delete. > > 3. On the **Settings** tab, click **Delete cluster**. > > 4. In the dialog window, enter the cluster name and click **Delete cluster**. > [tab] CLI > > 1. Copy the ID of the cluster you want to delete. Run the following command: > > ```bash > nebius msp postgresql v1alpha1 cluster list --page-size 10 > ``` > > On the list of clusters, you'll get the cluster IDs under `metadata:id`. > > 2. Export the ID of the cluster to an environment variable: > > ```bash > export CLUSTER_ID_DELETION= > ``` > > 3. Run the following command to delete your cluster: > > ```bash > nebius msp postgresql v1alpha1 cluster delete --id $CLUSTER_ID_DELETION > ``` > [tab] Terraform > > 1. Remove the corresponding `nebius_msp_postgresql_v1alpha1_cluster` resource from the configuration file. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > deleteClusterService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > deleteClusterOperation, err := deleteClusterService.Delete( > ctx, > &pg.DeleteClusterRequest{ > Id: "", > }, > ) > if err != nil { > return fmt.Errorf("delete: %w", err) > } > _, err = deleteClusterOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for delete: %w", err) > } > ``` > > In the code, set `DeleteClusterRequest.Id` to the cluster ID. > [tab] Python SDK > > ```python > delete_cluster_service = pg.ClusterServiceClient(sdk) > delete_cluster_operation = await delete_cluster_service.delete( > pg.DeleteClusterRequest( > id="", > ), > ) > await delete_cluster_operation.wait() > ``` > > In the code, set `DeleteClusterRequest.id` to the cluster ID. > [tab] JavaScript SDK > > ```ts > const deleteClusterService = new pg.ClusterService(sdk); > const deleteClusterOperation = await deleteClusterService.delete( > pg.DeleteClusterRequest.create({ > id: "", > }), > ).result; > await deleteClusterOperation.wait(); > ``` > > In the code, set `DeleteClusterRequest.id` to the cluster ID. > [!TIP] > > You can later [restore](https://docs.nebius.com/postgresql/backups.md#how-to-restore-a-cluster-from-a-backup) a deleted cluster from its backup. Managed PostgreSQL preserves backups of deleted clusters for the retention period configured in the [backup settings](https://docs.nebius.com/postgresql/backups.md#how-to-configure-automatic-backups). *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Creating, modifying and deleting databases in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/databases/manage.md To work with a database in a Managed Service for PostgreSQL cluster, you need to [connect](https://docs.nebius.com/postgresql/databases/connect.md) to it. Once you connect to the cluster, all [PostgreSQL commands](https://www.postgresql.org/docs/current/sql-commands.html) are available for you to execute. For example, you can perform these basic operations: * [Create databases](https://docs.nebius.com/postgresql/databases/manage.md#how-to-create-databases) * [Modify databases](https://docs.nebius.com/postgresql/databases/manage.md#how-to-modify-databases) * [Delete databases](https://docs.nebius.com/postgresql/databases/manage.md#how-to-delete-databases) ## How to create databases To create a database, run the [CREATE DATABASE](https://www.postgresql.org/docs/current/sql-createdatabase.html) command: ```sql CREATE DATABASE ; ``` Every cluster has at least one default database, which you specified when [creating the cluster](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters). Use the `\l` command to list all databases in the cluster. When a new database is created, you don't automatically switch to it. Use the `\c ` command to connect to the database you just created. ## How to modify databases To make changes to a database, run the [ALTER DATABASE](https://www.postgresql.org/docs/current/sql-alterdatabase.html) command: ```sql ALTER DATABASE ; ``` For example, you can rename the database: ```sql ALTER DATABASE db_test RENAME TO old_testdb; ``` Note that you can't rename the current database. Connect to another database, first. ## How to delete databases > [!WARNING] > > Do not delete the default database, as this may cause the service to malfunction. To delete a database, run the [DROP DATABASE](https://www.postgresql.org/docs/current/sql-dropdatabase.html) command. This operation cannot be undone. ```sql DROP DATABASE ; ``` *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Connecting to databases in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/databases/connect.md To work with a database in a Managed Service for PostgreSQL cluster, you need to connect to it. ## Prerequisites 1. [Create a cluster](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters) and securely store the password you specified during creation. 2. To connect to a database, install `psql`, a PostgreSQL command line client: > [tab] macOS > > ```bash > brew install libpq > echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc > ``` > > After that, restart the terminal. > [tab] Ubuntu > > ```bash > sudo apt update && sudo apt install postgresql-client > ``` 3. To secure connections to databases, install the Nebius AI Cloud certificate: ```bash mkdir -p ~/.postgresql \ curl "https://storage.eu-north1.nebius.cloud/msp-certs/ca.pem" \ -o ~/.postgresql/root.crt \ chmod 0600 ~/.postgresql/root.crt ``` This command creates the `.postgresql` folder, downloads the certificate into it and then sets the access rights to the certificate file. 4. Prepare the interface that you use to get connection endpoints. If you use the web console, you can skip this step. If you use the CLI or an SDK, install and configure one of the following tools: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to connect to a database Go to the web console and get the connection command with all data filled in for your cluster: > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > 2. Click your cluster. > 3. Click **How to connect**. > 4. Copy the connection command from the window that opens. Enter this command in the terminal. You will be asked for the password you specified when [creating the cluster](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters). ### Details of the connection command The connection command that you copy from the web console looks like this: ```bash psql "host= \ port=5432 \ sslmode=verify-full \ dbname= \ user=" ``` It contains the following parameters: * ``: Default database name that you specified when creating the cluster. If you created another database in this cluster, you can use its name instead. * ``: Username you specified when creating the cluster. > [!NOTE] > > Once you create other databases and [users](https://docs.nebius.com/postgresql/databases/users.md#create-a-new-user), you can use their names instead. * ``: Depends on where you are connecting from: * To connect from the internet, use the public cluster endpoint. You can connect from the internet only if you enabled public access to the cluster when you created it. * To connect from other Nebius AI Cloud resources, use the private cluster endpoint. To get the endpoints: > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > 2. Click your cluster. > 3. Click **Copy endpoint URL** and select **Public RW endpoint URL** to copy the public cluster endpoint, or **Private RW endpoint URL** to copy the private cluster endpoint. > [tab] CLI > > Get the URLs from cluster data: > > ```bash > nebius msp postgresql v1alpha1 cluster get-by-name \ > --name \ > --format jsonpath='{.status.connection_endpoints.public_read_write}' > > nebius msp postgresql v1alpha1 cluster get-by-name \ > --name \ > --format jsonpath='{.status.connection_endpoints.private_read_write}' > ``` > [tab] Go SDK > > Get the URLs from cluster data: > > ```go > endpointService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > publicCluster, err := endpointService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return fmt.Errorf("get by name: %w", err) > } > fmt.Println(publicCluster.GetStatus(). > GetConnectionEndpoints().GetPublicReadWrite()) > privateCluster, err := endpointService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return fmt.Errorf("get by name: %w", err) > } > fmt.Println(privateCluster.GetStatus(). > GetConnectionEndpoints().GetPrivateReadWrite()) > ``` > > In the code, update the following values: > > * `GetByNameRequest.ParentId`: Project ID. > * `GetByNameRequest.Name`: Cluster name. > > The response returns the endpoints in: > > * `Status.ConnectionEndpoints.PublicReadWrite` > * `Status.ConnectionEndpoints.PrivateReadWrite` > [tab] Python SDK > > Get the URLs from cluster data: > > ```python > endpoint_service = pg.ClusterServiceClient(sdk) > public_cluster = await endpoint_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > print(public_cluster.status.connection_endpoints.public_read_write) > private_cluster = await endpoint_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > print(private_cluster.status.connection_endpoints.private_read_write) > ``` > > In the code, update the following values: > > * `GetByNameRequest.parent_id`: Project ID. > * `GetByNameRequest.name`: Cluster name. > > The response returns the endpoints in: > > * `status.connection_endpoints.public_read_write` > * `status.connection_endpoints.private_read_write` > [tab] JavaScript SDK > > Get the URLs from cluster data: > > ```ts > const endpointService = new pg.ClusterService(sdk); > const publicCluster = await endpointService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log( > publicCluster.status?.connectionEndpoints?.publicReadWrite ?? "", > ); > const privateCluster = await endpointService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log( > privateCluster.status?.connectionEndpoints?.privateReadWrite ?? "", > ); > ``` > > In the code, update the following values: > > * `GetByNameRequest.parentId`: Project ID. > * `GetByNameRequest.name`: Cluster name. > > The response returns the endpoints in: > > * `status.connectionEndpoints.publicReadWrite` > * `status.connectionEndpoints.privateReadWrite` *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Users and user privileges in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/databases/users.md When you [create a cluster](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters) in Managed Service for PostgreSQL, you set names for a default database and a default user (also called bootstrap user). After that, [connect](https://docs.nebius.com/postgresql/databases/connect.md) to the cluster as the bootstrap user and [create other users](https://docs.nebius.com/postgresql/databases/users.md#create-a-new-user). > [!NOTE] > > Do not routinely work with the cluster as the bootstrap user. Create other users with the necessary privileges and leave the bootstrap user as a fallback in case of emergency. ## Bootstrap user privileges The bootstrap user is not a superuser but has administrative privileges. It has the `msp_admin` and `msp_superuser` roles defined in Managed Service for PostgreSQL. * `msp_admin` gives the following privileges: * `pg_monitor` and `pg_signal_backend` [predefined roles](https://www.postgresql.org/docs/current/predefined-roles.html). * Subscription for logical replication (`CREATE | DROP | ALTER SUBSCRIPTION`). * Ability to enable [extensions](https://docs.nebius.com/postgresql/databases/extensions.md) (`CREATE EXTENSION`). * Extension-specific functions: `pg_stat_reset()` and `pg_stat_statements_reset()` from the [pg\_stat\_statements](https://www.postgresql.org/docs/16/pgstatstatements.html) extension. * `msp_superuser` enables you to bypass ownership verification when you grant and revoke privileges. When you connect as the bootstrap user and create new users, you can grant them the `msp_admin` role but not the `msp_superuser` role. ## Prerequisites To create or delete database users, [connect](https://docs.nebius.com/postgresql/databases/connect.md) to the cluster via `psql` as a user with administrative privileges. If you use the web console to change the bootstrap user password, you don't need to complete any additional prerequisites. If you use the CLI, Terraform or an SDK to change the bootstrap user password, install and configure one of the following tools: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to manage users ### Create a new user 1. [Connect](https://docs.nebius.com/postgresql/databases/connect.md) to the cluster via psql as a user with administrative privileges (for example, the bootstrap user). 2. Create a new user with privileges to connect to a `` database. Execute the following SQL statements: ```sql CREATE USER PASSWORD ''; GRANT CONNECT ON DATABASE TO ; ``` `` can connect to the `` database and work with the data. The following usernames are reserved, do not specify them: `admin`, `repl`, `monitor`, `postgres`, `public` and `none`. 3. (Optional) If you need to grant them additional privileges for the database: 1. Connect to the cluster as the user that owns the `` database. Usually, the database owner is the user who created it. Alternatively, connect as the bootstrap user to bypass the database ownership check. 2. Execute the following SQL statement: ```sql GRANT ALL PRIVILEGES ON DATABASE TO ; ``` See more details on user roles and privileges in the [PostgreSQL documentation](https://www.postgresql.org/docs/16/user-manag.html). ### Create a new user with administrative privileges To create a user with administrative privileges, connect as the bootstrap user and execute the following SQL statements: ```sql CREATE USER CREATEDB CREATEROLE PASSWORD ''; GRANT msp_admin TO ; ``` `` can create databases, create users, and grant them privileges. The `msp_admin` role lets them bypass checks when interacting with data. You cannot grant the `msp_superuser` role. You can grant any [predefined roles](https://www.postgresql.org/docs/current/predefined-roles.html) except for the following: * `role_pg_read_server_files` * `role_pg_write_server_files` * `role_pg_execute_server_program` * `role_pg_read_all_data` * `role_pg_write_all_data` The following usernames are reserved, do not specify them: `admin`, `repl`, `monitor`, `postgres`, `public` and `none`. ### Manage the bootstrap user > [!WARNING] > > Change the password for the bootstrap user only via Nebius AI Cloud interfaces: web console, CLI, Terraform provider, or SDKs. Don't change it by using SQL statements, as the password will eventually be reset to the one created via Nebius AI Cloud interfaces. To change the password of the bootstrap user: > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > 2. Click your cluster and go to **Settings**. > 3. In the **Database** section, enter the new password. > 4. Click **Update cluster**. > [tab] CLI > > Run the following command: > > ```bash > nebius msp postgresql v1alpha1 cluster update \ > --id \ > --parent-id \ > --bootstrap-user-password > ``` > [tab] Terraform > > 1. In your Terraform configuration (`main.tf`), change the value of `bootstrap.user_password` within the `nebius_msp_postgresql_v1alpha1_cluster` [resource](https://docs.nebius.com/terraform-provider/reference/resources/msp_postgresql_v1alpha1_cluster.md#nested-schema-for): > > ```terraform > resource "nebius_msp_postgresql_v1alpha1_cluster" "" { > ... > bootstrap = { > db_name = "" > user_name = "" > user_password = "" > } > ... > } > ``` > > 2. Update the configuration: > > ```bash > terraform apply > ``` > [tab] Go SDK > > ```go > passwordService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > passwordCluster, err := passwordService.Get( > ctx, > &pg.GetClusterRequest{ > Id: "", > }, > ) > if err != nil { > return fmt.Errorf("get: %w", err) > } > passwordSpec := passwordCluster.Spec > if passwordSpec.Bootstrap == nil { > passwordSpec.Bootstrap = &pg.BootstrapSpec{} > } > passwordSpec.Bootstrap.UserPassword = "" > passwordCluster.Metadata.ParentId = "" > passwordOperation, err := passwordService.Update( > ctx, > &pg.UpdateClusterRequest{ > Metadata: passwordCluster.Metadata, > Spec: passwordSpec, > }, > ) > if err != nil { > return fmt.Errorf("update: %w", err) > } > _, err = passwordOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for update: %w", err) > } > ``` > > In the code, update the following values: > > * `GetClusterRequest.Id`: Cluster ID. > * `passwordSpec.Bootstrap.UserPassword`: New password. > * `passwordCluster.Metadata.ParentId`: Project ID. > [tab] Python SDK > > ```python > password_service = pg.ClusterServiceClient(sdk) > password_cluster = await password_service.get( > pg.GetClusterRequest(id=""), > ) > password_spec = password_cluster.spec > password_spec.bootstrap.user_password = "" > password_cluster.metadata.parent_id = "" > password_operation = await password_service.update( > pg.UpdateClusterRequest( > metadata=password_cluster.metadata, > spec=password_spec, > ), > ) > await password_operation.wait() > ``` > > In the code, update the following values: > > * `GetClusterRequest.id`: Cluster ID. > * `password_spec.bootstrap.user_password`: New password. > * `password_cluster.metadata.parent_id`: Project ID. > [tab] JavaScript SDK > > ```ts > const passwordService = new pg.ClusterService(sdk); > const passwordCluster = await passwordService.get( > pg.GetClusterRequest.create({ id: "" }), > ).result; > const passwordSpec = passwordCluster.spec; > passwordSpec.bootstrap ??= pg.BootstrapSpec.create(); > passwordSpec.bootstrap.userPassword = ""; > passwordCluster.metadata.parentId = ""; > const passwordOperation = await passwordService.update( > pg.UpdateClusterRequest.create({ > metadata: passwordCluster.metadata, > spec: passwordSpec, > }), > ).result; > await passwordOperation.wait(); > ``` > > In the code, update the following values: > > * `GetClusterRequest.id`: Cluster ID. > * `passwordSpec.bootstrap.userPassword`: New password. > * `passwordCluster.metadata.parentId`: Project ID. ### Delete a user > [!WARNING] > > Do not delete the bootstrap user, as this may cause the service to malfunction. To delete a user, connect to the cluster as a user with administrative privileges and execute the following SQL statement: ```sql DROP USER ; ``` *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Extensions in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/databases/extensions.md Managed Service for PostgreSQL clusters are created with pre-installed PostgreSQL extensions. You can enable any of these extensions for your databases, but you cannot install any other extensions. See the full list of available extensions [below](https://docs.nebius.com/postgresql/databases/extensions.md#available-extensions), or you can [request the list](https://docs.nebius.com/postgresql/databases/extensions.md#how-to-request-the-list-of-installed-extensions). ## How to enable an extension for a database To enable an extension for a database, execute the [CREATE EXTENSION](https://www.postgresql.org/docs/16/sql-createextension.html) statement: ```sql CREATE EXTENSION ; ``` This command does not affect other databases in the cluster. To use an extension in other databases, execute `CREATE EXTENSION` in each one as needed. ### Example: pgvector extension To get started with the [pgvector](https://github.com/pgvector/pgvector) open-source extension, which provides vector operations, follow these steps: 1. Add the extension: ```sql CREATE EXTENSION vector; ``` 2. Create a table with a vector column: ```sql CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); ``` 3. Insert some vectors into the new table: ```sql INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]'); ``` 4. Get the contents of the table sorted by how close each value is to a given vector (that is, sorted by [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance)): ```sql SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5; ``` ## How to request the list of installed extensions To get the list of extensions available on your cluster, execute the following statement: ```sql SELECT * FROM pg_available_extensions; ``` To look for a particular extension, execute the following statement: ```sql SELECT * FROM pg_available_extensions WHERE name LIKE ''; ``` ## Available extensions | Extension | Version | Description | | - | - | - | | [adminpack](https://www.postgresql.org/docs/16/adminpack.html) | 2.1 | Provides support functions for administration and management tools. | | [amcheck](https://www.postgresql.org/docs/16/amcheck.html) | 1.3 | Provides functions that verify the logical consistency of the structure of relations. | | [autoinc](https://www.postgresql.org/docs/16/contrib-spi.html#CONTRIB-SPI-AUTOINC) | 1.0 | Provides functions that autoincrement fields. | | [bloom](https://www.postgresql.org/docs/16/bloom.html) | 1.0 | Implements an index access method based on Bloom filters. | | [btree\_gin](https://www.postgresql.org/docs/16/btree-gin.html) | 1.3 | Supports indexing common data types by using GIN (generalized inverted index). | | [btree\_gist](https://www.postgresql.org/docs/16/btree-gist.html) | 1.7 | Supports indexing common data types by using GiST (generalized search tree). | | [citext](https://www.postgresql.org/docs/16/citext.html) | 1.6 | Defines a data type for case-insensitive character strings. | | [cube](https://www.postgresql.org/docs/16/cube.html) | 1.5 | Defines a data type for multidimensional cubes. | | [dblink](https://www.postgresql.org/docs/16/dblink.html) | 1.2 | Allows connections to other PostgreSQL databases from within a database. | | [dict\_int](https://www.postgresql.org/docs/16/dict-int.html) | 1.0 | Defines a text search dictionary template for processing integers. | | [dict\_xsyn](https://www.postgresql.org/docs/16/dict-xsyn.html) | 1.0 | Defines a text search dictionary template for extended synonym processing. | | [earthdistance](https://www.postgresql.org/docs/16/earthdistance.html) | 1.1 | Calculates great-circle distances on the surface of the Earth. | | [file\_fdw](https://www.postgresql.org/docs/16/file-fdw.html) | 1.0 | Provides a foreign-data wrapper to access data files in the server's file system. | | [fuzzystrmatch](https://www.postgresql.org/docs/16/fuzzystrmatch.html) | 1.2 | Provides functions that determine similarities and distances between strings. | | [hstore](https://www.postgresql.org/docs/16/hstore.html) | 1.8 | Defines a data type that stores sets of key-value pairs. | | [insert\_username](https://www.postgresql.org/docs/16/contrib-spi.html#CONTRIB-SPI-INSERT-USERNAME) | 1.0 | Provides functions that track which user changed a table. | | [intagg](https://www.postgresql.org/docs/16/intagg.html) | 1.1 | Defines an integer aggregator and enumerator. The module is provided for compatibility and is obsolete. | | [intarray](https://www.postgresql.org/docs/16/intarray.html) | 1.5 | Provides functions and operators that manipulate null-free arrays of integers. | | [isn](https://www.postgresql.org/docs/16/isn.html) | 1.2 | Defines data types for international product numbering standards. | | [lo](https://www.postgresql.org/docs/16/lo.html) | 1.1 | Supports large object management. | | [ltree](https://www.postgresql.org/docs/16/ltree.html) | 1.2 | Defines a data type for hierarchical tree-like structures. | | [moddatetime](https://www.postgresql.org/docs/16/contrib-spi.html#CONTRIB-SPI-MODDATETIME) | 1.0 | Provides functions that track the last modification time of records. | | [old\_snapshot](https://www.postgresql.org/docs/16/oldsnapshot.html) | 1.0 | Provides utilities that manage old snapshot thresholds. | | [pageinspect](https://www.postgresql.org/docs/16/pageinspect.html) | 1.12 | Provides functions that inspect the contents of database pages at a low level. | | [pg\_buffercache](https://www.postgresql.org/docs/16/pgbuffercache.html) | 1.4 | Provides a means of examining the shared buffer cache. | | [pg\_freespacemap](https://www.postgresql.org/docs/16/pgfreespacemap.html) | 1.2 | Provides a means of examining the free space map. | | [pg\_prewarm](https://www.postgresql.org/docs/16/pgprewarm.html) | 1.2 | Loads relation data into the buffer cache. | | [pg\_repack](https://github.com/reorg/pg_repack) | 1.5.2 | Reorganizes tables and indexes with minimal locks. See [how to run pg\_repack](https://docs.nebius.com/postgresql/databases/extensions.md#how-to-run-pg_repack) on a Managed Service for PostgreSQL cluster. | | [pg\_stat\_statements](https://www.postgresql.org/docs/16/pgstatstatements.html) | 1.10 | Tracks planning and execution statistics for SQL statements. | | [pg\_surgery](https://www.postgresql.org/docs/16/pgsurgery.html) | 1.0 | Provides functions that perform "surgery" on damaged relations. | | [pg\_trgm](https://www.postgresql.org/docs/16/pgtrgm.html) | 1.6 | Measures text similarity and supports index searching based on trigram matching. | | [pg\_visibility](https://www.postgresql.org/docs/16/pgvisibility.html) | 1.2 | Provides a means of examining the visibility map and page-level visibility information. | | [pg\_walinspect](https://www.postgresql.org/docs/16/pgwalinspect.html) | 1.1 | Provides functions that inspect the PostgreSQL write-ahead log. | | [pgaudit](https://github.com/pgaudit/pgaudit) | 16.0 | Provides detailed session and object audit logging via the standard PostgreSQL logging facility. | | [pgcrypto](https://www.postgresql.org/docs/16/pgcrypto.html) | 1.3 | Provides cryptographic functions. | | [pgrowlocks](https://www.postgresql.org/docs/16/pgrowlocks.html) | 1.2 | Displays row-level locking information. | | [pgstattuple](https://www.postgresql.org/docs/16/pgstattuple.html) | 1.5 | Provides functions to obtain tuple-level statistics. | | [plpgsql](https://www.postgresql.org/docs/16/plpgsql.html) | 1.0 | PL/pgSQL procedural language for PostgreSQL. | | [postgres\_fdw](https://www.postgresql.org/docs/16/postgres-fdw.html) | 1.1 | Provides a foreign-data wrapper for connecting to external PostgreSQL servers. | | [refint](https://www.postgresql.org/docs/16/contrib-spi.html#CONTRIB-SPI-REFINT) | 1.0 | Provides functions for referential integrity. The module is provided for compatibility and is obsolete. | | [rum](https://github.com/postgrespro/rum) | 1.3 | Provides an access method for working with RUM indexes. | | [seg](https://www.postgresql.org/docs/16/seg.html) | 1.4 | Defines a data type that represents line segments or floating-point intervals. | | [sslinfo](https://www.postgresql.org/docs/16/sslinfo.html) | 1.2 | Provides information about SSL certificates. | | [tablefunc](https://www.postgresql.org/docs/16/tablefunc.html) | 1.0 | Implements functions that manipulate whole tables, including `crosstab` operations. | | [tcn](https://www.postgresql.org/docs/16/tcn.html) | 1.0 | Provides a trigger function that notifies listeners of changes. | | [tsm\_system\_rows](https://www.postgresql.org/docs/16/tsm-system-rows.html) | 1.0 | Provides a `TABLESAMPLE` method that reads no more than the given number of rows. | | [tsm\_system\_time](https://www.postgresql.org/docs/16/tsm-system-time.html) | 1.0 | Provides a `TABLESAMPLE` method that spends no longer than the given time to read the table. | | [unaccent](https://www.postgresql.org/docs/16/unaccent.html) | 1.1 | Defines a text search dictionary that removes diacritics. | | [uuid-ossp](https://www.postgresql.org/docs/16/uuid-ossp.html) | 1.1 | Generates universally unique identifiers (UUIDs). | | [vector (pgvector)](https://github.com/pgvector/pgvector) | 0.8 | Defines a vector data type with `ivfflat` and `hnsw` access methods for vector searches. | | [xml2](https://www.postgresql.org/docs/16/xml2.html) | 1.1 | Provides functions for XPath querying and XSLT processing. | ## How to run pg\_repack Managed Service for PostgreSQL clusters do not provide superuser access. Therefore, run the [pg\_repack](https://github.com/reorg/pg_repack) extension only on the tables that you own and include the `--no-superuser-check` parameter. For example: ```bash pg_repack \ --host= \ --dbname= \ --username= \ --table= \ --jobs=4 \ --wait-timeout=600 \ --no-superuser-check ``` In this command, specify the same parameters that you use for [connecting to the cluster](https://docs.nebius.com/postgresql/databases/connect.md). Ensure that `` owns ``. *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Migration from or to a Managed Service for PostgreSQL® cluster Source: https://docs.nebius.com/postgresql/data-transfers/migrate-data.md You can migrate tables and schemas from or to a Managed Service for PostgreSQL cluster. To do this, create a dump of the source cluster by using the [pg\_dump](https://www.postgresql.org/docs/current/app-pgdump.html) utility. Next, restore the dump in the target cluster by using the [pg\_restore](https://www.postgresql.org/docs/current/app-pgrestore.html) utility. > [!NOTE] > > Instead of using migration, you can [replicate data](https://docs.nebius.com/postgresql/replication/from-external.md) from an external cluster to a Managed PostgreSQL cluster. ## Steps 1. [Prepare a target cluster](https://docs.nebius.com/postgresql/data-transfers/migrate-data.md#prepare-a-target-cluster). 2. [Migrate data](https://docs.nebius.com/postgresql/data-transfers/migrate-data.md#migrate-data). ## Prerequisites The migration is only possible if the following conditions are met: * The PostgreSQL version in the source cluster is the same as in the target cluster. You can check the versions supported by Managed PostgreSQL on the cluster creation page in the [web console](https://console.nebius.com). * The `pg_dump` and `pg_restore` utilities have the same version. You can install these utilities together with `psql`: > [tab] macOS > > ```bash > brew install libpq > echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc > ``` > > After that, restart the terminal. > [tab] Ubuntu > > ```bash > sudo apt update && sudo apt install postgresql-client > ``` * The major version of the utilities must be greater than or equal to the PostgreSQL version in the target cluster. For example, if the cluster is created with version 16, the major version of the utilities can be 16 or 17. ## Prepare a target cluster 1. Create a target cluster with the same username as in the source cluster. For details on how to create a Managed Service for PostgreSQL cluster, see [How to create clusters](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters). 2. Make sure that the target cluster has at least the same list of installed PostgreSQL extensions as the source cluster does: 1. Connect to the database in the source cluster and then check what extensions are installed: ```sql SELECT * FROM pg_available_extensions; ``` 2. [Enable these extensions](https://docs.nebius.com/postgresql/databases/extensions.md) on a target cluster. 3. To secure connections to databases, install the Nebius AI Cloud certificate: ```bash mkdir -p ~/.postgresql \ curl "https://storage.eu-north1.nebius.cloud/msp-certs/ca.pem" \ -o ~/.postgresql/root.crt \ chmod 0600 ~/.postgresql/root.crt ``` This command creates the `.postgresql` folder, downloads the certificate into it and then sets the access rights to the certificate file. ## Migrate data 1. Switch the source database to read-only mode: ```sql ALTER USER SET default_transaction_read_only = on; ``` Run this statement for every database user. 2. Create the source database dump: ```bash pg_dump --host= \ --port= \ --dbname= \ --username= \ --jobs= \ --format=d \ --file=db_dump ``` Specify the following parameters in the command: * `--host`: IP address or FQDN of the primary host of the source cluster. * `--port`: Port to access the source cluster. * `--dbname`: Source database name. * `--username`: Username in the source cluster. * `--jobs` (optional): To speed up the dump creation and activate a multithreaded mode, specify the number of vCPU cores on which dump creation threads run in parallel. 3. Restore the data from the dump to the target cluster: ```bash pg_restore --host= \ --dbname= \ --username= \ --port=5432 \ --format=d \ --verbose \ --file=db_dump \ --single-transaction \ --no-privileges ``` Specify the following parameters in the command: * `--host`: IP address or FQDN of the primary host of the target cluster. * `--dbname`: Target database name. * `--username`: Username in the target cluster. Must match the username in the source cluster. If you restore all the data from the source database, specify the database owner username. If you only restore a single schema, add the `--schema=` parameter. In this case, the database owner rights are not required. If the specified user does not have rights to create or update the PostgreSQL extensions and this causes errors during restoration, remove the `--single-transaction` parameter from the command. The service ignores the errors in this case: ```text pg_restore: warning: errors ignored on restore: 3 ``` However, make sure that these errors only apply to the extensions. 4. Connect to the target database and check the integrity of the migrated data: * To check the list of tables, run `\dt`. * To check the list of schemas, run `\dn`. *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Replicating data to Managed Service for PostgreSQL® from an external PostgreSQL cluster Source: https://docs.nebius.com/postgresql/replication/from-external.md Managed Service for PostgreSQL supports logical replication, enabling you to replicate data from external PostgreSQL instances into your Nebius AI Cloud cluster. This feature facilitates data migration, synchronization, and integration between different PostgreSQL databases. See the PostgreSQL documentation for more information about [logical replication](https://www.postgresql.org/docs/16/logical-replication.html) and the associated [restrictions](https://www.postgresql.org/docs/16/logical-replication-restrictions.html). > [!NOTE] > > Instead of using replication, you can [move data](https://docs.nebius.com/postgresql/data-transfers/migrate-data.md) from or to a Managed PostgreSQL cluster. ## Prerequisites * The external PostgreSQL cluster should be running version 10 or higher. * The Managed PostgreSQL cluster must be able to connect to the external PostgreSQL cluster. Ensure that incoming connections are allowed for the external PostgreSQL cluster from the internet. ## Configure the replication source Set up the external PostgreSQL cluster: 1. Enable logical replication by setting `wal_level = logical` in the `postgresql.conf` file. 2. Create a user with replication privileges: ```sql CREATE ROLE WITH REPLICATION LOGIN PASSWORD ''; ``` 3. Create a publication for the tables you wish to replicate: ```sql CREATE PUBLICATION FOR TABLE ; ``` ## Configure the replication target Set up the Managed PostgreSQL cluster: 1. In your Managed PostgreSQL cluster, create the table that will receive the replicated data. Ensure that the table schema matches the source table. 2. Establish a subscription to the external publication: ```sql CREATE SUBSCRIPTION CONNECTION 'host= port=5432 user= dbname= password=' PUBLICATION ; ``` Upon successful creation, PostgreSQL will synchronize the data from the external source to the Managed PostgreSQL cluster. 3. Check that the data has been replicated correctly: ```sql SELECT * FROM ; ``` ## Monitoring and maintenance * Use the `pg_stat_subscription` view to monitor the status of your subscription: ```sql SELECT * FROM pg_stat_subscription; ``` * If you alter the schema of the replicated tables, ensure that corresponding changes are made on both the publisher and subscriber to prevent replication errors. * Regularly monitor replication slots on the external PostgreSQL instance to prevent issues related to disk space, as logical replication slots retain WAL files until they are consumed by all subscribers. *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Backups in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/backups.md Managed Service for PostgreSQL protects the data that you store in your clusters and creates backups for them. The service supports two types of backups: * Automatic backups that Managed Service for PostgreSQL creates daily based on the [cluster configuration](https://docs.nebius.com/postgresql/backups.md#how-to-configure-automatic-backups) that you set. * Manual (or on-demand) backups that you [create](https://docs.nebius.com/postgresql/backups.md#how-to-create-a-backup). You can also [delete](https://docs.nebius.com/postgresql/backups.md#how-to-delete-a-manual-backup) them later. Once a backup is created, you can [restore a cluster](https://docs.nebius.com/postgresql/backups.md#how-to-restore-a-cluster-from-a-backup) from it. ## Prerequisites If you use the web console, you don't need to complete any prerequisites. If you use the CLI, Terraform, or an SDK, install and configure one of the following tools: > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Terraform > > [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to configure automatic backups When you [create a Managed PostgreSQL cluster](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters), you can configure at what time of day the service creates automatic backups and how long it stores them. > [!WARNING] > > You cannot change the backup settings after you create a cluster. > [tab] Web console > > On the cluster creation page ( **PostgreSQL** → **Create cluster**), find **Backup settings**. > > You can configure the following settings of automatic backups: > > ***Start of backup window*** > > Time when Managed PostgreSQL starts creating automatic backups. The service backs up clusters daily. The time is specified in UTC+00:00. Format: `HH:MM:SS`; for example, `00:30:00`. Default value: `00:02:00`. > > ***Retention period*** > > Number of days Managed PostgreSQL stores an automatic backup after creating it. This is how far back you can restore the cluster. The retention period also applies to the cluster's [write ahead log](https://www.postgresql.org/docs/current/continuous-archiving.html) (WAL). Default and minimum value: `7d` (7 days). Maximum value: `30d` (30 days). > [tab] CLI > > Add parameters of automatic backups to the cluster creation command: > > ```bash > nebius msp postgresql v1alpha1 cluster create \ > --backup-backup-window-start '00:02:00' \ > --backup-retention-policy '7d' \ > > ``` > > `--backup-backup-window-start` > > Time when Managed PostgreSQL starts creating automatic backups. The service backs up clusters daily. The time is specified in UTC+00:00. Format: `HH:MM:SS`; for example, `00:30:00`. Default value: `00:02:00`. > > `--backup-retention-policy` > > Number of days Managed PostgreSQL stores an automatic backup after creating it. This is how far back you can restore the cluster. The retention period also applies to the cluster's [write ahead log](https://www.postgresql.org/docs/current/continuous-archiving.html) (WAL). Default and minimum value: `7d` (7 days). Maximum value: `30d` (30 days). > > See the [full reference](https://docs.nebius.com/cli/reference/msp/postgresql/v1alpha1/cluster/create.md) for the command. > [tab] Terraform > > Add parameters of automatic backups to the cluster resource: > > ```bash > resource "nebius_msp_postgresql_v1alpha1_cluster" "" { > backup = { > backup_window_start = "00:02:00" > retention_policy = "7d" > } > > > } > ``` > > `backup.backup_window_start` > > Time when Managed PostgreSQL starts creating automatic backups. The service backs up clusters daily. The time is specified in UTC+00:00. Format: `HH:MM:SS`; for example, `00:30:00`. Default value: `00:02:00`. > > `backup.retention_policy` > > Number of days Managed PostgreSQL stores an automatic backup after creating it. This is how far back you can restore the cluster. The retention period also applies to the cluster's [write ahead log](https://www.postgresql.org/docs/current/continuous-archiving.html) (WAL). Default and minimum value: `7d` (7 days). Maximum value: `30d` (30 days). > > See the [full reference](https://docs.nebius.com/terraform-provider/reference/resources/msp_postgresql_v1alpha1_cluster.md) for the resource. > [tab] Go SDK > > Add automatic backup settings when creating a cluster: > > ```go > createService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > createRequest := &pg.CreateClusterRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &pg.ClusterSpec{ > NetworkId: "", > Config: &pg.ConfigSpec{ > Version: "16", > PoolerConfig: &pg.ConnectionPoolerConfig{ > PoolingMode: > pg.ConnectionPoolerConfig_SESSION, > MaxPoolSize: proto.Int64(5), > }, > PublicAccess: false, > Template: &pg.TemplateSpec{ > Resources: &resource.ResourcesSpec{ > Platform: "cpu-e2", > Preset: "2vcpu-8gb", > }, > Disk: &resource.DiskSpec{ > Type: "network-ssd", > SizeGibibytes: 20, > }, > Hosts: &resource.HostSpec{ > Count: 1, > }, > }, > }, > Bootstrap: &pg.BootstrapSpec{ > DbName: "", > UserName: "", > UserPassword: "", > }, > Backup: &pg.BackupSpec{ > BackupWindowStart: "00:02:00", > RetentionPolicy: "7d", > }, > }, > } > createOperation, err := createService.Create( > ctx, createRequest, > ) > if err != nil { > return fmt.Errorf("create cluster: %w", err) > } > _, err = createOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for cluster creation: %w", err) > } > ``` > > In the code, update the following values: > > * `Metadata.ParentId`: Project ID. > * `Metadata.Name`: Cluster name. > * `Spec.NetworkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk). > * `Spec.Bootstrap.DbName`: Database name. > * `Spec.Bootstrap.UserName`: Username. > * `Spec.Bootstrap.UserPassword`: Database password. > * `Spec.Backup.BackupWindowStart`: Backup schedule, in `HH:MM:SS` format. > * `Spec.Backup.RetentionPolicy`: Backup retention period, for example `7d`. > [tab] Python SDK > > Add automatic backup settings when creating a cluster: > > ```python > create_service = pg.ClusterServiceClient(sdk) > create_request = pg.CreateClusterRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=pg.ClusterSpec( > network_id="", > config=pg.ConfigSpec( > version="16", > pooler_config=pg.ConnectionPoolerConfig( > pooling_mode=( > pg.ConnectionPoolerConfig.PoolingMode. > SESSION > ), > max_pool_size=5, > ), > public_access=False, > template=pg.TemplateSpec( > resources=resource.ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > disk=resource.DiskSpec( > type="network-ssd", > size_gibibytes=20, > ), > hosts=resource.HostSpec( > count=1, > ), > ), > ), > bootstrap=pg.BootstrapSpec( > db_name="", > user_name="", > user_password="", > ), > backup=pg.BackupSpec( > backup_window_start="00:02:00", > retention_policy="7d", > ), > ), > ) > create_operation = await create_service.create(create_request) > await create_operation.wait() > ``` > > In the code, update the following values: > > * `metadata.parent_id`: Project ID. > * `metadata.name`: Cluster name. > * `spec.network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk). > * `spec.bootstrap.db_name`: Database name. > * `spec.bootstrap.user_name`: Username. > * `spec.bootstrap.user_password`: Database password. > * `spec.backup.backup_window_start`: Backup schedule, in `HH:MM:SS` format. > * `spec.backup.retention_policy`: Backup retention period, for example `7d`. > [tab] JavaScript SDK > > Add automatic backup settings when creating a cluster: > > ```ts > const createService = new pg.ClusterService(sdk); > const createRequest = pg.CreateClusterRequest.create({ > metadata: { > parentId: "", > name: "", > }, > spec: { > networkId: "", > config: { > version: "16", > poolerConfig: { > poolingMode: > pg.ConnectionPoolerConfig_PoolingMode.SESSION, > maxPoolSize: Long.fromNumber(5), > }, > publicAccess: false, > template: { > resources: { > platform: "cpu-e2", > preset: "2vcpu-8gb", > }, > disk: { > type: "network-ssd", > sizeGibibytes: Long.fromNumber(20), > }, > hosts: { > count: Long.fromNumber(1), > }, > }, > }, > bootstrap: { > dbName: "", > userName: "", > userPassword: "", > }, > backup: { > backupWindowStart: "00:02:00", > retentionPolicy: "7d", > }, > }, > }); > const createOperation = await createService.create( > createRequest, > ).result; > await createOperation.wait(); > ``` > > In the code, update the following values: > > * `metadata.parentId`: Project ID. > * `metadata.name`: Cluster name. > * `spec.networkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk). > * `spec.bootstrap.dbName`: Database name. > * `spec.bootstrap.userName`: Username. > * `spec.bootstrap.userPassword`: Database password. > * `spec.backup.backupWindowStart`: Backup schedule, in `HH:MM:SS` format. > * `spec.backup.retentionPolicy`: Backup retention period, for example `7d`. ## How to create a backup Before you begin, make sure that your Managed PostgreSQL cluster has the `Running` status. To create a backup: > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > 2. Open the page of the required cluster and then go to the **Backups** tab. > 3. Click  **Create backup**. > > After that, a new backup appears in the list. > [tab] CLI > > 1. To get the ID of the required cluster, list the Managed PostgreSQL clusters: > ```bash > nebius msp postgresql v1alpha1 cluster list > ``` > The cluster ID is specified in the `metadata.id` parameter. > 2. Create a backup: > > ```bash > nebius msp postgresql v1alpha1 backup create --cluster-id > ``` > [tab] Go SDK > > ```go > createBackupService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Backup() > createBackupOperation, err := createBackupService.Create( > ctx, > &pg.CreateBackupRequest{ > ClusterId: "", > }, > ) > if err != nil { > return fmt.Errorf("create: %w", err) > } > _, err = createBackupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create: %w", err) > } > ``` > > In the code, set `CreateBackupRequest.ClusterId` to the cluster ID. > [tab] Python SDK > > ```python > create_backup_service = pg.BackupServiceClient(sdk) > create_backup_operation = await create_backup_service.create( > pg.CreateBackupRequest( > cluster_id="", > ), > ) > await create_backup_operation.wait() > ``` > > In the code, set `CreateBackupRequest.cluster_id` to the cluster ID. > [tab] JavaScript SDK > > ```ts > const createBackupService = new pg.BackupService(sdk); > const createBackupOperation = await createBackupService.create( > pg.CreateBackupRequest.create({ > clusterId: "", > }), > ).result; > await createBackupOperation.wait(); > ``` > > In the code, set `CreateBackupRequest.clusterId` to the cluster ID. ## How to restore a cluster from a backup When you restore from a backup, you create a new Managed PostgreSQL cluster. In this new cluster, the target host disks must be at least as large as the source host disks. You can configure the rest of the settings differently from the source cluster. You can restore from a backup not only existing clusters, but also deleted ones. After you delete a cluster, Managed PostgreSQL stores its backups for the [retention period](https://docs.nebius.com/postgresql/backups.md#how-to-configure-automatic-backups). To restore a cluster from a backup: > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > > 2. Switch to **Backups**. Alternatively, open the page of the required cluster and switch to **Backups**. > > 3. Launch restoration: > > * For an automatic backup, click **Restore**. > * For a manual backup, click  → **Restore**. > > 4. In the form that opens, configure and create a new cluster that will be restored from the backup. For configuration details, see [Working with your Managed Service for PostgreSQL® cluster](https://docs.nebius.com/postgresql/clusters/manage.md). > > When you fill out the form for an automatic backup, you can specify an optional *recovery time*. This is the moment to which the cluster state should be returned. > > Managed PostgreSQL supports the [Point-in-Time Recovery](https://en.wikipedia.org/wiki/Point-in-time_recovery) (PITR) technology. This technology allows you to restore a cluster to any moment, from creation of the oldest backup to archiving the most recent [write-ahead log (WAL)](https://www.postgresql.org/docs/current/wal-intro.html). > > If you specify a desired time and receive the error that a WAL has not been archived yet, wait a while for the WAL to be archived. The archiving process takes some time, especially if the cluster does not have any workloads. > [tab] CLI > > 1. Get IDs of the backup and its source cluster. For example, you can: > > * List all Managed PostgreSQL backups in the project: > > ```bash > nebius msp postgresql v1alpha1 backup list > ``` > > * List all backups of the specified cluster: > > ```bash > nebius msp postgresql v1alpha1 backup list-by-cluster \ > --cluster-id > ``` > > To get the cluster ID, use [nebius msp postgresql v1alpha1 cluster list](https://docs.nebius.com/cli/reference/msp/postgresql/v1alpha1/cluster/list.md) or [nebius msp postgresql v1alpha1 cluster get-by-name](https://docs.nebius.com/cli/reference/msp/postgresql/v1alpha1/cluster/get-by-name.md). > > Both commands that list backups return outputs like the following: > > ```yaml > backups: > - id: > source_cluster_id: > ... > ``` > > 2. Restore the cluster: > > ```bash > nebius msp postgresql v1alpha1 cluster restore \ > --backup-id \ > --source-cluster-id \ > --name \ > --bootstrap-user-password *** \ > --network-id vpcnetwork-e*** \ > --recovery-time TZ > ``` > > The command contains the following parameters: > > * `--backup-id`: ID of the backup that you got in the previous step. > > * `--source-cluster-id`: ID of the source PostgreSQL cluster. > > * `--name`: Name of the new PostgreSQL cluster created from the backup. > > * `--bootstrap-user-password`: PostgreSQL user password. It does not have to repeat the password of the source cluster. > > The password must contain at least: > > * 8 characters > * One lowercase character > * One uppercase character > * One special character > > * `--network-id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli). > > * `--recovery-time` (optional; for automatic backups only): Moment to which the cluster state should be returned. > > Managed PostgreSQL supports the [Point-in-Time Recovery](https://en.wikipedia.org/wiki/Point-in-time_recovery) (PITR) technology. This technology allows you to restore a cluster to any moment, from creation of the oldest backup to archiving the most recent [write-ahead log (WAL)](https://www.postgresql.org/docs/current/wal-intro.html). > > If you specify a desired time and receive the error that a WAL has not been archived yet, wait a while for the WAL to be archived. The archiving process takes some time, especially if the cluster does not have any workloads. > [tab] Go SDK > > 1. Get IDs of the backup and its source cluster. For example, you can: > > * List all Managed PostgreSQL backups in the project: > > ```go > listBackupService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Backup() > listBackupResponse, err := listBackupService.List( > ctx, > &pg.ListBackupsRequest{ > ParentId: "", > }, > ) > if err != nil { > return fmt.Errorf("list: %w", err) > } > fmt.Println(listBackupResponse) > ``` > > * Get the cluster ID: > > ```go > listClusterService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > listClusterResponse, err := listClusterService.List( > ctx, > &pg.ListClustersRequest{ > ParentId: "", > }, > ) > if err != nil { > return fmt.Errorf("list: %w", err) > } > fmt.Println(listClusterResponse) > ``` > > Then list all backups of the specified cluster: > > ```go > byClusterService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Backup() > byClusterResponse, err := byClusterService.ListByCluster( > ctx, > &pg.ListBackupsByClusterRequest{ > ClusterId: "", > }, > ) > if err != nil { > return fmt.Errorf("list by cluster: %w", err) > } > fmt.Println(byClusterResponse) > ``` > 2. Restore the cluster: > > ```go > restoreService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > restoreRequest := &pg.RestoreClusterRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &pg.ClusterSpec{ > NetworkId: "vpcnetwork-e***", > Bootstrap: &pg.BootstrapSpec{ > UserPassword: "***", > }, > }, > BackupId: "", > SourceClusterId: "", > } > parsedTime, err := time.Parse( > time.RFC3339, "TZ", > ) > if err != nil { > return fmt.Errorf("parse recovery time: %w", err) > } > restoreRequest.RecoveryTime = timestamppb.New(parsedTime) > restoreOperation, err := restoreService.Restore( > ctx, restoreRequest, > ) > if err != nil { > return fmt.Errorf("restore cluster: %w", err) > } > _, err = restoreOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for cluster restore: %w", err) > } > ``` > > In the code, update the following values: > > * `Metadata.ParentId`: Project ID. > * `Metadata.Name`: New cluster name. > * `Spec.NetworkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk). > * `Spec.Bootstrap.UserPassword`: PostgreSQL user password. > * `BackupId`: Backup ID. > * `SourceClusterId`: Source cluster ID. > * `RecoveryTime` (optional; for automatic backups only): Moment to which the cluster state should be returned. > [tab] Python SDK > > 1. Get IDs of the backup and its source cluster. For example, you can: > > * List all Managed PostgreSQL backups in the project: > > ```python > list_backup_service = pg.BackupServiceClient(sdk) > list_backup_response = await list_backup_service.list( > pg.ListBackupsRequest( > parent_id="", > ), > ) > print(list_backup_response) > ``` > > * Get the cluster ID: > > ```python > list_cluster_service = pg.ClusterServiceClient(sdk) > list_cluster_response = await list_cluster_service.list( > pg.ListClustersRequest( > parent_id="", > ), > ) > print(list_cluster_response) > ``` > > Then list all backups of the specified cluster: > > ```python > by_cluster_service = pg.BackupServiceClient(sdk) > by_cluster_response = await by_cluster_service.list_by_cluster( > pg.ListBackupsByClusterRequest( > cluster_id="", > ), > ) > print(by_cluster_response) > ``` > 2. Restore the cluster: > > ```python > restore_service = pg.ClusterServiceClient(sdk) > restore_request = pg.RestoreClusterRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=pg.ClusterSpec( > network_id="vpcnetwork-e***", > bootstrap=pg.BootstrapSpec( > user_password="***", > ), > ), > backup_id="", > source_cluster_id="", > ) > restore_request.recovery_time = datetime.fromisoformat( > "TZ".replace("Z", "+00:00"), > ) > restore_operation = await restore_service.restore(restore_request) > await restore_operation.wait() > ``` > > In the code, update the following values: > > * `metadata.parent_id`: Project ID. > * `metadata.name`: New cluster name. > * `spec.network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk). > * `spec.bootstrap.user_password`: PostgreSQL user password. > * `backup_id`: Backup ID. > * `source_cluster_id`: Source cluster ID. > * `recovery_time` (optional; for automatic backups only): Moment to which the cluster state should be returned. > [tab] JavaScript SDK > > 1. Get IDs of the backup and its source cluster. For example, you can: > > * List all Managed PostgreSQL backups in the project: > > ```ts > const listBackupService = new pg.BackupService(sdk); > const listBackupResponse = await listBackupService.list( > pg.ListBackupsRequest.create({ > parentId: "", > }), > ).result; > console.log(listBackupResponse); > ``` > > * Get the cluster ID: > > ```ts > const listClusterService = new pg.ClusterService(sdk); > const listClusterResponse = await listClusterService.list( > pg.ListClustersRequest.create({ > parentId: "", > }), > ).result; > console.log(listClusterResponse); > ``` > > Then list all backups of the specified cluster: > > ```ts > const byClusterService = new pg.BackupService(sdk); > const byClusterResponse = await byClusterService.listByCluster( > pg.ListBackupsByClusterRequest.create({ > clusterId: "", > }), > ).result; > console.log(byClusterResponse); > ``` > 2. Restore the cluster: > > ```ts > const restoreService = new pg.ClusterService(sdk); > const restoreRequest = pg.RestoreClusterRequest.create({ > metadata: { > parentId: "", > name: "", > }, > spec: { > networkId: "vpcnetwork-e***", > bootstrap: { userPassword: "***" }, > }, > backupId: "", > sourceClusterId: "", > }); > restoreRequest.recoveryTime = dayjs("TZ"); > const restoreOperation = await restoreService.restore( > restoreRequest, > ).result; > await restoreOperation.wait(); > ``` > > In the code, update the following values: > > * `metadata.parentId`: Project ID. > * `metadata.name`: New cluster name. > * `spec.networkId`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk). > * `spec.bootstrap.userPassword`: PostgreSQL user password. > * `backupId`: Backup ID. > * `sourceClusterId`: Source cluster ID. > * `recoveryTime` (optional; for automatic backups only): Moment to which the cluster state should be returned. ## How to delete a manual backup You can only delete manual backups that you created. You cannot delete automatic backups. Conversely, Managed PostgreSQL cannot delete manual backups, only automatic ones. To delete a manual backup: > [tab] Web console > > 1. In the sidebar, go to  **PostgreSQL**. > 2. Open the page of the required cluster and then go to the **Backups** tab. > 3. In the row of the required manual backup, click  → **Delete**. > > After that, the deletion confirmation is displayed. The backup is deleted in a few seconds. > [tab] CLI > > 1. To get the ID of the required cluster, list the Managed PostgreSQL clusters: > ```bash > nebius msp postgresql v1alpha1 cluster list > ``` > The cluster ID is specified in the `metadata.id` parameter. > > 2. To get the ID of the required manual backup, list the backups of the selected cluster: > > ```bash > nebius msp postgresql v1alpha1 backup list-by-cluster \ > --cluster-id > ``` > > The backup ID is specified in the `id` parameter. > > Select only backups with the `on_demand: true` parameter. This means that they are manual. > > 3. Delete the backup: > > ```bash > nebius msp postgresql v1alpha1 backup delete \ > --cluster-id --backup-id > ``` > [tab] Go SDK > > 1. Get the ID of the required manual backup. To do this: > > 1. Get the cluster ID: > > ```go > listClusterService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Cluster() > listClusterResponse, err := listClusterService.List( > ctx, > &pg.ListClustersRequest{ > ParentId: "", > }, > ) > if err != nil { > return fmt.Errorf("list: %w", err) > } > fmt.Println(listClusterResponse) > ``` > > 2. Then list all backups of the selected cluster: > > ```go > byClusterService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Backup() > byClusterResponse, err := byClusterService.ListByCluster( > ctx, > &pg.ListBackupsByClusterRequest{ > ClusterId: "", > }, > ) > if err != nil { > return fmt.Errorf("list by cluster: %w", err) > } > fmt.Println(byClusterResponse) > ``` > > Select only backups with the `on_demand: true` parameter. This means that they are manual. > 2. Delete the backup: > > ```go > deleteBackupService := sdk.Services().MSP().PostgreSQL(). > V1Alpha1().Backup() > deleteBackupOperation, err := deleteBackupService.Delete( > ctx, > &pg.DeleteBackupRequest{ > ClusterId: "", > BackupId: "", > }, > ) > if err != nil { > return fmt.Errorf("delete: %w", err) > } > _, err = deleteBackupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for delete: %w", err) > } > ``` > > In the code, update the following values: > > * `DeleteBackupRequest.ClusterId`: Cluster ID. > * `DeleteBackupRequest.BackupId`: Backup ID. > [tab] Python SDK > > 1. Get the ID of the required manual backup. To do this: > > 1. Get the cluster ID: > > ```python > list_cluster_service = pg.ClusterServiceClient(sdk) > list_cluster_response = await list_cluster_service.list( > pg.ListClustersRequest( > parent_id="", > ), > ) > print(list_cluster_response) > ``` > > 2. Then list all backups of the selected cluster: > > ```python > by_cluster_service = pg.BackupServiceClient(sdk) > by_cluster_response = await by_cluster_service.list_by_cluster( > pg.ListBackupsByClusterRequest( > cluster_id="", > ), > ) > print(by_cluster_response) > ``` > > Select only backups with the `on_demand: true` parameter. This means that they are manual. > 2. Delete the backup: > > ```python > delete_backup_service = pg.BackupServiceClient(sdk) > delete_backup_operation = await delete_backup_service.delete( > pg.DeleteBackupRequest( > cluster_id="", > backup_id="", > ), > ) > await delete_backup_operation.wait() > ``` > > In the code, update the following values: > > * `DeleteBackupRequest.cluster_id`: Cluster ID. > * `DeleteBackupRequest.backup_id`: Backup ID. > [tab] JavaScript SDK > > 1. Get the ID of the required manual backup. To do this: > > 1. Get the cluster ID: > > ```ts > const listClusterService = new pg.ClusterService(sdk); > const listClusterResponse = await listClusterService.list( > pg.ListClustersRequest.create({ > parentId: "", > }), > ).result; > console.log(listClusterResponse); > ``` > > 2. Then list all backups of the selected cluster: > > ```ts > const byClusterService = new pg.BackupService(sdk); > const byClusterResponse = await byClusterService.listByCluster( > pg.ListBackupsByClusterRequest.create({ > clusterId: "", > }), > ).result; > console.log(byClusterResponse); > ``` > > Select only backups with the `on_demand: true` parameter. This means that they are manual. > 2. Delete the backup: > > ```ts > const deleteBackupService = new pg.BackupService(sdk); > const deleteBackupOperation = await deleteBackupService.delete( > pg.DeleteBackupRequest.create({ > clusterId: "", > backupId: "", > }), > ).result; > await deleteBackupOperation.wait(); > ``` > > In the code, update the following values: > > * `DeleteBackupRequest.clusterId`: Cluster ID. > * `DeleteBackupRequest.backupId`: Backup ID. *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Monitoring clusters in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/monitoring.md You can monitor Managed Service for PostgreSQL cluster state on the dashboard in the Nebius AI Cloud [web console](https://console.nebius.com). There are two ways to find the required dashboard: * Go to **Observability** → [Metrics](https://console.nebius.com/observability/metrics) and select the resource you would like to review. * Go to the page of the cluster you would like to review and switch to the **Metrics** tab. Use the dashboards to monitor current resource utilization, get information to schedule [quota](https://docs.nebius.com/postgresql/resources/quotas-limits.md) increases and quickly identify anomalies. In case of issues with your clusters, dashboards also help the Nebius support team investigate the issues. Data for the dashboards is collected automatically. The cluster usage data becomes available 5–10 minutes after the cluster is created. ## Dashboard filters Select a group: * `pgbouncer` to monitor the connection pool. * `postgres` to monitor the database operations. To check Managed PostgreSQL hosts health separately, select them from the **Pod** list. Use time filters to view a specific period of usage. By default, the data is refreshed every 15 seconds. You can configure this interval next to the time filters. ## Cluster monitoring metrics ### Resource usage * **Total service CPU usage** Amount of vCPU that a cluster consumed. * **Total service memory usage** Amount of consumed RAM in GiB, with work memory and cache. * **Total disk IO usage** Disk read/write rate, in bytes per second. * **Total service network usage** Network receive/transmit rate, in bytes per second. * **Total service disk usage** Percentage of consumed storage. * **Last base backup** Time since the last successful backup. * **CPU usage** Amount of vCPU consumed per container, including the limit. * **Throttling containers in %** Percentage of CPU periods containers went throttling. * **Throttling containers in seconds** Percentage of CPU seconds containers went throttling. * **Memory usage** Amount of memory that containers used in a dedicated period, including work memory and cache. Measured in bytes. * **Network RX/TX** Average speed of data received/sent over the network per container, in bytes per second. * **Disk IO** Average IOPS of the cluster's disks per container, in operations per second. * **Disk used space** Amount of disk space consumed per container, including the limit. * **Disk inodes used** Number of used [inodes](https://www.kernel.org/doc/html/latest/filesystems/ext4/inodes.html) with files metadata per container, including the limit. A lack of inodes leads to an overall lack of disk space, especially if you generate many small files like [Write-Ahead Log (WAL)](https://www.postgresql.org/docs/current/wal-intro.html) segments or temporary tablespaces. ### Replication * **Current instance roles** Roles that hosts in a cluster are performing now: primary (handling read/write operations) or replica (replicating data and serving read-only queries). * **Instance roles** Roles that hosts in a cluster performed during the dedicated period. * **Instance status** Hosts statuses during the dedicated period: up or down. * **Replication lag** Delay between the primary database and its replicas, in seconds. * **WAL size** Size of WAL files in bytes per host. * **WAL count** Number of WAL files per host. * **WAL archiver** Number of archived WAL files per host. ### Database performance * **Database size** Amount of disk space that a database consumed. * **Transaction rate** Number of transactions committed or rolled back from each host per second. * **Longest transaction** A pair of committed and rolled-back transactions that took the longest to complete for each host. ### Connection pooler * **Pooler query rate** Number of queries passed through the pooler to the server per second. * **Pooler query duration** Time used to process queries through the pooler. * **Pooler servers used** Number of used server (pooler to PostgreSQL) connections. * **Pooler clients used** Number of used client (client to pooler) connections. * **Pooler clients active** Number of clients that are assigned a server connection and can process queries. * **Pooler clients waiting** Number of clients that have sent queries but are not yet assigned a server connection. *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Maintenance in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/maintenance.md Nebius AI Cloud performs maintenance on Managed Service for PostgreSQL clusters. This page explains how to review maintenance schedules, identify affected resources, and reschedule eligible operations to make sure that you aren't relying on a resource that's unavailable due to maintenance. ## Prerequisites > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > ```bash > cat ~/.nebius/config.yaml > ``` > > 3. Install [jq](https://jqlang.github.io/jq/) to filter the JSON data returned by the Nebius AI Cloud CLI: > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to get a list of all maintenance operations > [tab] CLI > > ```bash > nebius maintenance v1alpha1 maintenance list > ``` > > This command returns a list of all past, in-progress, and scheduled maintenance operations affecting resources in the project. Each item contains: > > * `metadata.id`: Maintenance operation ID. You can use this ID to [get the details of an operation](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-the-details-of-a-maintenance-operation) or [reschedule it](https://docs.nebius.com/postgresql/maintenance.md#how-to-reschedule-a-maintenance-operation). > > * `metadata.parent_id`: Project ID. > > * `metadata.created_at`: Creation time of the maintenance operation. > > * `spec.scheduled_at`: Scheduled time of the maintenance, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. > > * `status.affected_resources`: Affected resource IDs and their project IDs (`parent_id`). > > If the maintenance event affects your resources in another service, they're also listed here. You can [filter the output](https://docs.nebius.com/postgresql/maintenance.md#filtering-the-output) to see only the affected resources for Managed PostgreSQL clusters. > > * `status.state`: Maintenance operation state. Possible values are `STATE_UNSPECIFIED`, `STATE_SCHEDULED`, `STATE_IN_PROGRESS`, `STATE_FINISHED`, `STATE_ERROR`, and `STATE_CANCELLED`. > > * `status.reschedulable`: Whether you can reschedule the maintenance. You can reschedule it only when `status.reschedulable` is `true` and `status.state` is `STATE_SCHEDULED`. > > ### Filtering the output > > To filter the list output by PostgreSQL clusters, run the following command: > > ```bash > nebius maintenance v1alpha1 maintenance list \ > --format json \ > | jq ' > .items[] > | select(any(.status.affected_resources[]?; .id | startswith("postgresql-"))) > | .status.affected_resources |= map(select(.id | startswith("postgresql-"))) > ' > ``` > > This command returns only maintenance operations that affect PostgreSQL clusters and removes resources belonging to other Nebius AI Cloud services from the `affected_resources` array of each list item. > [tab] Go SDK > > ```go > listService := sdk.Services().Maintenance(). > V1Alpha1().Maintenance() > maintenances, err := listService.List( > ctx, > &maintenance.ListMaintenancesRequest{ > ParentId: "", > }, > ) > if err != nil { > return fmt.Errorf("list maintenance operations: %w", err) > } > fmt.Println(maintenances) > ``` > > In `ListMaintenancesRequest`, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). > > In `Items`, the response contains all past, in-progress, and scheduled maintenance operations affecting resources in the project. Each item contains: > > * `Metadata.Id`: Maintenance operation ID. You can use this ID to [get the details of an operation](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-the-details-of-a-maintenance-operation) or [reschedule it](https://docs.nebius.com/postgresql/maintenance.md#how-to-reschedule-a-maintenance-operation). > > * `Metadata.ParentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). > > * `Metadata.CreatedAt`: Creation time of the maintenance operation. > > * `Spec.ScheduledAt`: Scheduled time of the maintenance. > > * `Status.AffectedResources`: Affected resource IDs and their project IDs (`ParentId`). > > If the maintenance event affects your resources in another service, they're also listed here. You can [filter the output](https://docs.nebius.com/postgresql/maintenance.md#filtering-the-output) to see only the affected resources for Managed PostgreSQL clusters. > > * `Status.State`: Maintenance operation state. Possible values are `STATE_UNSPECIFIED`, `STATE_SCHEDULED`, `STATE_IN_PROGRESS`, `STATE_FINISHED`, `STATE_ERROR`, and `STATE_CANCELLED`. > > * `Status.Reschedulable`: Whether you can reschedule the maintenance. You can reschedule it only when this value is `true` and `Status.State` is `STATE_SCHEDULED`. > > ### Filtering the output > > To filter the list output by PostgreSQL clusters: > > ```go > postgresqlListService := sdk.Services().Maintenance(). > V1Alpha1().Maintenance() > postgresqlMaintenances, err := postgresqlListService.List( > ctx, > &maintenance.ListMaintenancesRequest{ > ParentId: "", > }, > ) > if err != nil { > return fmt.Errorf("list maintenance operations: %w", err) > } > for _, postgresqlMaintenance := range postgresqlMaintenances.Items { > status := postgresqlMaintenance.Status > if status == nil { > continue > } > filteredResources := make([]*maintenance.Resource, 0) > for _, resource := range status.AffectedResources { > if resource != nil && > strings.HasPrefix(resource.Id, "postgresql-") { > filteredResources = append( > filteredResources, resource, > ) > } > } > if len(filteredResources) == 0 { > continue > } > status.AffectedResources = filteredResources > fmt.Println(postgresqlMaintenance) > } > ``` > > In `ListMaintenancesRequest`, set `ParentId` to the project ID. > > This code returns only maintenance operations that affect PostgreSQL clusters and removes resources belonging to other Nebius AI Cloud services from `Status.AffectedResources`. > [tab] Python SDK > > ```python > list_service = MaintenanceServiceClient(sdk) > maintenances = await list_service.list( > ListMaintenancesRequest(parent_id=""), > ) > print(maintenances) > ``` > > In `ListMaintenancesRequest`, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). > > In `items`, the response contains all past, in-progress, and scheduled maintenance operations affecting resources in the project. Each item contains: > > * `metadata.id`: Maintenance operation ID. You can use this ID to [get the details of an operation](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-the-details-of-a-maintenance-operation) or [reschedule it](https://docs.nebius.com/postgresql/maintenance.md#how-to-reschedule-a-maintenance-operation). > > * `metadata.parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). > > * `metadata.created_at`: Creation time of the maintenance operation. > > * `spec.scheduled_at`: Scheduled time of the maintenance. > > * `status.affected_resources`: Affected resource IDs and their project IDs (`parent_id`). > > If the maintenance event affects your resources in another service, they're also listed here. You can [filter the output](https://docs.nebius.com/postgresql/maintenance.md#filtering-the-output) to see only the affected resources for Managed PostgreSQL clusters. > > * `status.state`: Maintenance operation state. Possible values are `STATE_UNSPECIFIED`, `STATE_SCHEDULED`, `STATE_IN_PROGRESS`, `STATE_FINISHED`, `STATE_ERROR`, and `STATE_CANCELLED`. > > * `status.reschedulable`: Whether you can reschedule the maintenance. You can reschedule it only when this value is `True` and `status.state` is `STATE_SCHEDULED`. > > ### Filtering the output > > To filter the list output by PostgreSQL clusters: > > ```python > list_service = MaintenanceServiceClient(sdk) > maintenances = await list_service.list( > ListMaintenancesRequest(parent_id=""), > ) > for maintenance_operation in maintenances.items: > status = maintenance_operation.status > if status is None: > continue > affected_resources = [ > resource > for resource in status.affected_resources > if resource.id.startswith("postgresql-") > ] > if not affected_resources: > continue > status.affected_resources = affected_resources > print(maintenance_operation) > ``` > > In `ListMaintenancesRequest`, set `parent_id` to the project ID. > > This code returns only maintenance operations that affect PostgreSQL clusters and removes resources belonging to other Nebius AI Cloud services from `status.affected_resources`. > [tab] JavaScript SDK > > ```ts > const listService = new MaintenanceService(sdk); > const maintenances = await listService.list( > ListMaintenancesRequest.create({ > parentId: "", > }), > ).result; > console.log(maintenances); > ``` > > In `ListMaintenancesRequest`, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). > > In `items`, the response contains all past, in-progress, and scheduled maintenance operations affecting resources in the project. Each item contains: > > * `metadata.id`: Maintenance operation ID. You can use this ID to [get the details of an operation](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-the-details-of-a-maintenance-operation) or [reschedule it](https://docs.nebius.com/postgresql/maintenance.md#how-to-reschedule-a-maintenance-operation). > > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). > > * `metadata.createdAt`: Creation time of the maintenance operation. > > * `spec.scheduledAt`: Scheduled time of the maintenance. > > * `status.affectedResources`: Affected resource IDs and their project IDs (`parentId`). > > If the maintenance event affects your resources in another service, they're also listed here. You can [filter the output](https://docs.nebius.com/postgresql/maintenance.md#filtering-the-output) to see only the affected resources for Managed PostgreSQL clusters. > > * `status.state`: Maintenance operation state. Possible values are `STATE_UNSPECIFIED`, `STATE_SCHEDULED`, `STATE_IN_PROGRESS`, `STATE_FINISHED`, `STATE_ERROR`, and `STATE_CANCELLED`. > > * `status.reschedulable`: Whether you can reschedule the maintenance. You can reschedule it only when this value is `true` and `status.state` is `STATE_SCHEDULED`. > > ### Filtering the output > > To filter the list output by PostgreSQL clusters: > > ```ts > const postgresqlListService = new MaintenanceService(sdk); > const postgresqlMaintenances = await postgresqlListService.list( > ListMaintenancesRequest.create({ > parentId: "", > }), > ).result; > for (const postgresqlMaintenance of postgresqlMaintenances.items) { > const status = postgresqlMaintenance.status; > if (!status) { > continue; > } > const affectedResources = status.affectedResources.filter( > (resource) => resource.id.startsWith('postgresql-'), > ); > if (affectedResources.length === 0) { > continue; > } > status.affectedResources = affectedResources; > console.log(postgresqlMaintenance); > } > ``` > > In `ListMaintenancesRequest`, set `parentId` to the project ID. > > This code returns only maintenance operations that affect PostgreSQL clusters and removes resources belonging to other Nebius AI Cloud services from `status.affectedResources`. ## How to get the details of a maintenance operation > [tab] CLI > > ```bash > nebius maintenance v1alpha1 maintenance get --id > ``` > > In `--id`, specify the maintenance operation ID. You can get it by [listing all maintenance operations](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-cli). > > This command returns the details of a maintenance operation. The details are the same as for the [list maintenance operations](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-cli) command. > > > [accordion] Output example > > > > ```yaml > > metadata: > > id: maintenance_*** > > parent_id: project-*** > > created_at: "2025-09-22T14:40:59.845329Z" > > spec: > > scheduled_at: "2025-10-01T14:28:20Z" > > status: > > affected_resources: > > - id: postgresql-*** > > parent_id: project-*** > > started_at: "2025-10-01T14:28:21.162373Z" > > finished_at: "2025-10-01T14:34:38.363547Z" > > state: STATE_FINISHED > > reschedulable: true > > ``` > [tab] Go SDK > > ```go > getService := sdk.Services().Maintenance(). > V1Alpha1().Maintenance() > maintenanceOperation, err := getService.Get( > ctx, > &maintenance.GetMaintenanceRequest{ > Id: "", > }, > ) > if err != nil { > return fmt.Errorf("get maintenance operation: %w", err) > } > fmt.Println(maintenanceOperation) > ``` > > In `GetMaintenanceRequest`, set `Id` to the maintenance operation ID. You can get it by [listing all maintenance operations](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-go-sdk). > > The response contains the same details for one maintenance operation as each item in the [list response](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-go-sdk). > [tab] Python SDK > > ```python > get_service = MaintenanceServiceClient(sdk) > maintenance_operation = await get_service.get( > GetMaintenanceRequest(id=""), > ) > print(maintenance_operation) > ``` > > In `GetMaintenanceRequest`, set `id` to the maintenance operation ID. You can get it by [listing all maintenance operations](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-python-sdk). > > The response contains the same details for one maintenance operation as each item in the [list response](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-python-sdk). > [tab] JavaScript SDK > > ```ts > const getService = new MaintenanceService(sdk); > const maintenanceOperation = await getService.get( > GetMaintenanceRequest.create({ > id: "", > }), > ).result; > console.log(maintenanceOperation); > ``` > > In `GetMaintenanceRequest`, set `id` to the maintenance operation ID. You can get it by [listing all maintenance operations](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-javascript-sdk). > > The response contains the same details for one maintenance operation as each item in the [list response](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-a-list-of-all-maintenance-operations-javascript-sdk). ## How to reschedule a maintenance operation You can reschedule a maintenance operation only when its state is `STATE_SCHEDULED` and its reschedulable value is `true`. To check these values, [get the details of the operation](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-the-details-of-a-maintenance-operation). > [tab] CLI > > 1. Run the following command: > > ```bash > nebius maintenance v1alpha1 maintenance edit --id > ``` > > In `--id`, specify the maintenance operation ID. > > 2. In the editor that opens, change the value of `spec.scheduled_at` to your desired time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Specify only a future date and time. > > 3. When prompted, confirm the update. > [tab] Go SDK > > ```go > editService := sdk.Services().Maintenance(). > V1Alpha1().Maintenance() > maintenanceToUpdate, err := editService.Get( > ctx, > &maintenance.GetMaintenanceRequest{ > Id: "", > }, > ) > if err != nil { > return fmt.Errorf("get maintenance operation: %w", err) > } > scheduledAt, err := time.Parse( > time.RFC3339, "", > ) > if err != nil { > return fmt.Errorf("parse scheduled time: %w", err) > } > maintenanceToUpdate.Spec.ScheduledAt = > timestamppb.New(scheduledAt) > updatedMaintenance, err := editService.Update( > ctx, > &maintenance.UpdateMaintenanceRequest{ > Metadata: maintenanceToUpdate.Metadata, > Spec: maintenanceToUpdate.Spec, > }, > ) > if err != nil { > return fmt.Errorf("update maintenance operation: %w", err) > } > fmt.Println(updatedMaintenance) > ``` > > In the code, set the following values: > > * `Id` in `GetMaintenanceRequest`: Maintenance operation ID. > * `maintenanceToUpdate.Spec.ScheduledAt`: Desired future date and time. The code parses a value like `2025-10-01T14:28:20Z` in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format before assigning it. > [tab] Python SDK > > ```python > edit_service = MaintenanceServiceClient(sdk) > maintenance_to_update = await edit_service.get( > GetMaintenanceRequest(id=""), > ) > maintenance_to_update.spec.scheduled_at = ( > datetime.fromisoformat("+00:00") > ) > updated_maintenance = await edit_service.update( > UpdateMaintenanceRequest( > metadata=maintenance_to_update.metadata, > spec=maintenance_to_update.spec, > ), > ) > print(updated_maintenance) > ``` > > In the code, set the following values: > > * `id` in `GetMaintenanceRequest`: Maintenance operation ID. > * `maintenance_to_update.spec.scheduled_at`: Desired future date and time. The code parses a value like `2025-10-01T14:28:20+00:00` in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format before assigning it. > [tab] JavaScript SDK > > ```ts > const editService = new MaintenanceService(sdk); > const maintenanceToUpdate = await editService.get( > GetMaintenanceRequest.create({ > id: "", > }), > ).result; > maintenanceToUpdate.spec.scheduledAt = > dayjs(""); > const updatedMaintenance = await editService.update( > UpdateMaintenanceRequest.create({ > metadata: maintenanceToUpdate.metadata, > spec: maintenanceToUpdate.spec, > }), > ).result; > console.log(updatedMaintenance); > ``` > > In the code, set the following values: > > * `id` in `GetMaintenanceRequest`: Maintenance operation ID. > * `maintenanceToUpdate.spec.scheduledAt`: Desired future date and time. The code parses a value like `2025-10-01T14:28:20Z` in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format before assigning it. After you reschedule a maintenance operation, [check the updated details](https://docs.nebius.com/postgresql/maintenance.md#how-to-get-the-details-of-a-maintenance-operation). *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Quotas in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/resources/quotas-limits.md Managed Service for PostgreSQL has quotas on clusters, computing resources, and storage. Quotas for vCPU, RAM, and storage apply to the values that users set as clusters' vCPU, RAM, and storage limits when creating the clusters. For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). | Quota name | Default value per [region](https://docs.nebius.com/overview/regions.md) | | :- | :- | | Clusters | 10 | | Total vCPUs across clusters | 80 | | Total RAM across clusters | 320 GiB (Nebius uses binary units. For example, a *gibibyte* (GiB) is 230 (10243) bytes.) | | Network SSD disks total size across clusters | 2 TiB | *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Pricing in Managed Service for PostgreSQL® Source: https://docs.nebius.com/postgresql/resources/pricing.md This article provides detailed pricing for Managed Service for PostgreSQL in Nebius AI Cloud. ## How charges and prices work Each group of chargeable items in this article has two time units associated with it: * **Billing unit**: Minimum unit of usage for which you can be charged. * **Pricing unit**: Unit of usage for which the prices are shown. Charges for units smaller than the pricing unit are calculated proportionally. > For example, for GPUs on running VMs, the **billing unit** is 1 second, and the **pricing unit** is 1 hour (3600 seconds). For 30 minutes of usage, you will be charged half the hourly price. Prices in US dollars (USD, \$) apply to all customers except for companies from Israel, where prices in Israeli shekels (ILS, ₪) apply instead. All prices are shown without any applicable taxes, including VAT. Due to rounding errors, usage costs shown in the web console and final charges may slightly differ from calculations based on the prices in this article. ## Prices Managed PostgreSQL charges you for the computing resources allocated to cluster hosts and the storage size. Public access to clusters is free of charge. ### Hosts You are charged for running hosts in your Managed PostgreSQL clusters. * **Billing unit**: 1 second * **Pricing unit**: 1 hour (3600 seconds) > [tab] USD > > Charges are based on the resource preset that you are using. For example, using a `4vcpu-16gb` cluster for 1 hour costs 4 × \$0.034 + 16 × \$0.009 = \$0.28. > [tab] ILS > > Charges are based on the resource preset that you are using. For example, using a `4vcpu-16gb` cluster for 1 hour costs 4 × ₪0.1054 + 16 × ₪0.0279 = ₪0.868. #### Non-GPU Intel Ice Lake The platform is only available in the `eu-north1` [region](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | Item | Price per 1 hour | > | - | - | > | Managed PostgreSQL® on Non-GPU Intel Ice Lake. CPU | \$0.034 | > | Managed PostgreSQL® on Non-GPU Intel Ice Lake. RAM | \$0.009 | > [tab] ILS > > | Item | Price per 1 hour | > | - | - | > | Managed PostgreSQL® on Non-GPU Intel Ice Lake. CPU | ₪0.1054 | > | Managed PostgreSQL® on Non-GPU Intel Ice Lake. RAM | ₪0.0279 | #### Non-GPU AMD Epyc Genoa The platform is available in the `eu-north1`, `eu-west1`, `me-west1`, `us-central1`, `uk-south1` and `eu-west2` [regions](https://docs.nebius.com/overview/regions.md). > [tab] USD > > | Item | Price per 1 hour | > | - | - | > | Managed PostgreSQL® on Non-GPU AMD Epyc Genoa. CPU | \$0.034 | > | Managed PostgreSQL® on Non-GPU AMD Epyc Genoa. RAM | \$0.009 | > [tab] ILS > > | Item | Price per 1 hour | > | - | - | > | Managed PostgreSQL® on Non-GPU AMD Epyc Genoa. CPU | ₪0.1054 | > | Managed PostgreSQL® on Non-GPU AMD Epyc Genoa. RAM | ₪0.0279 | ### Storage You are charged for the disks attached to existing Managed PostgreSQL hosts. Charges are based on disk sizes, regardless of the amount of used space. * **Billing unit**: 1 byte per 1 second * **Pricing unit**: 1 GiB per 730 hours (230 bytes per 2,628,000 seconds \~ 1 month) > [tab] USD > > | Item | Price per 1 GiB per 730 hours | > | - | - | > | Managed PostgreSQL®. Network SSD disk | \$0.071 | > [tab] ILS > > | Item | Price per 1 GiB per 730 hours | > | - | - | > | Managed PostgreSQL®. Network SSD disk | ₪0.221 | *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* ### Container Registry # Container Registry Source: https://docs.nebius.com/container-registry/index.md Container Registry allows you to store and distribute Docker images. The service is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). > [card] [Getting started](https://docs.nebius.com/container-registry/quickstart.md) > > Create your first registry, push a Docker image to it and run the image > [card] [Working with registries](https://docs.nebius.com/container-registry/registries/manage.md) > > Learn how to create and delete registries > [card] [Authentication](https://docs.nebius.com/container-registry/authentication.md) > > Set up credentials to access registries from your local machine and CI/CD environments > [card] [Copying images between registries](https://docs.nebius.com/container-registry/images/copy.md) > > Transfer Docker images between Container Registry and other registries, such as GitHub Packages # Getting started with Container Registry: Create your first registry and manage a Docker image in it Source: https://docs.nebius.com/container-registry/quickstart.md Container Registry helps you manage Docker images for your resources. This guide covers how to set up your environment to work with the service, create your first *registry*, push a Docker image to it and run the image. ## Prepare your environment In this guide, you will use the terminal in your environment, for example, on your local machine, to run commands that create and manage Nebius AI Cloud resources. The commands use the Nebius AI Cloud CLI or SDK and tools that you need to install first. 1. Install Docker Engine: * [Ubuntu](https://docs.docker.com/engine/install/ubuntu/) * [macOS](https://docs.docker.com/desktop/install/mac-install/) 2. Install the tools that manage Nebius AI Cloud resources: > [tab] CLI > > 1. Install **jq**, which parses JSON outputs from the Nebius AI Cloud CLI and extracts resource IDs for other commands: > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > > 2. Install the **Nebius AI Cloud CLI** ([how to install](https://docs.nebius.com/cli/install.md)), which manages all Nebius AI Cloud resources: > > ```bash > curl -sSL https://artifacts.nebius.cloud/cli/install.sh | bash > ``` > > 3. Configure the **Nebius AI Cloud CLI**: > > ```bash > nebius profile create > ``` > > The last command, `nebius profile create`, will guide you through several prompts. After you complete the prompts, your browser will open the Nebius AI Cloud web console sign-in screen. Sign in to the web console to complete the initialization. If you have access to multiple tenants, the CLI will prompt you to choose a tenant ID. After that, save your project ID in the CLI configuration. > > If the project ID hasn't been configured during the `nebius profile create` flow, [get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id) and save it in the CLI configuration: > > ```bash > nebius config set parent-id > ``` > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). 3. Create an environment variable for the [region](https://docs.nebius.com/overview/regions.md) in which your project is located: ```bash export REGION_ID= ``` For available region IDs, see [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). ## Create a registry Create a test registry and save a part of its ID to an environment variable: > [tab] CLI > > ```bash > export REGISTRY_PATH=$(nebius registry create \ > --name quickstart-registry \ > --format json | jq -r ".metadata.id" | cut -d- -f 2) > ``` > [tab] Go SDK > > ```go > createService := sdk.Services().Registry().V1().Registry() > createOperation, err := createService.Create( > ctx, > ®istry.CreateRegistryRequest{ > Metadata: &common.ResourceMetadata{ > Name: "quickstart-registry", > }, > Spec: ®istry.RegistrySpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create registry: %w", err) > } > createOperation, err = createOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for registry creation: %w", err) > } > registryPath := strings.Split(createOperation.ResourceID(), "-")[1] > fmt.Println(registryPath) > ``` > > The code prints the registry path, which is the registry ID without the `registry-` prefix. Run the code and save its output to an environment variable: > > ```bash > export REGISTRY_PATH=$() > ``` > > In this command, set the command that runs your code, for example, `go run .`. > [tab] Python SDK > > ```python > registry_service = RegistryServiceClient(sdk) > create_operation = await registry_service.create( > CreateRegistryRequest( > metadata=ResourceMetadata(name="quickstart-registry"), > spec=RegistrySpec(), > ), > ) > await create_operation.wait() > registry_path = create_operation.resource_id.split("-")[1] > print(registry_path) > ``` > > The code prints the registry path, which is the registry ID without the `registry-` prefix. Run the code and save its output to an environment variable: > > ```bash > export REGISTRY_PATH=$() > ``` > > In this command, set the command that runs your code, for example, `python3 main.py`. > [tab] JavaScript SDK > > ```ts > const createService = new RegistryService(sdk); > const createOperation = await createService.create( > CreateRegistryRequest.create({ > metadata: { name: "quickstart-registry" }, > spec: {}, > }), > ).result; > await createOperation.wait(); > const registryPath = createOperation.resourceId().split("-")[1]; > console.log(registryPath); > ``` > > The code prints the registry path, which is the registry ID without the `registry-` prefix. Run the code and save its output to an environment variable: > > ```bash > export REGISTRY_PATH=$() > ``` > > In this command, set the command that runs your code, for example, `node main.mjs`. ## Configure Docker Configure Docker to work with the created registry: > [tab] CLI > > 1. Run the Nebius AI Cloud Docker credential helper. It lets you use registries in Container Registry without running the `docker login`. > > ```bash > nebius registry configure-helper > ``` > > 2. Check that the credential helper is configured: > > 1. Open the file from the previous command output, for example, by using the `cat` command: > > ```bash > cat ~/.docker/config.json > ``` > > 2. Check that the `credHelpers` property contains the following lines: > > ```json > "cr.eu-north1.nebius.cloud": "nebius", > "cr.eu-north2.nebius.cloud": "nebius", > "cr.eu-south1.nebius.cloud": "nebius", > "cr.eu-west1.nebius.cloud": "nebius", > "cr.eu-west2.nebius.cloud": "nebius", > "cr.me-west1.nebius.cloud": "nebius", > "cr.uk-south1.nebius.cloud": "nebius", > "cr.uk-south2.nebius.cloud": "nebius", > "cr.us-central1.nebius.cloud": "nebius", > "cr.us-north1.nebius.cloud": "nebius" > ``` > [tab] Go SDK > > 1. Get an access token: > > ```go > token, err := sdk.BearerToken(ctx) > if err != nil { > return err > } > fmt.Println(token.Token) > ``` > > 2. Run the code and pipe its output into `docker login`: > > ```bash > | \ > docker login cr.$REGION_ID.nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the command that runs your code, for example, `go run .`. > > The access token is valid for 12 hours. After it expires, get a new token and log in again. > [tab] Python SDK > > 1. Get an access token: > > ```python > token = await sdk.get_token(timeout=None) > print(token.token) > ``` > > 2. Run the code and pipe its output into `docker login`: > > ```bash > | \ > docker login cr.$REGION_ID.nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the command that runs your code, for example, `python3 main.py`. > > The access token is valid for 12 hours. After it expires, get a new token and log in again. > [tab] JavaScript SDK > > 1. Get an access token: > > ```ts > const authorization = sdk.getAuthorizationProvider(); > if (!authorization) { > throw new Error("authorization is not configured"); > } > const metadata = new Metadata(); > await authorization.authenticator().authenticate(metadata); > const header = metadata.get("authorization")[0]; > if (typeof header !== "string") { > throw new Error("authorization token is missing"); > } > const token = header.replace(/^Bearer\s+/, ""); > console.log(token); > ``` > > The code uses `Metadata` from the `@grpc/grpc-js` package. Install the package by using `npm install @grpc/grpc-js` and import `Metadata` from it. > > 2. Run the code and pipe its output into `docker login`: > > ```bash > | \ > docker login cr.$REGION_ID.nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the command that runs your code, for example, `node main.mjs`. > > The access token is valid for 12 hours. After it expires, get a new token and log in again. ## Push and run a Docker image > [!NOTE] > > Do not run Docker commands as root. The credential helper is configured for your user account, so root may not be able to access the credentials. 1. Pull an image from the [Docker Hub](https://hub.docker.com/): ```bash docker pull hello-world ``` 2. Assign the image a tag: ```bash docker tag hello-world \ cr.$REGION_ID.nebius.cloud/$REGISTRY_PATH/hello-world:hello ``` 3. Push the image to the Container Registry: ```bash docker push cr.$REGION_ID.nebius.cloud/$REGISTRY_PATH/hello-world:hello ``` 4. Run the image: ```bash docker run cr.$REGION_ID.nebius.cloud/$REGISTRY_PATH/hello-world:hello ``` # How to manage registries in Container Registry Source: https://docs.nebius.com/container-registry/registries/manage.md Registries in Container Registry store Docker images and make them available to your resources. This guide will help you create and delete registries in Container Registry. ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to create a registry > [tab] CLI > > Run the following command: > > ```bash > nebius registry create \ > --name > ``` > > Though the `--name` parameter is not required, the registry name simplifies finding the registry in the list of registries in Container Registry. > > In the output, the registry ID is in the `metadata.id` parameter and the registry fully qualified domain name (FQDN) is in the `status.registry_fqdn` parameter. > [tab] Go SDK > > ```go > createService := sdk.Services().Registry().V1().Registry() > createOperation, err := createService.Create( > ctx, > ®istry.CreateRegistryRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > }, > Spec: ®istry.RegistrySpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create registry: %w", err) > } > createOperation, err = createOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for registry creation: %w", err) > } > createdRegistry, err := createService.Get( > ctx, > ®istry.GetRegistryRequest{Id: createOperation.ResourceID()}, > ) > if err != nil { > return fmt.Errorf("get created registry: %w", err) > } > fmt.Println(createdRegistry) > ``` > > Though `Metadata.Name` is not required, the registry name simplifies finding the registry in the list of registries in Container Registry. > > The response returns the registry ID in `Metadata.Id` and the registry fully qualified domain name (FQDN) in `Status.RegistryFqdn`. > [tab] Python SDK > > ```python > registry_service = RegistryServiceClient(sdk) > create_operation = await registry_service.create( > CreateRegistryRequest( > metadata=ResourceMetadata(name=""), > spec=RegistrySpec(), > ), > ) > await create_operation.wait() > created_registry = await registry_service.get( > GetRegistryRequest(id=create_operation.resource_id), > ) > print(created_registry) > ``` > > Though `metadata.name` is not required, the registry name simplifies finding the registry in the list of registries in Container Registry. > > The response returns the registry ID in `metadata.id` and the registry fully qualified domain name (FQDN) in `status.registry_fqdn`. > [tab] JavaScript SDK > > ```ts > const createService = new RegistryService(sdk); > const createOperation = await createService.create( > CreateRegistryRequest.create({ > metadata: { name: "" }, > spec: {}, > }), > ).result; > await createOperation.wait(); > const createdRegistry = await createService.get( > GetRegistryRequest.create({ id: createOperation.resourceId() }), > ).result; > console.log(createdRegistry); > ``` > > Though `metadata.name` is not required, the registry name simplifies finding the registry in the list of registries in Container Registry. > > The response returns the registry ID in `metadata.id` and the registry fully qualified domain name (FQDN) in `status.registryFqdn`. To access the created registry, use its URL: ```bash / ``` The registry path is the registry ID without the `registry-` prefix. For example, the registry with the `registry-a00bcdefghe12xyz3f` ID in the `eu-north1` region has the `cr.eu-north1.nebius.cloud/a00bcdefghe12xyz3f` URL. ## How to delete a registry To delete a registry: 1. Get the registry ID by listing the registries: > [tab] CLI > > ```bash > nebius registry list > ``` > > The ID is returned in the `.metadata.id` parameter of the registry resource. > [tab] Go SDK > > ```go > listService := sdk.Services().Registry().V1().Registry() > registries, err := listService.List( > ctx, > ®istry.ListRegistriesRequest{}, > ) > if err != nil { > return fmt.Errorf("list registries: %w", err) > } > fmt.Println(registries) > ``` > > The response returns the ID of each registry in `Items[].Metadata.Id`. > [tab] Python SDK > > ```python > registry_service = RegistryServiceClient(sdk) > registries = await registry_service.list(ListRegistriesRequest()) > print(registries) > ``` > > The response returns the ID of each registry in `items[].metadata.id`. > [tab] JavaScript SDK > > ```ts > const listService = new RegistryService(sdk); > const registries = await listService.list( > ListRegistriesRequest.create({}), > ).result; > console.log(registries); > ``` > > The response returns the ID of each registry in `items[].metadata.id`. 2. Delete the registry: > [tab] CLI > > ```bash > nebius registry delete --id > ``` > > In this command, set `--id` to the registry ID. If the registry contains images, the deletion fails. To delete the registry together with its images, add the `--force` parameter. > [tab] Go SDK > > ```go > deleteService := sdk.Services().Registry().V1().Registry() > deleteOperation, err := deleteService.Delete( > ctx, > ®istry.DeleteRegistryRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("delete registry: %w", err) > } > if _, err := deleteOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for registry deletion: %w", err) > } > ``` > > In the code, set `Id` to the registry ID. If the registry contains images, the deletion fails. To delete the registry together with its images, add `Force: true` to `DeleteRegistryRequest`. > [tab] Python SDK > > ```python > registry_service = RegistryServiceClient(sdk) > delete_operation = await registry_service.delete( > DeleteRegistryRequest(id=""), > ) > await delete_operation.wait() > ``` > > In the code, set `id` to the registry ID. If the registry contains images, the deletion fails. To delete the registry together with its images, add `force=True` to `DeleteRegistryRequest`. > [tab] JavaScript SDK > > ```ts > const deleteService = new RegistryService(sdk); > const deleteOperation = await deleteService.delete( > DeleteRegistryRequest.create({ id: "" }), > ).result; > await deleteOperation.wait(); > ``` > > In the code, set `id` to the registry ID. If the registry contains images, the deletion fails. To delete the registry together with its images, add `force: true` to `DeleteRegistryRequest`. # How to authenticate in Container Registry Source: https://docs.nebius.com/container-registry/authentication.md You can authenticate in Container Registry with the help of a short-lived [access token](https://docs.nebius.com/iam/authorization/access-tokens.md) issued by the Nebius AI Cloud CLI or SDK each time, or with a long-lived [static key token](https://docs.nebius.com/iam/authorization/static-keys.md) issued for the Container Registry service. * For a [local machine](https://docs.nebius.com/container-registry/authentication.md#working-on-a-local-machine), use a Docker credential helper. * For a [CI/CD environment](https://docs.nebius.com/container-registry/authentication.md#working-in-a-ci/cd-environment), use a service account and either issue a [long-lived static key](https://docs.nebius.com/container-registry/authentication.md#long-lived-static-key-token) and save it in your pipeline settings, or get a [short-lived token](https://docs.nebius.com/container-registry/authentication.md#short-lived-access-token) each time your pipeline runs. ## Prerequisites > [tab] CLI > > [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## Working on a local machine On your local machine, you can simply configure a Docker credential helper to work with Container Registry. 1. Run the following command: ```bash nebius registry configure-helper ``` 2. Check that the credential helper is configured: 1. Open the file from the previous command output, for example, with the `cat` command: ```bash cat ~/.docker/config.json ``` 2. Check that the `credHelpers` property contains the following lines: ```json "cr.eu-north1.nebius.cloud": "nebius", "cr.eu-north2.nebius.cloud": "nebius", "cr.eu-south1.nebius.cloud": "nebius", "cr.eu-west1.nebius.cloud": "nebius", "cr.eu-west2.nebius.cloud": "nebius", "cr.me-west1.nebius.cloud": "nebius", "cr.uk-south1.nebius.cloud": "nebius", "cr.uk-south2.nebius.cloud": "nebius", "cr.us-central1.nebius.cloud": "nebius", "cr.us-north1.nebius.cloud": "nebius" ``` When you run any `docker` command after this configuration, it requests credentials from `nebius`, which might require you to log in with the help of the [Nebius AI Cloud web console](https://console.nebius.com). ## Working in a CI/CD environment In your CI/CD environment, you are unlikely to be able to log into the web console. Therefore, you need to [create a service account](https://docs.nebius.com/iam/service-accounts/manage.md#create-a-service-account) and use it to get credentials. Make sure that the service account is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `viewer` role within your tenant; for example, the default `viewers` group. There are two ways to work with a service account: * Issue a long-lived [static key](https://docs.nebius.com/iam/authorization/static-keys.md) for Container Registry. * Get a short-lived [access token](https://docs.nebius.com/iam/authorization/access-tokens.md) in each run of your pipeline job. ### Long-lived static key token To use a long-lived token, you need to [issue a static key](https://docs.nebius.com/iam/authorization/static-keys/manage.md) and store the token in your CI/CD environment configuration. 1. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. 2. Create a static key for the CI/CD service account: > [tab] CLI > > ```bash > nebius iam static-key issue \ > --account-service-account-id= \ > --service=CONTAINER_REGISTRY > ``` > > By default, the key lifetime is 6 months. If you need a different lifetime, add the `--expires-at` parameter to this command. It accepts the date of expiration in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, for example `2025-11-23T11:44:43.232142Z`. You can set a lifetime of up to 3 years. > [tab] Go SDK > > ```go > staticKeyService := sdk.Services().IAM().V1().StaticKey() > issuedKey, err := staticKeyService.Issue( > ctx, > &iam.IssueStaticKeyRequest{ > Spec: &iam.StaticKeySpec{ > Account: &iam.Account{ > Type: &iam.Account_ServiceAccount_{ > ServiceAccount: &iam.Account_ServiceAccount{ > Id: "", > }, > }, > }, > Service: iam.StaticKeySpec_CONTAINER_REGISTRY, > }, > }, > ) > if err != nil { > return fmt.Errorf("issue static key: %w", err) > } > fmt.Println(issuedKey.GetToken()) > ``` > > In the code, set `Id` in `Account_ServiceAccount` to the ID of your service account. `Service` is set to `iam.StaticKeySpec_CONTAINER_REGISTRY`, so the key works only with Container Registry. > > By default, the key lifetime is 6 months. If you need a different lifetime, add `ExpiresAt` to `StaticKeySpec`. You can set a lifetime of up to 3 years. > [tab] Python SDK > > ```python > static_key_service = StaticKeyServiceClient(sdk) > issued_key = await static_key_service.issue( > IssueStaticKeyRequest( > spec=StaticKeySpec( > account=Account( > service_account=Account__ServiceAccount( > id="", > ), > ), > service=StaticKeySpec__ClientService.CONTAINER_REGISTRY, > ), > ), > ) > print(issued_key.token) > ``` > > In the code, set `id` in `Account__ServiceAccount` to the ID of your service account. `service` is set to `StaticKeySpec__ClientService.CONTAINER_REGISTRY`, so the key works only with Container Registry. > > By default, the key lifetime is 6 months. If you need a different lifetime, add `expiresAt` to `StaticKeySpec`. You can set a lifetime of up to 3 years. > [tab] JavaScript SDK > > ```ts > const staticKeyService = new StaticKeyService(sdk); > const issuedKey = await staticKeyService.issue( > IssueStaticKeyRequest.create({ > metadata: {}, > spec: { > account: { > type: { > $case: "serviceAccount", > serviceAccount: { id: "" }, > }, > }, > service: StaticKeySpec_ClientService.CONTAINER_REGISTRY, > }, > }), > ).result; > console.log(issuedKey.token); > ``` > > In the code, set `id` in `serviceAccount` to the ID of your service account. `service` is set to `StaticKeySpec_ClientService.CONTAINER_REGISTRY`, so the key works only with Container Registry. > > By default, the key lifetime is 6 months. If you need a different lifetime, add `expiresAt` to `spec`. You can set a lifetime of up to 3 years. 3. Get the static key token from the output. 4. Configure the job that works with Container Registry to use this token: ```bash docker login cr..nebius.cloud \ --username iam \ --password ``` In this command, set the [region](https://docs.nebius.com/overview/regions.md) of the registry with which the pipeline is working. ### Short-lived access token To use a short-lived access token, you need to get it from the Nebius AI Cloud CLI or SDK in your CI/CD environment. Access tokens have a lifetime of 12 hours. > [tab] CLI > > 1. Create an [authorized key](https://docs.nebius.com/iam/service-accounts/authorized-keys.md) for your service account. > 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 3. [Configure a profile](https://docs.nebius.com/iam/service-accounts/authorized-keys.md#configure-your-profile) for your service account in the `.nebius/config.yaml` file. > 4. Configure the job that works with Container Registry to generate credentials by using `nebius` and pipe them directly into a `docker` command: > > ```bash > nebius iam get-access-token | \ > docker login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the [region](https://docs.nebius.com/overview/regions.md) of the registry with which the pipeline is working. > > You can do the same if you are using `helm registry login`: > > ```bash > nebius iam get-access-token | \ > helm registry login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > [tab] Go SDK > > 1. [Initialize the Go SDK with the credentials of your service account](https://docs.nebius.com/sdk/go/install-auth.md#initialization-and-authentication). > > 2. In the code of your job, get an access token: > > ```go > token, err := sdk.BearerToken(ctx) > if err != nil { > return err > } > fmt.Println(token.Token) > ``` > > 3. Configure the job that works with Container Registry to run the code and pipe its output directly into a `docker` command: > > ```bash > | \ > docker login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the command that runs your code, for example, `go run .`, and the [region](https://docs.nebius.com/overview/regions.md) of the registry with which the pipeline is working. > > You can do the same if you are using `helm registry login`: > > ```bash > | \ > helm registry login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > [tab] Python SDK > > 1. [Initialize the Python SDK with the credentials of your service account](https://docs.nebius.com/sdk/python/install-auth.md#initialization-and-authentication). > > 2. In the code of your job, get an access token: > > ```python > token = await sdk.get_token(timeout=None) > print(token.token) > ``` > > 3. Configure the job that works with Container Registry to run the code and pipe its output directly into a `docker` command: > > ```bash > | \ > docker login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the command that runs your code, for example, `python3 main.py`, and the [region](https://docs.nebius.com/overview/regions.md) of the registry with which the pipeline is working. > > You can do the same if you are using `helm registry login`: > > ```bash > | \ > helm registry login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > [tab] JavaScript SDK > > 1. [Initialize the JavaScript SDK with the credentials of your service account](https://docs.nebius.com/sdk/javascript/install-auth.md#initialization-and-authentication). > > 2. In the code of your job, get an access token: > > ```ts > const authorization = sdk.getAuthorizationProvider(); > if (!authorization) { > throw new Error("authorization is not configured"); > } > const metadata = new Metadata(); > await authorization.authenticator().authenticate(metadata); > const header = metadata.get("authorization")[0]; > if (typeof header !== "string") { > throw new Error("authorization token is missing"); > } > const token = header.replace(/^Bearer\s+/, ""); > console.log(token); > ``` > > The code uses `Metadata` from the `@grpc/grpc-js` package. Install the package by using `npm install @grpc/grpc-js` and import `Metadata` from it. > > 3. Configure the job that works with Container Registry to run the code and pipe its output directly into a `docker` command: > > ```bash > | \ > docker login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` > > In this command, set the command that runs your code, for example, `node main.mjs`, and the [region](https://docs.nebius.com/overview/regions.md) of the registry with which the pipeline is working. > > You can do the same if you are using `helm registry login`: > > ```bash > | \ > helm registry login cr..nebius.cloud \ > --username iam \ > --password-stdin > ``` ## Troubleshooting If you are getting the "Permission denied" error when trying to access Container Registry from your [local machine](https://docs.nebius.com/container-registry/authentication.md#working-on-a-local-machine), double-check that the Docker credential helper was configured correctly: * Check that the system can find the Nebius AI Cloud CLI binary: ```bash which nebius ``` It should return the path to the `nebius` executable, for example, `/home/user/.nebius/bin/nebius`, or `/opt/homebrew/bin/nebius` if you installed the CLI with Homebrew. If the command returns no path, [reinstall](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI, and then rerun `nebius registry configure-helper`. * Check that the system can find the credential helper: ```bash which docker-credential-nebius ``` It should return the path to the `docker-credential-nebius` executable, for example, `/home/user/.nebius/bin/docker-credential-nebius`, or `/opt/homebrew/bin/docker-credential-nebius` if you installed the CLI with Homebrew. If the command returns no path, rerun `nebius registry configure-helper`. * Check that the region of the registry you are trying to access is present in the `.docker/config.json` file: ```json "cr..nebius.cloud": "nebius" ``` If it is not, add it manually or rerun `nebius registry configure-helper`. # Copying images to and from registries in Container Registry Source: https://docs.nebius.com/container-registry/images/copy.md You can copy Docker images to and from Container Registry: 1. [Set up authentication in Container Registry](https://docs.nebius.com/container-registry/authentication.md) on your machine. 2. Get the fully qualified domain names (FQDNs) and paths of your source and destination registries. In Nebius AI Cloud, a registry's FQDN is `cr..nebius.cloud` where `` is the ID of a [Nebius AI Cloud region](https://docs.nebius.com/overview/regions.md); for example, `cr.eu-north1.nebius.cloud`. To get a registry's FQDN, run the Nebius AI Cloud CLI command `nebius registry list` or `nebius registry get `; the output contains the FQDN in the `.status.registry_fqdn` parameter. The registry path is the registry ID from the `.metadata.id` parameter without the `registry-` prefix. For more details about the commands, see the references for [nebius registry list](https://docs.nebius.com/cli/reference/registry/list.md) and [nebius registry get](https://docs.nebius.com/cli/reference/registry/get.md). 3. Pull the image from the source registry: ```bash docker pull //: ``` 4. Add a destination registry tag to the image and push it to the registry: ```bash docker tag \ //: \ //: docker push //: ``` > For example, to copy the `hello-world:hello` image from the registry with the `registry-a00bcdefghe12xyz3f` ID in Nebius AI Cloud's `eu-north1` region and transfer it to a [GitHub Packages container registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) called `octocat`, run the following commands: > > ```bash > docker pull cr.eu-north1.nebius.cloud/a00bcdefghe12xyz3f/hello-world:hello > docker tag \ > cr.eu-north1.nebius.cloud/a00bcdefghe12xyz3f/hello-world:hello \ > ghcr.io/octocat/hello-world:hello > docker push ghcr.io/octocat/hello-world:hello > ``` # Quotas in Container Registry Source: https://docs.nebius.com/container-registry/resources/quotas-limits.md Container Registry has quotas for every [tenant](https://docs.nebius.com/iam/overview.md#tenants). | Quota name | Default value per [region](https://docs.nebius.com/overview/regions.md) | | - | - | | Registries | 10 | For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). # Pricing in Container Registry Source: https://docs.nebius.com/container-registry/resources/pricing.md The Container Registry service in Nebius AI Cloud is provided free of charge. ## Network ### Virtual Networks # Virtual Networks Source: https://docs.nebius.com/vpc/index.md Virtual Networks is a service that provides networking resources, such as subnets and pools. The service allows you to create Nebius AI Cloud resources within a configured networking infrastructure. You can either use the default resources of Virtual Networks or create your own. The service is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). > [card] [About Virtual Networks](https://docs.nebius.com/vpc/overview.md) > > Get familiar with Virtual Networks resources, including the default ones > [card] [Networking](https://docs.nebius.com/vpc/networking/resources.md) > > Find out how to get a network or subnet ID, and how to isolate resources via networks > [card] [Addressing](https://docs.nebius.com/vpc/addressing/available-addresses.md) > > Learn more about default CIDR blocks and management of IP addresses > [card] [Routing](https://docs.nebius.com/vpc/routing/overview.md) > > Explore how to customize routing for advanced network setups, such as NAT gateways > [card] [DNS](https://docs.nebius.com/vpc/dns/overview.md) > > Resolve names privately inside a network by using system-managed and custom DNS zones > [card] [Security groups](https://docs.nebius.com/vpc/security-groups/overview.md) > > Learn how to set up a firewall for your Compute virtual machines > [card] [Nebius VPN Gateway](https://docs.nebius.com/vpc/nebius-vpn-gateway.md) > > Establish site-to-site VPN connectivity with external networks through an IPsec gateway # About Virtual Networks Source: https://docs.nebius.com/vpc/overview.md Virtual Networks is a service that provides networking infrastructure to Nebius AI Cloud resources. The service's key resources are [networks](https://docs.nebius.com/vpc/overview.md#network), [subnets](https://docs.nebius.com/vpc/overview.md#subnet), [pools](https://docs.nebius.com/vpc/overview.md#pool), [allocations](https://docs.nebius.com/vpc/overview.md#allocation), [routing tables](https://docs.nebius.com/vpc/overview.md#routing-table) and [DNS zones](https://docs.nebius.com/vpc/overview.md#dns-zone). When you create a project, Virtual Networks [automatically provides you](https://docs.nebius.com/vpc/overview.md#default-virtual-networks-resources) with the required networking resources. You can use them as they are, change them, create new Virtual Networks resources or [customize the whole networking infrastructure](https://docs.nebius.com/vpc/overview.md#customized-networking-infrastructure). > [!NOTE] > > Virtual Networks currently supports only IPv4 addresses. ## Network A *network* in Nebius AI Cloud is similar to a regular local area network. It ensures IP connectivity between resources within a network and isolates them from resources outside this network. Some Nebius AI Cloud resources are network-specific, and they require a network to be part of their configuration. For example, these can include Managed Service for PostgreSQL® and Managed Service for MLflow clusters. ## Subnet A *subnet* is a network segment that contains a certain range of IP addresses allocated in this network. Some Nebius AI Cloud resources are subnet-specific, and they require a subnet to be part of their configuration. For example, these can include Compute virtual machines (VMs), Managed Service for Kubernetes® clusters or [allocations](https://docs.nebius.com/vpc/overview.md#allocation). When you create a resource within a subnet, the IP address of this resource is taken from the [pool](https://docs.nebius.com/vpc/overview.md#pool) attached to this subnet (that is, from the IP address range of this subnet). To reserve a range of IP addresses for a subnet, explicitly specify CIDR blocks in the configuration of this subnet. These CIDR blocks must be within the IP address range of the network, and other subnets must not use these blocks. Alternatively, you can configure a subnet to transparently use the pools of the network that the subnet belongs to. All subnets of this network can concurrently use these pools. ## Pool A *pool* reserves [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks). You can assign a pool to a subnet or a network. A pool assigned to a network determines the allowed IP range of this network. A pool assigned to a subnet determines the IP range from which resources take IP addresses in this subnet. Any pool has a source pool. CIDR blocks defined in a new pool must be a subset of the CIDR blocks of the source pool. For example, you can have a pool `10.0.0.0/8`, which has a child pool `10.0.0.0/16`, and `10.0.0.0/16` has a child pool `10.0.0.0/24`. For `10.0.0.0/24`, the source pool is `10.0.0.0/16`. CIDR blocks that belong to different subnets within the same network cannot overlap. ## Allocation An *allocation* is a reserved IP address. It can be a public or a private address. You can attach an allocation to a resource, such as a Compute VM, so other resources can reach it by using the IP address from the allocation. An allocation is attributed to a subnet, so the IP address of the allocation must be within the IP address range of the subnet. ## Routing table A *routing table*, or a *route table*, is assigned to a subnet and defines how to route traffic from the subnet's resources. Each routing table contains a set of *routes*. A route contains the list of destination CIDR blocks and the next hop for them. If a routing table applies to a resource, and this resource sends traffic to an IP address that belongs to a CIDR block in one of the table's routes, this traffic is routed to the next hop defined in the route. You can create and manage custom routing tables that work together with default routing tables and built-in routing rules. For more details, see [Routing in Nebius AI Cloud](https://docs.nebius.com/vpc/routing/overview.md) and [Managing routing tables and routes](https://docs.nebius.com/vpc/routing/manage.md). ## DNS zone A *DNS zone* is a container for a domain name and every name under it. A zone is attached to one network, and the names in it resolve only from workloads within this network. Each network gets a system-managed zone that Nebius AI Cloud fills with the [FQDNs](https://docs.nebius.com/compute/virtual-machines/fqdn.md) of the VMs in the network. You can also create custom zones on the same network. For more details, see [About DNS](https://docs.nebius.com/vpc/dns/overview.md), [Managing DNS zones](https://docs.nebius.com/vpc/dns/manage-zones.md) and [Managing DNS records](https://docs.nebius.com/vpc/dns/manage-records.md). ## Default Virtual Networks resources When you create a project, it is automatically provided with default Virtual Networks resources. This allows you to manage other Nebius AI Cloud resources that require networks, subnets, pools, and allocations. You can use these default resources or create new ones. Some Nebius AI Cloud resources automatically create Virtual Networks resources if the latter are not specified in the configuration. For example, Compute VMs create their own allocations unless you explicitly specify an existing allocation in the VM configuration. For some other resources, you cannot change or cancel the implicit creation of Virtual Networks resources. For example, Managed Service for Kubernetes clusters create their own allocations. The default Virtual Networks resources include the following: * `default-network`: Network in a given project. * `default-subnet`: Subnet within `default-network`. This subnet uses pools in `default-network`. * `default-network-pool`: Pool of private IPv4 addresses that belongs to `default-network`. The CIDR block of this pool [depends on the region](https://docs.nebius.com/vpc/addressing/available-addresses.md) of the project. * `default-public-pool`: Pool of public IPv4 addresses that belongs to `default-network`. * `default-route-table-***`: Routing table within each network. It consists of one route that routes to the internet all egress traffic destined for public IP addresses. Each subnet in a network is assigned the network's default routing table by default. You can customize, modify or delete most of the default resources, except for `default-public-pool`. This resource is shared across all projects in a tenant. ## Customized networking infrastructure If you need a customized networking infrastructure, plan the configuration of the required resources in advance. You cannot change the configuration of Virtual Networks resources once they are attached to active workloads (for example, a Compute VM). To change such resources, you first need to delete the workloads. As these workloads are active, such changes are disruptive for the infrastructure. Here are some examples when you might need a customized networking infrastructure: * Multi-region deployment in Nebius AI Cloud * Establishing connectivity between the environment in Nebius AI Cloud and an external infrastructure * Particular IP addressing schema *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Getting network and subnet IDs for Nebius AI Cloud resources Source: https://docs.nebius.com/vpc/networking/resources.md When you create Nebius AI Cloud resources by using the [Nebius AI Cloud CLI](https://docs.nebius.com/cli/index.md), the [Terraform provider](https://docs.nebius.com/terraform-provider/index.md) or the [API](https://docs.nebius.com/grpc-api/index.md), you need to specify the ID of the [network](https://docs.nebius.com/vpc/overview.md#network) or [subnet](https://docs.nebius.com/vpc/overview.md#subnet). ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [!NOTE] > > If you are in a group with the `viewer` role, you can get the IDs but cannot create any Nebius AI Cloud resources. ## How to get a network ID > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > 2. To copy the network ID, click the icon next to the required ID. > [tab] CLI > > * If you know the name of the network, use the `get-by-name` command: > > ```bash > nebius vpc network get-by-name --name > ``` > > * If you do not know the exact name of the network, use the `list` command to view a list of available networks: > > ```bash > nebius vpc network list > ``` > > You can find the ID in the `metadata.id` parameter of the output. > [tab] Go SDK > > In the code, set `ParentId` to the ID of the project that contains the network. > > * If you know the name of the network, get it by name. Set `Name` to the network name: > > ```go > namedNetworkService := sdk.Services().VPC().V1(). > Network() > namedNetwork, err := namedNetworkService.GetByName( > ctx, > &vpc.GetNetworkByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(namedNetwork) > ``` > > * If you do not know the exact name of the network, list the available networks: > > ```go > networksService := sdk.Services().VPC().V1(). > Network() > networksResponse, err := networksService.List( > ctx, > &vpc.ListNetworksRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(networksResponse) > ``` > > The response contains the network ID in `Metadata.Id`. In a list response, each network in `Items` has its ID in `Metadata.Id`. > [tab] Python SDK > > In the code, set `parent_id` to the ID of the project that contains the network. > > * If you know the name of the network, get it by name. Set `name` to the network name: > > ```python > named_network_service = NetworkServiceClient(sdk) > named_network = await named_network_service.get_by_name( > GetNetworkByNameRequest( > parent_id="", > name="", > ), > ) > print(named_network) > ``` > > * If you do not know the exact name of the network, list the available networks: > > ```python > networks_service = NetworkServiceClient(sdk) > networks_response = await networks_service.list( > ListNetworksRequest( > parent_id="", > ), > ) > print(networks_response) > ``` > > The response contains the network ID in `metadata.id`. In a list response, each network in `items` has its ID in `metadata.id`. > [tab] JavaScript SDK > > In the code, set `parentId` to the ID of the project that contains the network. > > * If you know the name of the network, get it by name. Set `name` to the network name: > > ```ts > const namedNetworkService = new NetworkService(sdk); > const namedNetwork = await namedNetworkService.getByName( > GetNetworkByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log(namedNetwork); > ``` > > * If you do not know the exact name of the network, list the available networks: > > ```ts > const networksService = new NetworkService(sdk); > const networksResponse = await networksService.list( > ListNetworksRequest.create({ > parentId: "", > }), > ).result; > console.log(networksResponse); > ``` > > The response contains the network ID in `metadata.id`. In a list response, each network in `items` has its ID in `metadata.id`. ## How to get a subnet ID > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > 2. Switch to the **Subnets** tab. > 3. To copy the subnet ID, click the icon next to the required ID. > [tab] CLI > > * If you know the name of the subnet, use the `get-by-name` command: > > ```bash > nebius vpc subnet get-by-name --name > ``` > > * If you do not know the exact name of the subnet, use the `list` command to view a list of available subnets: > > ```bash > nebius vpc subnet list > ``` > > You can find the ID in the `metadata.id` parameter of the output. > [tab] Go SDK > > In the code, set `ParentId` to the ID of the project that contains the subnet. > > * If you know the name of the subnet, get it by name. Set `Name` to the subnet name: > > ```go > namedSubnetService := sdk.Services().VPC().V1(). > Subnet() > namedSubnet, err := namedSubnetService.GetByName( > ctx, > &vpc.GetSubnetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(namedSubnet) > ``` > > * If you do not know the exact name of the subnet, list the available subnets: > > ```go > subnetsService := sdk.Services().VPC().V1(). > Subnet() > subnetsResponse, err := subnetsService.List( > ctx, > &vpc.ListSubnetsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(subnetsResponse) > ``` > > The response contains the subnet ID in `Metadata.Id`. In a list response, each subnet in `Items` has its ID in `Metadata.Id`. > [tab] Python SDK > > In the code, set `parent_id` to the ID of the project that contains the subnet. > > * If you know the name of the subnet, get it by name. Set `name` to the subnet name: > > ```python > named_subnet_service = SubnetServiceClient(sdk) > named_subnet = await named_subnet_service.get_by_name( > GetSubnetByNameRequest( > parent_id="", > name="", > ), > ) > print(named_subnet) > ``` > > * If you do not know the exact name of the subnet, list the available subnets: > > ```python > subnets_service = SubnetServiceClient(sdk) > subnets_response = await subnets_service.list( > ListSubnetsRequest( > parent_id="", > ), > ) > print(subnets_response) > ``` > > The response contains the subnet ID in `metadata.id`. In a list response, each subnet in `items` has its ID in `metadata.id`. > [tab] JavaScript SDK > > In the code, set `parentId` to the ID of the project that contains the subnet. > > * If you know the name of the subnet, get it by name. Set `name` to the subnet name: > > ```ts > const namedSubnetService = new SubnetService(sdk); > const namedSubnet = await namedSubnetService.getByName( > GetSubnetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log(namedSubnet); > ``` > > * If you do not know the exact name of the subnet, list the available subnets: > > ```ts > const subnetsService = new SubnetService(sdk); > const subnetsResponse = await subnetsService.list( > ListSubnetsRequest.create({ > parentId: "", > }), > ).result; > console.log(subnetsResponse); > ``` > > The response contains the subnet ID in `metadata.id`. In a list response, each subnet in `items` has its ID in `metadata.id`. # Isolating Nebius AI Cloud resources in separate networks Source: https://docs.nebius.com/vpc/networking/isolation.md Nebius AI Cloud resources within one [network](https://docs.nebius.com/vpc/overview.md#network) can connect directly to each other by using their private IP addresses. If you want to disable connectivity between resources or allocate the same private IP address to multiple different resources, for example, for testing purposes, create separate networks for them. ## Prerequisites > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Creating a network and a subnet Each network must contain at least one [subnet](https://docs.nebius.com/vpc/overview.md#subnet). To create a network and a subnet within it: > [tab] CLI > > Run the following command: > > ```bash > export NETWORK_ID=$(nebius vpc network create \ > --name \ > --format jsonpath='{.metadata.id}') > export SUBNET_ID=$(nebius vpc subnet create \ > --name \ > --network-id $NETWORK_ID \ > --format jsonpath='{.metadata.id}') > ``` > > This command saves the IDs of the created network and subnet to environment variables that you can use to create resources. > [tab] Go SDK > > ```go > isolatedNetworkService := sdk.Services().VPC().V1(). > Network() > isolatedNetworkOperation, err := isolatedNetworkService.Create( > ctx, > &vpc.CreateNetworkRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.NetworkSpec{}, > }, > ) > if err != nil { > return err > } > if _, err = isolatedNetworkOperation.Wait(ctx); err != nil { > return err > } > isolatedSubnetService := sdk.Services().VPC().V1(). > Subnet() > isolatedSubnetOperation, err := isolatedSubnetService.Create( > ctx, > &vpc.CreateSubnetRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.SubnetSpec{ > NetworkId: isolatedNetworkOperation.ResourceID(), > }, > }, > ) > if err != nil { > return err > } > if _, err = isolatedSubnetOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters for both resources: > > * `Metadata.Name`: Name of the network or subnet. > * `Metadata.ParentId`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk) to create the resources in. > > The code creates the network first and passes its ID from `isolatedNetworkOperation.ResourceID()` to the subnet's `Spec.NetworkId`. To get the subnet ID for creating resources, use `isolatedSubnetOperation.ResourceID()`. > [tab] Python SDK > > ```python > isolated_network_service = NetworkServiceClient(sdk) > isolated_network_operation = await isolated_network_service.create( > CreateNetworkRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=NetworkSpec(), > ), > ) > await isolated_network_operation.wait() > isolated_subnet_service = SubnetServiceClient(sdk) > isolated_subnet_operation = await isolated_subnet_service.create( > CreateSubnetRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=SubnetSpec( > network_id=isolated_network_operation.resource_id, > ), > ), > ) > await isolated_subnet_operation.wait() > ``` > > In the code, set the following parameters for both resources: > > * `name`: Name of the network or subnet. > * `parent_id`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk) to create the resources in. > > The code creates the network first and passes its ID from `isolated_network_operation.resource_id` to the subnet's `network_id`. To get the subnet ID for creating resources, use `isolated_subnet_operation.resource_id`. > [tab] JavaScript SDK > > ```ts > const isolatedNetworkService = new NetworkService(sdk); > const isolatedNetworkOperation = await isolatedNetworkService.create( > CreateNetworkRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: {}, > }), > ).result; > await isolatedNetworkOperation.wait(); > const isolatedSubnetService = new SubnetService(sdk); > const isolatedSubnetOperation = await isolatedSubnetService.create( > CreateSubnetRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > networkId: isolatedNetworkOperation.resourceId(), > }, > }), > ).result; > await isolatedSubnetOperation.wait(); > ``` > > In the code, set the following parameters for both resources: > > * `name`: Name of the network or subnet. > * `parentId`: [ID of the project](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk) to create the resources in. > > The code creates the network first and passes its ID from `isolatedNetworkOperation.resourceId()` to the subnet's `networkId`. To get the subnet ID for creating resources, use `isolatedSubnetOperation.resourceId()`. ## Adding resources to a network or subnet > [!WARNING] > > Set the required network or subnet when you create Nebius AI Cloud resources. You cannot move a resource to another network or subnet after creation. When you create resources by using the Nebius AI Cloud CLI, set the network or subnet by using parameters with `network-id` or `subnet-id` in them. For example: * When you [create a Compute virtual machine](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli), add the `--network-interfaces "[{\"subnet_id\": \"$SUBNET_ID\"}]"` parameter. * When you [create a Managed Service for Kubernetes® cluster](https://docs.nebius.com/kubernetes/clusters/manage.md#how-to-create-clusters), add the `--control-plane-subnet-id $SUBNET_ID` parameter. * When you [create a Managed Service for PostgreSQL® cluster](https://docs.nebius.com/postgresql/clusters/manage.md#how-to-create-clusters), add the `--network-id $NETWORK_ID` parameter. *** *Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.* # Ranges of private IP addresses per region for a default private pool Source: https://docs.nebius.com/vpc/addressing/available-addresses.md Every project has a [default pool](https://docs.nebius.com/vpc/overview.md#default-virtual-networks-resources) of private IPv4 addresses, called `default-network-pool`. Its CIDR block depends on the [region](https://docs.nebius.com/overview/regions.md) of the project:
Region CIDR block
`eu-north1` (Finland) 10.0.0.0/13
`eu-west1` (France) 10.48.0.0/13
`me-west1` (Israel) 10.144.0.0/13
`us-central1` (Kansas City, Missouri, US) 10.96.0.0/13
`uk-south1` (United Kingdom) 10.64.0.0/13
`uk-south2` (United Kingdom) 10.80.0.0/13
`eu-north2` (Iceland) 10.24.0.0/13
`eu-south1` (Madrid, Spain) 10.88.0.0/13
`eu-west2` (France) 10.72.0.0/13
`us-north1` (Woodbury, Minnesota, US) 10.104.0.0/13
These CIDR blocks are allocated for the default network, and the default subnet reuses them. If you need other CIDR blocks, you can either edit the CIDR block of the default private pool or create new pools with the required CIDR blocks. > [!NOTE] > > When you choose a custom CIDR block, avoid `172.17.0.0/16`. It conflicts with the Docker default bridge network and can make virtual machines unreachable. For more information, see [Virtual machine is unreachable due to a Docker subnet conflict](https://docs.nebius.com/compute/virtual-machines/docker-subnet-conflict.md). # Getting public IPv4 ranges Source: https://docs.nebius.com/vpc/addressing/public-address-ranges.md Public [allocations](https://docs.nebius.com/vpc/overview.md#allocation) use public IPv4 addresses from public pools in [Virtual Networks](https://docs.nebius.com/vpc/overview.md#default-virtual-networks-resources). The available public IPv4 range depends on the project [region](https://docs.nebius.com/overview/regions.md). This page explains how to get the public IPv4 [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks) that are available for allocations in a project. ## Prerequisites > [!TIP] > > You do not need to complete any prerequisites if you use the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > ```bash > cat ~/.nebius/config.yaml > ``` > [tab] Go SDK > > [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > [tab] Python SDK > > [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > [tab] JavaScript SDK > > [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). ## How to get public IPv4 ranges > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Networking** → **Virtual networks**. > 2. If you have access to multiple projects, expand the list of projects and select the required project. > 3. Click **Actions** → **View public CIDR blocks**. > > The **Public CIDR blocks** window shows the public IPv4 CIDR blocks that are available for allocations in the selected project and region. > [tab] CLI > > 1. [Get the ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli) of the default network in the required project. > > 2. Get the ID of the default network's public pool: > > ```bash > nebius vpc network get --id > ``` > > The pool ID is specified in the `spec.ipv4_public_pools.pools.id` parameter of the output. > > If the default network contains several public pools, a public address can be allocated from any of these pools. > > 3. Get the CIDR blocks of the public pool: > > ```bash > nebius vpc pool get --id > ``` > > The output looks like this: > > ```yaml > metadata: > id: vpcpool-*** > parent_id: project-*** > name: default-public-pool > resource_version: "2" > created_at: "2025-07-21T16:21:38.791627Z" > updated_at: "2025-07-21T16:46:45.356295Z" > spec: > source_pool_id: vpcpool-e00*** > version: IPV4 > visibility: PUBLIC > status: > state: READY > cidrs: > - 89.169.96.0/22 > - 89.169.102.0/23 > - 89.169.108.0/22 > scope_id: vpcscope-e00*** > assignment: > networks: > - vpcnetwork-e00*** > ``` > > The output contains the following parameters: > > * `metadata.id`: ID of the [public pool](https://docs.nebius.com/vpc/overview.md#pool). > * `metadata.parent_id`: Project ID. > * `metadata.name`: Name of the public pool. > * `spec.source_pool_id`: ID of the source pool for this public pool. > * `spec.version`: IP version of the pool. > * `spec.visibility`: Pool visibility. > * `status.state`: Current state of the public pool. > * `status.cidrs`: Public IPv4 CIDR blocks that are available for allocations in the project. These addresses form the public IPv4 range from which Virtual Networks allocates public addresses. > * `status.scope_id`: ID of the scope associated with the public pool. > * `status.assignment.networks`: IDs of the networks that use this public pool. > [tab] Go SDK > > 1. [Get the ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk) of the default network in the required project. > > 2. Get the ID of the default network's public pool: > > ```go > network, err := sdk.Services().VPC().V1(). > Network().Get( > ctx, > &vpc.GetNetworkRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(network) > ``` > > Set `Id` to the network ID. The pool ID is specified in `Spec.Ipv4PublicPools.Pools[].Id` of the response. > > If the default network contains several public pools, a public address can be allocated from any of these pools. > > 3. Get the CIDR blocks of the public pool: > > ```go > pool, err := sdk.Services().VPC().V1(). > Pool().Get( > ctx, > &vpc.GetPoolRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > fmt.Println(pool) > ``` > > Set `Id` to the pool ID. The `Status.Cidrs` field of the response contains the public IPv4 CIDR blocks that are available for allocations in the project. These addresses form the public IPv4 range from which Virtual Networks allocates public addresses. > [tab] Python SDK > > 1. [Get the ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk) of the default network in the required project. > > 2. Get the ID of the default network's public pool: > > ```python > network_service = NetworkServiceClient(sdk) > network = await network_service.get( > GetNetworkRequest(id=""), > ) > print(network) > ``` > > Set `id` to the network ID. The pool ID is specified in `spec.ipv4_public_pools.pools[].id` of the response. > > If the default network contains several public pools, a public address can be allocated from any of these pools. > > 3. Get the CIDR blocks of the public pool: > > ```python > pool_service = PoolServiceClient(sdk) > pool = await pool_service.get( > GetPoolRequest(id=""), > ) > print(pool) > ``` > > Set `id` to the pool ID. The `status.cidrs` field of the response contains the public IPv4 CIDR blocks that are available for allocations in the project. These addresses form the public IPv4 range from which Virtual Networks allocates public addresses. > [tab] JavaScript SDK > > 1. [Get the ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk) of the default network in the required project. > > 2. Get the ID of the default network's public pool: > > ```ts > const networkService = new NetworkService(sdk); > const network = await networkService.get( > GetNetworkRequest.create({ > id: "", > }), > ); > console.log(network); > ``` > > Set `id` to the network ID. The pool ID is specified in `spec.ipv4PublicPools.pools[].id` of the response. > > If the default network contains several public pools, a public address can be allocated from any of these pools. > > 3. Get the CIDR blocks of the public pool: > > ```ts > const poolService = new PoolService(sdk); > const pool = await poolService.get( > GetPoolRequest.create({ > id: "", > }), > ); > console.log(pool); > ``` > > Set `id` to the pool ID. The `status.cidrs` field of the response contains the public IPv4 CIDR blocks that are available for allocations in the project. These addresses form the public IPv4 range from which Virtual Networks allocates public addresses. # Allocating custom private addresses to resources Source: https://docs.nebius.com/vpc/addressing/custom-private-addresses.md By default, Nebius AI Cloud [networks](https://docs.nebius.com/vpc/overview.md#network) and [subnets](https://docs.nebius.com/vpc/overview.md#subnet) provide private IP addresses from specific [CIDR blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_blocks). These blocks depend on the network's or subnet's region. If you need private addresses outside these blocks, add the required CIDR block to one of the network's [pools](https://docs.nebius.com/vpc/overview.md#pool), or create a new pool and add it to the network. A pool must belong to the network before its addresses can be used in that network's subnets. Next, create a subnet with that CIDR block in the network. As a result, you can allocate random or specific addresses from this block in the required network or subnet. ## Prerequisites > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Install [jq](https://jqlang.github.io/jq/) to extract IDs and tokens from the JSON data returned by the Nebius AI Cloud CLI: > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > > 3. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## How to allocate addresses The CIDR block that you choose must fall within the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918#section-3) private address ranges: `10.0.0.0/8`, `172.16.0.0/12` or `192.168.0.0/16`. The block must not overlap with CIDR blocks already used by other pools or subnets in the network, or with external networks the VM reaches over a [Nebius VPN Gateway](https://docs.nebius.com/vpc/nebius-vpn-gateway.md). > [!NOTE] > > When you choose a custom CIDR block, do not use `172.17.0.0/16`. It conflicts with the Docker default bridge network and can make virtual machines unreachable. For more information, see [Virtual machine is unreachable due to a Docker subnet conflict](https://docs.nebius.com/compute/virtual-machines/docker-subnet-conflict.md). > [tab] CLI > > 1. Determine what CIDR block you need and save it to an environment variable: > > ```bash > export CUSTOM_SUBNET_CIDR= > ``` > > 2. Get the ID of the required network and save it to an environment variable: > > ```bash > export NETWORK_ID=$(nebius vpc network get-by-name \ > --name \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Get the ID of this network's private pool and save it to an environment variable: > > ```bash > export PRIVATE_POOL_ID=$(nebius vpc network get \ > --id $NETWORK_ID \ > --format jsonpath='{.spec.ipv4_private_pools.pools[0].id}') > ``` > > As this command contains `pools[0]`, it saves the ID of the private pool that goes first in the network specification. If you need a different pool, specify its index in `pools[]`. To check the order of pools, run `nebius vpc network list`. > > 4. Add the `CUSTOM_SUBNET_CIDR` block to the private pool with `PRIVATE_POOL_ID`: > > ```bash > echo $(nebius vpc pool get --id $PRIVATE_POOL_ID --format json | \ > jq '.spec.cidrs += [{"cidr":$ENV.CUSTOM_SUBNET_CIDR}] | > {metadata: .metadata, spec: .spec}') | \ > nebius vpc pool update - > ``` > > 5. Create a new subnet with this private pool and save the subnet ID to an environment variable: > > ```bash > export SUBNET_ID=$(nebius vpc subnet create \ > --name private_subnet \ > --network-id $NETWORK_ID \ > --ipv4-private-pools-pools "[{\"cidrs\":[{\"cidr\":\"$CUSTOM_SUBNET_CIDR\"}]}]" \ > --format jsonpath='{.metadata.id}') > ``` > > 6. (Optional) To assign the VM a specific IP address, create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) within this subnet and save its ID to an environment variable: > > ```bash > export ALLOCATION_ID=$(nebius vpc allocation create \ > --name private_allocation \ > --ipv4-private-subnet-id $SUBNET_ID \ > --ipv4-private-cidr \ > --format jsonpath='{.metadata.id}') > ``` > > The `--ipv4-private-cidr` parameter sets the IP address for the allocation. Make sure that this address is within the subnet's CIDR block. Without this parameter, the command creates an allocation with a random IP address from the subnet. > > 7. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-cli) in the new subnet: > > ```bash > nebius compute instance create \ > --name \ > --stopped= \ > --resources-platform \ > --resources-preset \ > --boot-disk-existing-disk-id \ > --boot-disk-attach-mode READ_WRITE \ > --network-interfaces '[{"name": "", "subnet_id": "", "ip_address": {}, "public_ip_address": {}}]' > ``` > > The VM is assigned a private IP address from the subnet's pool. To assign the specific address from the allocation instead, set `ip_address` to `{"allocation_id": "$ALLOCATION_ID"}` inside the `--network-interfaces` parameter. If you later delete the VM, you can reuse the allocation for another VM. > [tab] Go SDK > > 1. Determine what CIDR block you need. In the following steps, specify it as ``. > > 2. Get the ID of the required network: > > ```go > customNetworkService := sdk.Services().VPC().V1(). > Network() > customNetwork, err := customNetworkService.GetByName( > ctx, > &vpc.GetNetworkByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > networkID := customNetwork.Metadata.Id > ``` > > Set `ParentId` to the project ID and `Name` to the network name. The code saves the network ID from `Metadata.Id` to `networkID`. > > 3. Get the ID of this network's private pool: > > ```go > poolNetworkService := sdk.Services().VPC().V1(). > Network() > poolNetwork, err := poolNetworkService.Get( > ctx, > &vpc.GetNetworkRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > privatePoolID := poolNetwork.Spec.Ipv4PrivatePools.Pools[0].Id > ``` > > Set `Id` to the network ID. As the code reads `Spec.Ipv4PrivatePools.Pools[0].Id`, it saves the ID of the private pool that goes first in the network specification to `privatePoolID`. If you need a different pool, specify its index in `Pools[]`. > > 4. Add the CIDR block to the private pool: > > ```go > customPoolService := sdk.Services().VPC().V1(). > Pool() > customPool, err := customPoolService.Get( > ctx, > &vpc.GetPoolRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > customPool.Spec.Cidrs = append( > customPool.Spec.Cidrs, > &vpc.PoolCidr{Cidr: ""}, > ) > poolUpdateOperation, err := customPoolService.Update( > ctx, > &vpc.UpdatePoolRequest{ > Metadata: customPool.Metadata, > Spec: customPool.Spec, > }, > ) > if err != nil { > return err > } > if _, err = poolUpdateOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the private pool ID and `Cidr` to the CIDR block. The code appends the block to the pool's `Spec.Cidrs` and updates the pool. > > 5. Create a new subnet with this private pool: > > ```go > customSubnetService := sdk.Services().VPC().V1(). > Subnet() > customSubnetOperation, err := customSubnetService.Create( > ctx, > &vpc.CreateSubnetRequest{ > Metadata: &common.ResourceMetadata{ > Name: "private_subnet", > ParentId: "", > }, > Spec: &vpc.SubnetSpec{ > NetworkId: "", > Ipv4PrivatePools: &vpc.IPv4PrivateSubnetPools{ > Pools: []*vpc.SubnetPool{ > &vpc.SubnetPool{ > Cidrs: []*vpc.SubnetCidr{ > &vpc.SubnetCidr{ > Cidr: "", > }, > }, > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = customSubnetOperation.Wait(ctx); err != nil { > return err > } > subnetID := customSubnetOperation.ResourceID() > ``` > > Set `Metadata.ParentId` to the project ID, `Spec.NetworkId` to the network ID and `Cidr` under `Spec.Ipv4PrivatePools` to the CIDR block. The code saves the subnet ID to `subnetID`. > > 6. (Optional) To assign the VM a specific IP address, create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) within this subnet: > > ```go > customIpService := sdk.Services().VPC().V1(). > Allocation() > customIpOperation, err := customIpService.Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "private_allocation", > ParentId: "", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Private{ > Ipv4Private: &vpc.IPv4PrivateAllocationSpec{ > Pool: &vpc.IPv4PrivateAllocationSpec_SubnetId{ > SubnetId: "", > }, > Cidr: "", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = customIpOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Metadata.ParentId` to the project ID and `SubnetId` to the subnet ID. `Cidr` under `Spec.IpSpec` sets the IP address for the allocation. Make sure that this address is within the subnet's CIDR block. Without `Cidr`, the code creates an allocation with a random IP address from the subnet. To get the allocation ID, use `customIpOperation.ResourceID()`. > > 7. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-go-sdk) in the new subnet: > > ```go > privateInstanceService := sdk.Services().Compute().V1(). > Instance() > privateInstanceOperation, err := privateInstanceService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "", > Size: &compute.ResourcesSpec_Preset{ > Preset: "", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: "", > }, > }, > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > &compute.NetworkInterfaceSpec{ > Name: "", > SubnetId: "", > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > Stopped: , > }, > }, > ) > if err != nil { > return err > } > if _, err = privateInstanceOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(privateInstanceOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the VM. > * `Metadata.ParentId`: ID of the project. > * `Spec.Resources.Platform` and `Preset` under `Spec.Resources.Size`: VM [platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). > * `Id` under `Spec.BootDisk`: ID of the boot disk. > * `Name` under `Spec.NetworkInterfaces`: Name of the network interface. > * `SubnetId`: ID of the new subnet. > * `Spec.Stopped`: Whether to create the VM in the stopped state, `true` or `false`. > > The VM is assigned a private IP address from the subnet's pool. To assign the specific address from the allocation instead, set `IpAddress` to `&compute.IPAddress{AllocationId: ""}`. If you later delete the VM, you can reuse the allocation for another VM. > [tab] Python SDK > > 1. Determine what CIDR block you need. In the following steps, specify it as ``. > > 2. Get the ID of the required network: > > ```python > custom_network_service = NetworkServiceClient(sdk) > custom_network = await custom_network_service.get_by_name( > GetNetworkByNameRequest( > parent_id="", > name="", > ), > ) > network_id = custom_network.metadata.id > ``` > > Set `parent_id` to the project ID and `name` to the network name. The code saves the network ID from `metadata.id` to `network_id`. > > 3. Get the ID of this network's private pool: > > ```python > pool_network_service = NetworkServiceClient(sdk) > pool_network = await pool_network_service.get( > GetNetworkRequest( > id="", > ), > ) > private_pool_id = pool_network.spec.ipv4_private_pools.pools[0].id > ``` > > Set `id` to the network ID. As the code reads `spec.ipv4_private_pools.pools[0].id`, it saves the ID of the private pool that goes first in the network specification to `private_pool_id`. If you need a different pool, specify its index in `pools[]`. > > 4. Add the CIDR block to the private pool: > > ```python > custom_pool_service = PoolServiceClient(sdk) > custom_pool = await custom_pool_service.get( > GetPoolRequest( > id="", > ), > ) > custom_pool.spec.cidrs.append( > PoolCidr(cidr=""), > ) > pool_update_operation = await custom_pool_service.update( > UpdatePoolRequest( > metadata=custom_pool.metadata, > spec=custom_pool.spec, > ), > ) > await pool_update_operation.wait() > ``` > > Set `id` to the private pool ID and `cidr` to the CIDR block. The code appends the block to the pool's `spec.cidrs` and updates the pool. > > 5. Create a new subnet with this private pool: > > ```python > custom_subnet_service = SubnetServiceClient(sdk) > custom_subnet_operation = await custom_subnet_service.create( > CreateSubnetRequest( > metadata=ResourceMetadata( > name="private_subnet", > parent_id="", > ), > spec=SubnetSpec( > network_id="", > ipv4_private_pools=IPv4PrivateSubnetPools( > pools=[ > SubnetPool( > cidrs=[ > SubnetCidr( > cidr="", > ), > ], > ), > ], > ), > ), > ), > ) > await custom_subnet_operation.wait() > subnet_id = custom_subnet_operation.resource_id > ``` > > Set `parent_id` to the project ID, `network_id` to the network ID and `cidr` under `ipv4_private_pools` to the CIDR block. The code saves the subnet ID to `subnet_id`. > > 6. (Optional) To assign the VM a specific IP address, create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) within this subnet: > > ```python > custom_ip_service = AllocationServiceClient(sdk) > custom_ip_operation = await custom_ip_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata( > name="private_allocation", > parent_id="", > ), > spec=AllocationSpec( > ipv4_private=IPv4PrivateAllocationSpec( > subnet_id="", > cidr="", > ), > ), > ), > ) > await custom_ip_operation.wait() > ``` > > Set `parent_id` to the project ID and `subnet_id` to the subnet ID. `cidr` under `ipv4_private` sets the IP address for the allocation. Make sure that this address is within the subnet's CIDR block. Without `cidr`, the code creates an allocation with a random IP address from the subnet. To get the allocation ID, use `custom_ip_operation.resource_id`. > > 7. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-python-sdk) in the new subnet: > > ```python > private_instance_service = InstanceServiceClient(sdk) > private_instance_operation = await private_instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="", > preset="", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk( > id="", > ), > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="", > subnet_id="", > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ), > ], > stopped=, > ), > ), > ) > await private_instance_operation.wait() > print(private_instance_operation) > ``` > > In the code, set the following parameters: > > * `metadata.name`: Name of the VM. > * `metadata.parent_id`: ID of the project. > * `resources.platform` and `resources.preset`: VM [platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). > * `existing_disk.id`: ID of the boot disk. > * `name` under `network_interfaces`: Name of the network interface. > * `subnet_id`: ID of the new subnet. > * `stopped`: Whether to create the VM in the stopped state, `True` or `False`. > > The VM is assigned a private IP address from the subnet's pool. To assign the specific address from the allocation instead, set `ip_address` to `IPAddress(allocation_id="")`. If you later delete the VM, you can reuse the allocation for another VM. > [tab] JavaScript SDK > > 1. Determine what CIDR block you need. In the following steps, specify it as ``. > > 2. Get the ID of the required network: > > ```ts > const customNetworkService = new NetworkService(sdk); > const customNetwork = await customNetworkService.getByName( > GetNetworkByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > const networkId = customNetwork.metadata.id; > ``` > > Set `parentId` to the project ID and `name` to the network name. The code saves the network ID from `metadata.id` to `networkId`. > > 3. Get the ID of this network's private pool: > > ```ts > const poolNetworkService = new NetworkService(sdk); > const poolNetwork = await poolNetworkService.get( > GetNetworkRequest.create({ > id: "", > }), > ).result; > const privatePoolId = poolNetwork.spec.ipv4PrivatePools.pools[0].id; > ``` > > Set `id` to the network ID. As the code reads `spec.ipv4PrivatePools.pools[0].id`, it saves the ID of the private pool that goes first in the network specification to `privatePoolId`. If you need a different pool, specify its index in `pools[]`. > > 4. Add the CIDR block to the private pool: > > ```ts > const customPoolService = new PoolService(sdk); > const customPool = await customPoolService.get( > GetPoolRequest.create({ > id: "", > }), > ).result; > customPool.spec.cidrs.push( > PoolCidr.create({ cidr: "" }), > ); > const poolUpdateOperation = await customPoolService.update( > UpdatePoolRequest.create({ > metadata: customPool.metadata, > spec: customPool.spec, > }), > ).result; > await poolUpdateOperation.wait(); > ``` > > Set `id` to the private pool ID and `cidr` to the CIDR block. The code appends the block to the pool's `spec.cidrs` and updates the pool. > > 5. Create a new subnet with this private pool: > > ```ts > const customSubnetService = new SubnetService(sdk); > const customSubnetOperation = await customSubnetService.create( > CreateSubnetRequest.create({ > metadata: { > name: "private_subnet", > parentId: "", > }, > spec: { > networkId: "", > ipv4PrivatePools: { > pools: [ > { > cidrs: [ > { > cidr: "", > }, > ], > }, > ], > }, > }, > }), > ).result; > await customSubnetOperation.wait(); > const subnetId = customSubnetOperation.resourceId(); > ``` > > Set `parentId` to the project ID, `networkId` to the network ID and `cidr` under `ipv4PrivatePools` to the CIDR block. The code saves the subnet ID to `subnetId`. > > 6. (Optional) To assign the VM a specific IP address, create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) within this subnet: > > ```ts > const customIpService = new AllocationService(sdk); > const customIpOperation = await customIpService.create( > CreateAllocationRequest.create({ > metadata: { > name: "private_allocation", > parentId: "", > }, > spec: { > ipSpec: { > "$case": "ipv4Private", > "ipv4Private": { > pool: { > "$case": "subnetId", > "subnetId": "", > }, > cidr: "", > }, > }, > }, > }), > ).result; > await customIpOperation.wait(); > ``` > > Set `parentId` to the project ID and `subnetId` to the subnet ID. `cidr` under `ipv4Private` sets the IP address for the allocation. Make sure that this address is within the subnet's CIDR block. Without `cidr`, the code creates an allocation with a random IP address from the subnet. To get the allocation ID, use `customIpOperation.resourceId()`. > > 7. [Create a VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm-javascript-sdk) in the new subnet: > > ```ts > const privateInstanceService = new InstanceService(sdk); > const privateInstanceOperation = await privateInstanceService.create( > CreateInstanceRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > resources: { > platform: "", > size: { > "$case": "preset", > "preset": "", > }, > }, > bootDisk: { > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > "$case": "existingDisk", > "existingDisk": { > id: "", > }, > }, > }, > networkInterfaces: [ > { > name: "", > subnetId: "", > ipAddress: {}, > publicIpAddress: {}, > }, > ], > stopped: , > }, > }), > ).result; > await privateInstanceOperation.wait(); > console.log(privateInstanceOperation); > ``` > > In the code, set the following parameters: > > * `metadata.name`: Name of the VM. > * `metadata.parentId`: ID of the project. > * `resources.platform` and `preset` under `resources.size`: VM [platform and preset](https://docs.nebius.com/compute/virtual-machines/types.md). > * `existingDisk.id`: ID of the boot disk. > * `name` under `networkInterfaces`: Name of the network interface. > * `subnetId`: ID of the new subnet. > * `stopped`: Whether to create the VM in the stopped state, `true` or `false`. > > The VM is assigned a private IP address from the subnet's pool. To assign the specific address from the allocation instead, set `ipAddress` to `{ allocationId: "" }`. If you later delete the VM, you can reuse the allocation for another VM. # Disabling public addresses for a subnet Source: https://docs.nebius.com/vpc/addressing/disable-public-addresses.md In some scenarios, you may need to ensure that some of your Nebius AI Cloud resources cannot be reached from the internet. For example, you may want to set up a secure zone and connect to it from a demilitarized zone (DMZ) via a [jump server](https://docs.nebius.com/compute/virtual-machines/wireguard.md). To do so, you can [create a subnet](https://docs.nebius.com/vpc/addressing/disable-public-addresses.md#creating-a-subnet-without-public-ip-addresses) that cannot allocate public IP addresses. Resources in such a subnet can only have private IP addresses. ## Prerequisites > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Creating a subnet without public IP addresses > [tab] CLI > > 1. Choose a network that has at least one private [pool](https://docs.nebius.com/vpc/overview.md#pool). You can get information about available networks by using the following command: > > ```bash > nebius vpc network list > ``` > > In the output, check the `metadata.spec.ipv4_private_pools` parameter to determine whether a network has private pools. Save the ID of the required network for the next command. > > 2. Create a subnet that doesn't use the network's public pools, and save the subnet's ID to an environment variable: > > ```bash > export PRIVATE_SUBNET_ID=$(nebius vpc subnet create \ > --name \ > --network-id \ > --ipv4-public-pools-use-network-pools=False \ > --format jsonpath='{.metadata.id}') > ``` > > In this command, specify the subnet name and the copied network ID. > > 3. To check that public addresses are disabled in this subnet, try to create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) of a public IP address in this subnet: > > ```bash > nebius vpc allocation create \ > --name \ > --ipv4-public-subnet-id $PRIVATE_SUBNET_ID > ``` > > This command returns an error, indicating that the subnet doesn't support public allocations. This is expected and confirms that the subnet is configured correctly. > [tab] Go SDK > > 1. Choose a network that has at least one private [pool](https://docs.nebius.com/vpc/overview.md#pool). List the available networks in the project, with `ParentId` set to the project ID: > > ```go > availableNetworksService := sdk.Services().VPC().V1(). > Network() > availableNetworksResponse, err := availableNetworksService.List( > ctx, > &vpc.ListNetworksRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(availableNetworksResponse) > ``` > > In the response, check `Spec.Ipv4PrivatePools` of each network to determine whether it has private pools. Save the ID of the required network from `Metadata.Id`. > > 2. Create a subnet that doesn't use the network's public pools: > > ```go > privateSubnetService := sdk.Services().VPC().V1(). > Subnet() > privateSubnetOperation, err := privateSubnetService.Create( > ctx, > &vpc.CreateSubnetRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.SubnetSpec{ > NetworkId: "", > Ipv4PublicPools: &vpc.IPv4PublicSubnetPools{ > UseNetworkPools: false, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = privateSubnetOperation.Wait(ctx); err != nil { > return err > } > privateSubnetID := privateSubnetOperation.ResourceID() > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the subnet. > * `Metadata.ParentId`: ID of the project. > * `Spec.NetworkId`: Network ID that you saved in the previous step. > > `Spec.Ipv4PublicPools.UseNetworkPools` is set to `false`, so the subnet doesn't use the network's public pools. The code saves the subnet ID to `privateSubnetID`. > > 3. To check that public addresses are disabled in this subnet, try to create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) of a public IP address in this subnet: > > ```go > publicAllocationService := sdk.Services().VPC().V1(). > Allocation() > publicOperation, err := publicAllocationService.Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Public{ > Ipv4Public: &vpc.IPv4PublicAllocationSpec{ > Pool: &vpc.IPv4PublicAllocationSpec_SubnetId{ > SubnetId: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > _, err = publicOperation.Wait(ctx) > return err > ``` > > Set `SubnetId` to the ID of the new subnet. The code returns an error, indicating that the subnet doesn't support public allocations. This is expected and confirms that the subnet is configured correctly. > [tab] Python SDK > > 1. Choose a network that has at least one private [pool](https://docs.nebius.com/vpc/overview.md#pool). List the available networks in the project, with `parent_id` set to the project ID: > > ```python > available_networks_service = NetworkServiceClient(sdk) > available_networks_response = await available_networks_service.list( > ListNetworksRequest( > parent_id="", > ), > ) > print(available_networks_response) > ``` > > In the response, check `spec.ipv4_private_pools` of each network to determine whether it has private pools. Save the ID of the required network from `metadata.id`. > > 2. Create a subnet that doesn't use the network's public pools: > > ```python > private_subnet_service = SubnetServiceClient(sdk) > private_subnet_operation = await private_subnet_service.create( > CreateSubnetRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=SubnetSpec( > network_id="", > ipv4_public_pools=IPv4PublicSubnetPools( > use_network_pools=False, > ), > ), > ), > ) > await private_subnet_operation.wait() > private_subnet_id = private_subnet_operation.resource_id > ``` > > In the code, set the following parameters: > > * `name`: Name of the subnet. > * `parent_id`: ID of the project. > * `network_id`: Network ID that you saved in the previous step. > > `ipv4_public_pools.use_network_pools` is set to `False`, so the subnet doesn't use the network's public pools. The code saves the subnet ID to `private_subnet_id`. > > 3. To check that public addresses are disabled in this subnet, try to create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) of a public IP address in this subnet: > > ```python > public_allocation_service = AllocationServiceClient(sdk) > try: > public_operation = await public_allocation_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=AllocationSpec( > ipv4_public=IPv4PublicAllocationSpec( > subnet_id="", > ), > ), > ), > ) > await public_operation.wait() > except RequestError as error: > print(error) > > ``` > > Set `subnet_id` to the ID of the new subnet. The code prints an error, indicating that the subnet doesn't support public allocations. This is expected and confirms that the subnet is configured correctly. > [tab] JavaScript SDK > > 1. Choose a network that has at least one private [pool](https://docs.nebius.com/vpc/overview.md#pool). List the available networks in the project, with `parentId` set to the project ID: > > ```ts > const availableNetworksService = new NetworkService(sdk); > const availableNetworksResponse = await availableNetworksService.list( > ListNetworksRequest.create({ > parentId: "", > }), > ).result; > console.log(availableNetworksResponse); > ``` > > In the response, check `spec.ipv4PrivatePools` of each network to determine whether it has private pools. Save the ID of the required network from `metadata.id`. > > 2. Create a subnet that doesn't use the network's public pools: > > ```ts > const privateSubnetService = new SubnetService(sdk); > const privateSubnetOperation = await privateSubnetService.create( > CreateSubnetRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > networkId: "", > ipv4PublicPools: { > useNetworkPools: false, > }, > }, > }), > ).result; > await privateSubnetOperation.wait(); > const privateSubnetId = privateSubnetOperation.resourceId(); > ``` > > In the code, set the following parameters: > > * `name`: Name of the subnet. > * `parentId`: ID of the project. > * `networkId`: Network ID that you saved in the previous step. > > `ipv4PublicPools.useNetworkPools` is set to `false`, so the subnet doesn't use the network's public pools. The code saves the subnet ID to `privateSubnetId`. > > 3. To check that public addresses are disabled in this subnet, try to create an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) of a public IP address in this subnet: > > ```ts > const publicAllocationService = new AllocationService(sdk); > try { > const publicOperation = await publicAllocationService.create( > CreateAllocationRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > ipSpec: { > "$case": "ipv4Public", > "ipv4Public": { > pool: { > "$case": "subnetId", > "subnetId": "", > }, > }, > }, > }, > }), > ).result; > await publicOperation.wait(); > } catch (error) { > console.error(error); > } > ``` > > Set `subnetId` to the ID of the new subnet. The code logs an error, indicating that the subnet doesn't support public allocations. This is expected and confirms that the subnet is configured correctly. Use this subnet to create resources that should not be reachable from the internet. These resources have only private IP addresses that can be accessed from within the same network. You can create a virtual machine with a public IP address within the same network, but outside the private subnet, and use this virtual machine as a jump server for external connections. > [!NOTE] > > Disabling public addresses only blocks inbound traffic from the internet. Resources in the subnet can still send outbound (egress) traffic to the internet through the [default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway). # Routing in Nebius AI Cloud Source: https://docs.nebius.com/vpc/routing/overview.md Routing in Nebius AI Cloud determines how traffic moves within and between [networks](https://docs.nebius.com/vpc/overview.md#network) and [subnets](https://docs.nebius.com/vpc/overview.md#subnet), as well as to and from the internet. Nebius AI Cloud provides resources called *routing tables (route tables)* and *routes* that you can use to customize the routing of egress traffic and implement advanced networking scenarios, such as [custom NAT gateways](https://docs.nebius.com/vpc/routing/custom-nat-gateway.md) or segmented architectures. ## Default routing rules By default, the pre-created networks, subnets and routing tables in every [project](https://docs.nebius.com/iam/overview.md#projects) implement the following rules for traffic that are sent from the project's resources: * Traffic from one resource in a network to another is always routed within that network, ignoring routes from default and custom routing tables. You cannot modify this behavior, bypass it by using custom routes or disable it. * All other traffic from the network is routed according to the network's [default routing table](https://docs.nebius.com/vpc/routing/overview.md#default-routing-tables): * Traffic to private IP addresses outside the network is discarded. * Traffic to public IP addresses is routed to the internet through the [default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway). You can modify the default routing table to configure routing across the network, or create [custom routing tables](https://docs.nebius.com/vpc/routing/overview.md#custom-routing-tables) and assign them to specific subnets. ### Default egress gateway You can route traffic from Nebius AI Cloud resources to public IP addresses through the *default egress gateway*. You can specify the default egress gateway as the next hop only in routes with the destination CIDR block `0.0.0.0/0`. When traffic is routed through the default egress gateway, the gateway sets the traffic's source IP address to the public IP address of the original resource. If this resource does not have a public address, the default egress gateway sets the traffic's source IP address to a dynamic public IP address from a common pool shared between all projects in a region. ## Routing tables and routes A *routing table*, or a *route table*, is assigned to a subnet and defines how to route traffic from the subnet's resources. Each routing table contains a set of *routes*. A route contains the list of destination CIDR blocks and the next hop for them. If a routing table applies to a resource, and this resource sends traffic to an IP address that belongs to a CIDR block in one of the table's routes, this traffic is routed to the next hop defined in the route. Virtual Networks supports two types of routing tables: default and custom. ### Default routing tables Each network is created with a *default routing table* named `default-route-table-***`. It has one route with the destination CIDR block `0.0.0.0/0` (all IP addresses) and the default egress gateway as the next hop: ```yaml metadata: id: vpcroute-*** parent_id: vpcroutetable-*** # Default routing table spec: destination: cidr: 0.0.0.0/0 next_hop: default_egress_gateway: true ``` > [accordion] Description of the parameters > > * `.metadata.id`: ID of the route. > * `.metadata.parent_id`: ID of the routing table. The parent resource of a route is a routing table; the parent resource of a routing table is a [project](https://docs.nebius.com/iam/overview.md#projects). > * `.spec.destination.cidr`: CIDR block of egress traffic destinations to which the route applies. > * `.spec.next_hop`: Next hop to which matching egress traffic is routed: > > * `.spec.next_hop.default_egress_gateway`: All egress traffic to the internet is routed through the [default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway). The traffic that is routed to private addresses outside the resource's network is discarded. > > The parameter only supports the `true` value. By default, each subnet created within a network gets assigned the network's default routing table, meaning that all traffic from resources within the subnet to public IP addresses is routed to the internet. You can modify the default routing table of a network by [adding](https://docs.nebius.com/vpc/routing/manage.md#adding-routes-to-routing-tables) or [deleting routes](https://docs.nebius.com/vpc/routing/manage.md#deleting-routes). This affects all network's subnets that do not have custom routing tables assigned. If you add a route with a CIDR block other than `0.0.0.0/0`, use the [custom route example](https://docs.nebius.com/vpc/routing/overview.md#custom-routing-tables) below. In particular, replace the `default_egress_gateway` parameter with the `allocation_id` parameter. ### Custom routing tables You can [create your own routing tables](https://docs.nebius.com/vpc/routing/manage.md#creating-routing-tables) and [assign them to subnets](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets). A routing table is associated with a network, and you can assign it only to subnets of that network. A subnet is either assigned a custom routing table, or a subnet inherits its network's default routing table. Example of a custom route: ```yaml metadata: id: vpcroute-*** parent_id: vpcroutetable-*** spec: destination: cidr: next_hop: # Contains either allocation_id or default_egress_gateway allocation_id: vpcallocation-*** default_egress_gateway: true ``` > [accordion] Description of the parameters > > * `.metadata.id`: ID of the route. > > * `.metadata.parent_id`: ID of the routing table. The parent resource of a route is a routing table; the parent resource of a routing table is a [project](https://docs.nebius.com/iam/overview.md#projects). > > * `.spec.destination.cidr`: CIDR block of egress traffic destinations to which the route applies. If a resource sends traffic to an IP address that belongs to CIDR blocks of multiple routes in a routing table, the route with the longest subnet mask applies, according to the [longest prefix match](https://en.wikipedia.org/wiki/Longest_prefix_match). > > > For example, consider a routing table with the following routes and their CIDR blocks: > > > > * Route A: `10.0.0.0/8` → next hop A > > * Route B: `10.14.0.0/16` → next hop B > > > > When a resource sends traffic to `10.14.15.114`, it is routed to the next hop B because `10.14.0.0/16` has a longer, 16-bit subnet mask (and thus, a longer prefix match with `10.14.15.114`). > > * `.spec.next_hop`: Next hop to which matching egress traffic is routed. The next hop can be one of the following: > > * `.spec.next_hop.allocation_id`: ID of the [allocation](https://docs.nebius.com/vpc/overview.md#allocation). You can use this parameter with any destination CIDR block. > > > [!WARNING] > > > > If the next hop of a route is an allocation that is not assigned to a resource, the egress traffic that matches the route is discarded. > > * `.spec.next_hop.default_egress_gateway`: All egress traffic to the internet is routed through the [default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway). The traffic that is routed to private addresses outside the resource's network is discarded. > > You can only use this parameter with the destination CIDR block `0.0.0.0/0`. > > The parameter only supports the `true` value. ### Empty routing tables If you delete all routes in a routing table, resources in subnets that have this routing table assigned can only communicate with other resources within their network. All traffic to private IP addresses outside the network and to public IP addresses is discarded. # Managing routing tables and routes Source: https://docs.nebius.com/vpc/routing/manage.md By default, Nebius AI Cloud routes egress traffic from your resources according to the [default routing rules](https://docs.nebius.com/vpc/routing/overview.md#default-routing-rules). You can configure routing by creating and managing routing tables (route tables) and routes. For more details on how routing works, see [Routing in Nebius AI Cloud](https://docs.nebius.com/vpc/routing/overview.md). ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Creating routing tables > [tab] Web console > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > > 2. Select the network for which you want to create a routing table. > > You can only assign a routing table to subnets within this network. > > 3. Click **Create** and select **Routing table**. > > 4. In the window that opens: > > 1. Enter a name for the routing table. > 2. (Optional) Select the subnets within this network that you want to assign to the routing table. You can also [assign a routing table to subnets](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-web-console) later. > > 5. Click **Create**. > The new routing table should appear on the **Routing tables** tab. > [tab] CLI > > To create a routing table, run the following command: > > ```bash > nebius vpc route-table create \ > --name \ > --network-id > ``` > > In the command, specify the following parameters: > > * `--name`: Name of the routing table. > * `--network-id`: [ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli) for which you are creating the routing table. You can only assign a routing table to subnets within this network. > > Routing tables are created empty. After creating a routing table, [add routes to it](https://docs.nebius.com/vpc/routing/manage.md#adding-routes-to-routing-tables-cli) and then [assign it to subnets](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-cli). > [tab] Go SDK > > Create a routing table: > > ```go > routingTableService := sdk.Services().VPC().V1(). > RouteTable() > routingTableOperation, err := routingTableService.Create( > ctx, > &vpc.CreateRouteTableRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.RouteTableSpec{ > NetworkId: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = routingTableOperation.Wait(ctx); err != nil { > return err > } > routeTableID := routingTableOperation.ResourceID() > fmt.Println(routingTableOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the routing table. > * `Metadata.ParentId`: ID of the project. > * `Spec.NetworkId`: [ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk) for which you are creating the routing table. You can only assign a routing table to subnets within this network. > > The code saves the routing table ID to `routeTableID`. Routing tables are created empty. After creating a routing table, [add routes to it](https://docs.nebius.com/vpc/routing/manage.md#adding-routes-to-routing-tables-go-sdk) and then [assign it to subnets](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-go-sdk). > [tab] Python SDK > > Create a routing table: > > ```python > routing_table_service = RouteTableServiceClient(sdk) > routing_table_operation = await routing_table_service.create( > CreateRouteTableRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=RouteTableSpec( > network_id="", > ), > ), > ) > await routing_table_operation.wait() > route_table_id = routing_table_operation.resource_id > print(routing_table_operation) > ``` > > In the code, set the following parameters: > > * `name`: Name of the routing table. > * `parent_id`: ID of the project. > * `network_id`: [ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk) for which you are creating the routing table. You can only assign a routing table to subnets within this network. > > The code saves the routing table ID to `route_table_id`. Routing tables are created empty. After creating a routing table, [add routes to it](https://docs.nebius.com/vpc/routing/manage.md#adding-routes-to-routing-tables-python-sdk) and then [assign it to subnets](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-python-sdk). > [tab] JavaScript SDK > > Create a routing table: > > ```ts > const routingTableService = new RouteTableService(sdk); > const routingTableOperation = await routingTableService.create( > CreateRouteTableRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > networkId: "", > }, > }), > ).result; > await routingTableOperation.wait(); > const routeTableId = routingTableOperation.resourceId(); > console.log(routingTableOperation); > ``` > > In the code, set the following parameters: > > * `name`: Name of the routing table. > * `parentId`: ID of the project. > * `networkId`: [ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk) for which you are creating the routing table. You can only assign a routing table to subnets within this network. > > The code saves the routing table ID to `routeTableId`. Routing tables are created empty. After creating a routing table, [add routes to it](https://docs.nebius.com/vpc/routing/manage.md#adding-routes-to-routing-tables-javascript-sdk) and then [assign it to subnets](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-javascript-sdk). ## Adding routes to routing tables Routes support different next hop options. You can set the next hop to an [allocation](https://docs.nebius.com/vpc/overview.md#allocation) or to the [internet through the default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway). For more information, see [Routing in Nebius AI Cloud](https://docs.nebius.com/vpc/routing/overview.md). > [tab] Web console > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > > 2. Select the network that contains the routing table and switch to the **Routing tables** tab. > > 3. Select the routing table to which you want to add a route. > > 4. Click **Add route**. > > 5. In the window that opens: > > 1. Enter a name for the route. > > 2. In **Destination CIDR**, do one of the following: > > * To route traffic to an [allocation](https://docs.nebius.com/vpc/overview.md#allocation), specify the CIDR block of destination IP addresses to which the route applies. > * To route traffic to the internet through the [default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway), specify `0.0.0.0/0`. > > 3. Under **Next hop**, do one of the following: > > * To route traffic to an allocation, select **Allocation**. > * To route traffic to the internet, select **Default egress gateway**. > > 4. Only if you selected **Allocation** under **Next hop**, select the allocation to route traffic through. > > 6. Click **Add route**. > [tab] CLI > > * **Routing traffic to an allocation** > > To route traffic to an allocation, run the following command: > > ```bash > nebius vpc route create \ > --name \ > --parent-id \ > --destination-cidr \ > --next-hop-allocation-id > ``` > > In the command, specify the following parameters: > > * `--name`: Name of the route. > > * `--parent-id`: ID of the routing table to add the route to. To get it, run: > > ```bash > nebius vpc route-table list > ``` > > The output contains the routing table ID in the `.metadata.id` parameter. > > * `--destination-cidr`: Specify the CIDR block of destination IP addresses to which the route applies. > > * `--next-hop-allocation-id`: ID of the allocation to route traffic through. To get it, run: > > ```bash > nebius vpc allocation list > ``` > > The output contains the allocation ID in the `.metadata.id` parameter. > * **Routing traffic to the internet** > > To route traffic to the internet through the default egress gateway, run the following command: > > ```bash > nebius vpc route create \ > --name "default-egress" \ > --parent-id \ > --destination-cidr "0.0.0.0/0" \ > --next-hop-default-egress-gateway=true > ``` > > In the command, specify the following parameters: > > * `--name`: Name of the route. > > * `--parent-id`: ID of the routing table to add the route to. To get it, run: > > ```bash > nebius vpc route-table list > ``` > > The output contains the routing table ID in the `.metadata.id` parameter. > > * `--destination-cidr`: Set to `0.0.0.0/0` to route traffic to the internet through the default egress gateway. > > * `--next-hop-default-egress-gateway`: Set to `true` to route traffic through the default egress gateway. > [tab] Go SDK > > * **Routing traffic to an allocation** > > To route traffic to an allocation, create a route: > > ```go > allocationRouteService := sdk.Services().VPC().V1(). > Route() > allocationRouteOperation, err := allocationRouteService.Create( > ctx, > &vpc.CreateRouteRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.RouteSpec{ > Destination: &vpc.DestinationMatch{ > Cidr: "", > }, > NextHop: &vpc.NextHop{ > NextHop: &vpc.NextHop_Allocation{ > Allocation: &vpc.AllocationNextHop{ > Id: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = allocationRouteOperation.Wait(ctx); err != nil { > return err > } > routeID := allocationRouteOperation.ResourceID() > fmt.Println(allocationRouteOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the route. > * `Metadata.ParentId`: ID of the routing table to add the route to. > * `Spec.Destination.Cidr`: CIDR block of destination IP addresses to which the route applies. > * `Id` under `Spec.NextHop.Allocation`: ID of the allocation to route traffic through. > > The code saves the route ID to `routeID`. > > * **Routing traffic to the internet** > > To route traffic to the internet through the default egress gateway, create a route: > > ```go > egressRouteService := sdk.Services().VPC().V1(). > Route() > egressRouteOperation, err := egressRouteService.Create( > ctx, > &vpc.CreateRouteRequest{ > Metadata: &common.ResourceMetadata{ > Name: "default-egress", > ParentId: "", > }, > Spec: &vpc.RouteSpec{ > Destination: &vpc.DestinationMatch{ > Cidr: "0.0.0.0/0", > }, > NextHop: &vpc.NextHop{ > NextHop: &vpc.NextHop_DefaultEgressGateway{ > DefaultEgressGateway: true, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = egressRouteOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(egressRouteOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the route. > * `Metadata.ParentId`: ID of the routing table to add the route to. > * `Spec.Destination.Cidr`: Set to `0.0.0.0/0` to route traffic to the internet through the default egress gateway. > * `DefaultEgressGateway` under `Spec.NextHop`: Set to `true` to route traffic through the default egress gateway. > [tab] Python SDK > > * **Routing traffic to an allocation** > > To route traffic to an allocation, create a route: > > ```python > allocation_route_service = RouteServiceClient(sdk) > allocation_route_operation = await allocation_route_service.create( > CreateRouteRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=RouteSpec( > destination=DestinationMatch( > cidr="", > ), > next_hop=NextHop( > allocation=AllocationNextHop( > id="", > ), > ), > ), > ), > ) > await allocation_route_operation.wait() > route_id = allocation_route_operation.resource_id > print(allocation_route_operation) > ``` > > In the code, set the following parameters: > > * `name`: Name of the route. > * `parent_id`: ID of the routing table to add the route to. > * `destination.cidr`: CIDR block of destination IP addresses to which the route applies. > * `next_hop.allocation.id`: ID of the allocation to route traffic through. > > The code saves the route ID to `route_id`. > > * **Routing traffic to the internet** > > To route traffic to the internet through the default egress gateway, create a route: > > ```python > egress_route_service = RouteServiceClient(sdk) > egress_route_operation = await egress_route_service.create( > CreateRouteRequest( > metadata=ResourceMetadata( > name="default-egress", > parent_id="", > ), > spec=RouteSpec( > destination=DestinationMatch( > cidr="0.0.0.0/0", > ), > next_hop=NextHop( > default_egress_gateway=True, > ), > ), > ), > ) > await egress_route_operation.wait() > print(egress_route_operation) > ``` > > In the code, set the following parameters: > > * `name`: Name of the route. > * `parent_id`: ID of the routing table to add the route to. > * `destination.cidr`: Set to `0.0.0.0/0` to route traffic to the internet through the default egress gateway. > * `next_hop.default_egress_gateway`: Set to `True` to route traffic through the default egress gateway. > [tab] JavaScript SDK > > * **Routing traffic to an allocation** > > To route traffic to an allocation, create a route: > > ```ts > const allocationRouteService = new RouteService(sdk); > const allocationRouteOperation = await allocationRouteService.create( > CreateRouteRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > destination: { > cidr: "", > }, > nextHop: { > nextHop: { > "$case": "allocation", > "allocation": { > id: "", > }, > }, > }, > }, > }), > ).result; > await allocationRouteOperation.wait(); > const routeId = allocationRouteOperation.resourceId(); > console.log(allocationRouteOperation); > ``` > > In the code, set the following parameters: > > * `name`: Name of the route. > * `parentId`: ID of the routing table to add the route to. > * `destination.cidr`: CIDR block of destination IP addresses to which the route applies. > * `id` under `nextHop.allocation`: ID of the allocation to route traffic through. > > The code saves the route ID to `routeId`. > > * **Routing traffic to the internet** > > To route traffic to the internet through the default egress gateway, create a route: > > ```ts > const egressRouteService = new RouteService(sdk); > const egressRouteOperation = await egressRouteService.create( > CreateRouteRequest.create({ > metadata: { > name: "default-egress", > parentId: "", > }, > spec: { > destination: { > cidr: "0.0.0.0/0", > }, > nextHop: { > nextHop: { > "$case": "defaultEgressGateway", > "defaultEgressGateway": true, > }, > }, > }, > }), > ).result; > await egressRouteOperation.wait(); > console.log(egressRouteOperation); > ``` > > In the code, set the following parameters: > > * `name`: Name of the route. > * `parentId`: ID of the routing table to add the route to. > * `destination.cidr`: Set to `0.0.0.0/0` to route traffic to the internet through the default egress gateway. > * `defaultEgressGateway` under `nextHop`: Set to `true` to route traffic through the default egress gateway. ## Deleting routes > [tab] Web console > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. Select the network that contains the routing table and switch to the **Routing tables** tab. > 3. Select the routing table from which you want to delete a route. > 4. Do one of the following: > > * To delete one route, click next to the route and select **Delete**. > * To delete multiple routes at once, select the checkboxes next to the required routes and click **Delete** in the banner that appears. > [tab] CLI > > To delete a route from a routing table, run the following command: > > ```bash > nebius vpc route delete > ``` > > In the command, specify the route ID to delete. To get it, do the following: > > 1. Get the ID of the routing table: > > ```bash > nebius vpc route-table list > ``` > > The output contains the routing table ID in the `.metadata.id` parameter. > > 2. Use this ID to list all the routes in that routing table: > > ```bash > nebius vpc route list --parent-id > ``` > > The output contains the route ID in the `.metadata.id` parameter. > [tab] Go SDK > > Delete a route from a routing table: > > ```go > deletedRouteService := sdk.Services().VPC().V1(). > Route() > deletedRouteOperation, err := deletedRouteService.Delete( > ctx, > &vpc.DeleteRouteRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deletedRouteOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the ID of the route that you want to delete. > [tab] Python SDK > > Delete a route from a routing table: > > ```python > deleted_route_service = RouteServiceClient(sdk) > deleted_route_operation = await deleted_route_service.delete( > DeleteRouteRequest( > id="", > ), > ) > await deleted_route_operation.wait() > ``` > > Set `id` to the ID of the route that you want to delete. > [tab] JavaScript SDK > > Delete a route from a routing table: > > ```ts > const deletedRouteService = new RouteService(sdk); > const deletedRouteOperation = await deletedRouteService.delete( > DeleteRouteRequest.create({ > id: "", > }), > ).result; > await deletedRouteOperation.wait(); > ``` > > Set `id` to the ID of the route that you want to delete. If you delete all routes in a routing table, resources in subnets that have this routing table assigned can only communicate with other resources within their network. All traffic to private IP addresses outside the network and to public IP addresses is discarded. ## Assigning routing tables to subnets You can only assign a routing table to subnets within the network that the routing table is associated with. After you assign a routing table to a subnet, egress traffic from all resources in the subnet is routed according to the routing table. > [tab] Web console > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. Switch to the **Subnets** tab. > 3. Select the subnet to which you want to assign a routing table. > 4. On the **Settings** tab, select a routing table from the **Routing table** drop-down list. > 5. Click **Save changes**. > [tab] CLI > > To assign a routing table to a subnet, run the following command: > > ```bash > nebius vpc subnet update \ > --route-table-id > ``` > > In the command, specify the following parameters: > > * ``: ID of the subnet to assign the routing table to. To get it, run: > > ```bash > nebius vpc subnet list > ``` > > The output contains the subnet ID in the `.metadata.id` parameter. > > * `--route-table-id`: ID of the routing table to assign to the subnet. To get it, run: > > ```bash > nebius vpc route-table list > ``` > > The output contains the routing table ID in the `.metadata.id` parameter. > [tab] Go SDK > > Assign a routing table to a subnet: > > ```go > assignedSubnetService := sdk.Services().VPC().V1(). > Subnet() > assignedSubnet, err := assignedSubnetService.Get( > ctx, > &vpc.GetSubnetRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > assignedSubnet.Spec.RouteTableId = "" > assignedSubnetOperation, err := assignedSubnetService.Update( > ctx, > &vpc.UpdateSubnetRequest{ > Metadata: assignedSubnet.Metadata, > Spec: assignedSubnet.Spec, > }, > ) > if err != nil { > return err > } > if _, err = assignedSubnetOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: ID of the subnet to assign the routing table to. > * `Spec.RouteTableId`: ID of the routing table to assign to the subnet. > > The code gets the subnet, sets the routing table in its specification and updates the subnet. > [tab] Python SDK > > Assign a routing table to a subnet: > > ```python > assigned_subnet_service = SubnetServiceClient(sdk) > assigned_subnet = await assigned_subnet_service.get( > GetSubnetRequest( > id="", > ), > ) > assigned_subnet.spec.route_table_id = "" > assigned_subnet_operation = await assigned_subnet_service.update( > UpdateSubnetRequest( > metadata=assigned_subnet.metadata, > spec=assigned_subnet.spec, > ), > ) > await assigned_subnet_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: ID of the subnet to assign the routing table to. > * `spec.route_table_id`: ID of the routing table to assign to the subnet. > > The code gets the subnet, sets the routing table in its specification and updates the subnet. > [tab] JavaScript SDK > > Assign a routing table to a subnet: > > ```ts > const assignedSubnetService = new SubnetService(sdk); > const assignedSubnet = await assignedSubnetService.get( > GetSubnetRequest.create({ > id: "", > }), > ).result; > assignedSubnet.spec.routeTableId = ""; > const assignedSubnetOperation = await assignedSubnetService.update( > UpdateSubnetRequest.create({ > metadata: assignedSubnet.metadata, > spec: assignedSubnet.spec, > }), > ).result; > await assignedSubnetOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: ID of the subnet to assign the routing table to. > * `spec.routeTableId`: ID of the routing table to assign to the subnet. > > The code gets the subnet, sets the routing table in its specification and updates the subnet. ## Reverting subnets to the parent network's default routing table If you no longer want to apply custom routing to a subnet, you can unassign its custom routing table. After this, the subnet uses its parent network's default routing table. > [tab] Web console > > To assign the subnet to its parent network's default routing table: > > 1. Find the parent network's default routing table: > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. In the list of networks, select the network to which the subnet belongs. > 3. Switch to the **Routing tables** tab. The default routing table has a **Default** label next to its name. > 2. Assign the default routing table to the subnet: > 1. Switch to the **Subnets** tab. > 2. Select the subnet that you want to revert to the default routing table. > 3. On the **Settings** tab, select the default routing table from the **Routing table** drop-down list. > 4. Click **Save changes**. > > Alternatively, you can [delete](https://docs.nebius.com/vpc/routing/manage.md#deleting-routing-tables-web-console) the custom routing table if you no longer need it. When you delete the routing table, you can choose the option to use the default routing table for the subnet. > [tab] CLI > > To revert a subnet to its parent network's default routing table, run the following command: > > ```bash > nebius vpc subnet update \ > --route-table-id "" > ``` > > In the command, specify the subnet ID. To get it, run: > > ```bash > nebius vpc subnet list > ``` > > After you run this command, the subnet uses its parent network's default routing table. > [tab] Go SDK > > Revert a subnet to its parent network's default routing table: > > ```go > revertedSubnetService := sdk.Services().VPC().V1(). > Subnet() > revertedSubnet, err := revertedSubnetService.Get( > ctx, > &vpc.GetSubnetRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > revertedSubnet.Spec.RouteTableId = "" > revertedSubnetOperation, err := revertedSubnetService.Update( > ctx, > &vpc.UpdateSubnetRequest{ > Metadata: revertedSubnet.Metadata, > Spec: revertedSubnet.Spec, > }, > ) > if err != nil { > return err > } > if _, err = revertedSubnetOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the subnet ID. The code sets `Spec.RouteTableId` to an empty string and updates the subnet. After this, the subnet uses its parent network's default routing table. > [tab] Python SDK > > Revert a subnet to its parent network's default routing table: > > ```python > reverted_subnet_service = SubnetServiceClient(sdk) > reverted_subnet = await reverted_subnet_service.get( > GetSubnetRequest( > id="", > ), > ) > reverted_subnet.spec.route_table_id = "" > reverted_subnet_operation = await reverted_subnet_service.update( > UpdateSubnetRequest( > metadata=reverted_subnet.metadata, > spec=reverted_subnet.spec, > ), > ) > await reverted_subnet_operation.wait() > ``` > > Set `id` to the subnet ID. The code sets `spec.route_table_id` to an empty string and updates the subnet. After this, the subnet uses its parent network's default routing table. > [tab] JavaScript SDK > > Revert a subnet to its parent network's default routing table: > > ```ts > const revertedSubnetService = new SubnetService(sdk); > const revertedSubnet = await revertedSubnetService.get( > GetSubnetRequest.create({ > id: "", > }), > ).result; > revertedSubnet.spec.routeTableId = ""; > const revertedSubnetOperation = await revertedSubnetService.update( > UpdateSubnetRequest.create({ > metadata: revertedSubnet.metadata, > spec: revertedSubnet.spec, > }), > ).result; > await revertedSubnetOperation.wait(); > ``` > > Set `id` to the subnet ID. The code sets `spec.routeTableId` to an empty string and updates the subnet. After this, the subnet uses its parent network's default routing table. ## Resetting default routing tables of networks [Reverting to the default routing table](https://docs.nebius.com/vpc/routing/manage.md#reverting-subnets-to-the-parent-networks-default-routing-table) means that the [default routing rules](https://docs.nebius.com/vpc/routing/overview.md#default-routing-rules) apply to the subnet again, unless you have modified the default routing table. If you modified it, you can make the default routing table implement the default routing rules again. To do this, bring it to the state described in [Default routing tables](https://docs.nebius.com/vpc/routing/overview.md#default-routing-tables): > [tab] Web console > > If you added new routes to the default routing table, you can delete them to reset the default routing table. > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > > 2. Select the network whose default routing table you want to reset. > > 3. Switch to the **Routing tables** tab. > > 4. Select the routing table that is labeled **Default**. > > 5. In the routes list, check whether there is a route whose **Destination CIDR** value is `0.0.0.0/0`. > > 6. If there is no such route: > > 1. Click **Add route**. > > 2. In the window that opens: > > 1. Specify a name for the route. > 2. In **Destination CIDR**, enter `0.0.0.0/0`. > 3. Under **Next hop**, select **Default egress gateway**. > > 3. Click **Add route**. > > 7. [Delete](https://docs.nebius.com/vpc/routing/manage.md#deleting-routes-web-console) all other routes from the default routing table. > [tab] CLI > > 1. Get the ID of the default routing table: > > ```bash > nebius vpc network list > ``` > > The output contains the ID in the `.status.default_route_table_id` parameter. > > 2. List the table's routes: > > ```bash > nebius vpc route list --parent-id > ``` > > 3. If the table doesn't contain a route to the internet through the default egress gateway for all egress traffic (CIDR block `0.0.0.0/0`) as described in [Default routing tables](https://docs.nebius.com/vpc/routing/overview.md#default-routing-tables), add it: > > ```bash > nebius vpc route create \ > --name \ > --parent-id \ > --destination-cidr "0.0.0.0/0" \ > --next-hop-default-egress-gateway=true > ``` > > 4. [Delete](https://docs.nebius.com/vpc/routing/manage.md#deleting-routes-cli) all other routes from the default routing table. > [tab] Go SDK > > 1. Get the ID of the default routing table. List the networks in the project, with `ParentId` set to the project ID: > > ```go > routingNetworksService := sdk.Services().VPC().V1(). > Network() > routingNetworksResponse, err := routingNetworksService.List( > ctx, > &vpc.ListNetworksRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(routingNetworksResponse) > ``` > > The response contains the ID in `Status.DefaultRouteTableId` of each network. > > 2. List the table's routes. Set `ParentId` to the default routing table ID: > > ```go > defaultRoutesService := sdk.Services().VPC().V1(). > Route() > defaultRoutesResponse, err := defaultRoutesService.List( > ctx, > &vpc.ListRoutesRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(defaultRoutesResponse) > ``` > > 3. If the table doesn't contain a route to the internet through the default egress gateway for all egress traffic (CIDR block `0.0.0.0/0`) as described in [Default routing tables](https://docs.nebius.com/vpc/routing/overview.md#default-routing-tables), add it. Set `Metadata.Name` to the route name and `Metadata.ParentId` to the default routing table ID: > > ```go > defaultRouteService := sdk.Services().VPC().V1(). > Route() > defaultRouteOperation, err := defaultRouteService.Create( > ctx, > &vpc.CreateRouteRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.RouteSpec{ > Destination: &vpc.DestinationMatch{ > Cidr: "0.0.0.0/0", > }, > NextHop: &vpc.NextHop{ > NextHop: &vpc.NextHop_DefaultEgressGateway{ > DefaultEgressGateway: true, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = defaultRouteOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(defaultRouteOperation) > ``` > > 4. [Delete](https://docs.nebius.com/vpc/routing/manage.md#deleting-routes-go-sdk) all other routes from the default routing table. > [tab] Python SDK > > 1. Get the ID of the default routing table. List the networks in the project, with `parent_id` set to the project ID: > > ```python > routing_networks_service = NetworkServiceClient(sdk) > routing_networks_response = await routing_networks_service.list( > ListNetworksRequest( > parent_id="", > ), > ) > print(routing_networks_response) > ``` > > The response contains the ID in `status.default_route_table_id` of each network. > > 2. List the table's routes. Set `parent_id` to the default routing table ID: > > ```python > default_routes_service = RouteServiceClient(sdk) > default_routes_response = await default_routes_service.list( > ListRoutesRequest( > parent_id="", > ), > ) > print(default_routes_response) > ``` > > 3. If the table doesn't contain a route to the internet through the default egress gateway for all egress traffic (CIDR block `0.0.0.0/0`) as described in [Default routing tables](https://docs.nebius.com/vpc/routing/overview.md#default-routing-tables), add it. Set `name` to the route name and `parent_id` to the default routing table ID: > > ```python > default_route_service = RouteServiceClient(sdk) > default_route_operation = await default_route_service.create( > CreateRouteRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=RouteSpec( > destination=DestinationMatch( > cidr="0.0.0.0/0", > ), > next_hop=NextHop( > default_egress_gateway=True, > ), > ), > ), > ) > await default_route_operation.wait() > print(default_route_operation) > ``` > > 4. [Delete](https://docs.nebius.com/vpc/routing/manage.md#deleting-routes-python-sdk) all other routes from the default routing table. > [tab] JavaScript SDK > > 1. Get the ID of the default routing table. List the networks in the project, with `parentId` set to the project ID: > > ```ts > const routingNetworksService = new NetworkService(sdk); > const routingNetworksResponse = await routingNetworksService.list( > ListNetworksRequest.create({ > parentId: "", > }), > ).result; > console.log(routingNetworksResponse); > ``` > > The response contains the ID in `status.defaultRouteTableId` of each network. > > 2. List the table's routes. Set `parentId` to the default routing table ID: > > ```ts > const defaultRoutesService = new RouteService(sdk); > const defaultRoutesResponse = await defaultRoutesService.list( > ListRoutesRequest.create({ > parentId: "", > }), > ).result; > console.log(defaultRoutesResponse); > ``` > > 3. If the table doesn't contain a route to the internet through the default egress gateway for all egress traffic (CIDR block `0.0.0.0/0`) as described in [Default routing tables](https://docs.nebius.com/vpc/routing/overview.md#default-routing-tables), add it. Set `name` to the route name and `parentId` to the default routing table ID: > > ```ts > const defaultRouteService = new RouteService(sdk); > const defaultRouteOperation = await defaultRouteService.create( > CreateRouteRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > destination: { > cidr: "0.0.0.0/0", > }, > nextHop: { > nextHop: { > "$case": "defaultEgressGateway", > "defaultEgressGateway": true, > }, > }, > }, > }), > ).result; > await defaultRouteOperation.wait(); > console.log(defaultRouteOperation); > ``` > > 4. [Delete](https://docs.nebius.com/vpc/routing/manage.md#deleting-routes-javascript-sdk) all other routes from the default routing table. ## Deleting routing tables > [tab] Web console > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. Select the network from which you want to delete the routing table and switch to the **Routing tables** tab. > 3. Click next to the routing table you want to delete. > 4. In the window that opens: > * If the routing table is not assigned to any subnets, confirm the deletion. > * If the routing table is assigned to a subnet, select a new routing table for the subnet or choose the option to use the default routing table, then confirm the deletion. > [tab] CLI > > > [!WARNING] > > > > You can only delete custom routing tables that are not assigned to any subnet. Before deleting a routing table, [assign other routing tables](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-cli) to this table's subnets or [revert these subnets to defaults](https://docs.nebius.com/vpc/routing/manage.md#reverting-subnets-to-the-parent-networks-default-routing-table-cli). > > To delete a routing table, run the following command: > > ```bash > nebius vpc route-table delete > ``` > > In the command, specify the ID of the routing table. To get it, run: > > ```bash > nebius vpc route-table list > ``` > [tab] Go SDK > > > [!WARNING] > > > > You can only delete custom routing tables that are not assigned to any subnet. Before deleting a routing table, [assign other routing tables](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-go-sdk) to this table's subnets or [revert these subnets to defaults](https://docs.nebius.com/vpc/routing/manage.md#reverting-subnets-to-the-parent-networks-default-routing-table-go-sdk). > > Delete a routing table: > > ```go > deletedTableService := sdk.Services().VPC().V1(). > RouteTable() > deletedTableOperation, err := deletedTableService.Delete( > ctx, > &vpc.DeleteRouteTableRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deletedTableOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the ID of the routing table. > [tab] Python SDK > > > [!WARNING] > > > > You can only delete custom routing tables that are not assigned to any subnet. Before deleting a routing table, [assign other routing tables](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-python-sdk) to this table's subnets or [revert these subnets to defaults](https://docs.nebius.com/vpc/routing/manage.md#reverting-subnets-to-the-parent-networks-default-routing-table-python-sdk). > > Delete a routing table: > > ```python > deleted_table_service = RouteTableServiceClient(sdk) > deleted_table_operation = await deleted_table_service.delete( > DeleteRouteTableRequest( > id="", > ), > ) > await deleted_table_operation.wait() > ``` > > Set `id` to the ID of the routing table. > [tab] JavaScript SDK > > > [!WARNING] > > > > You can only delete custom routing tables that are not assigned to any subnet. Before deleting a routing table, [assign other routing tables](https://docs.nebius.com/vpc/routing/manage.md#assigning-routing-tables-to-subnets-javascript-sdk) to this table's subnets or [revert these subnets to defaults](https://docs.nebius.com/vpc/routing/manage.md#reverting-subnets-to-the-parent-networks-default-routing-table-javascript-sdk). > > Delete a routing table: > > ```ts > const deletedTableService = new RouteTableService(sdk); > const deletedTableOperation = await deletedTableService.delete( > DeleteRouteTableRequest.create({ > id: "", > }), > ).result; > await deletedTableOperation.wait(); > ``` > > Set `id` to the ID of the routing table. # Setting up a custom NAT gateway for subnets Source: https://docs.nebius.com/vpc/routing/custom-nat-gateway.md By default, traffic from your Nebius AI Cloud resources to public IP addresses is routed to the internet through the [default egress gateway](https://docs.nebius.com/vpc/routing/overview.md#default-egress-gateway). You can set up a Compute virtual machine (VM) as a custom gateway for traffic from specific subnets to the internet. The gateway is called a NAT gateway because it uses [network address translation](https://en.wikipedia.org/wiki/Network_address_translation) (NAT) to change the egress traffic's source IP address. This change causes the traffic to appear as if it were sent from the public IP address of the gateway VM rather than the private IP address of the originating resource. ## Costs Nebius AI Cloud charges you for running Compute virtual machines. For more details, see [Compute pricing](https://docs.nebius.com/compute/resources/pricing.md). ## Prerequisites > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Steps ### Create a gateway virtual machine > [!WARNING] > > The subnet for the gateway VM must be a separate subnet. In later steps, you create a routing table (route table) and assign it to subnets to which the new routing should apply; assigning this routing table to the gateway VM's subnet leads to routing loops. > [tab] CLI > > 1. Get the ID of the network that contains the subnets for which you want to set up routing: > > ```bash > nebius vpc network list > ``` > > Save the network's ID from the `.metadata.id` parameter. > > 2. Create a subnet for the gateway VM: > > ```bash > nebius vpc subnet create --name gateway-subnet --network-id > ``` > > Save the subnet's ID from the `.metadata.id` parameter. > > 3. Create a private allocation for the gateway VM: > > ```bash > nebius vpc allocation create \ > --name gateway-allocation \ > --ipv4-private-subnet-id > ``` > > Save the allocation's ID from the `.metadata.id` parameter. > > 4. Create the gateway VM. It must have a network interface that is located in the created subnet, has the allocated private IP address and a public IP address: > > ```bash > nebius compute instance create \ > --name gateway-vm \ > --network-interfaces "[{ > \"name\": \"eth0\", > \"ip_address\": { > \"allocation_id\": \"\" > }, > \"subnet_id\": \"\", > \"public_ip_address\": {} > }]" \ > > ``` > > > [accordion] Full example > > > > ```bash > > VM_BOOT_DISK_ID=$(nebius compute disk create \ > > --name gateway-boot-disk \ > > --size-gibibytes 50 \ > > --type network_ssd \ > > --source-image-family-image-family ubuntu24.04-cuda13.0 \ > > --block-size-bytes 4096 \ > > --format jsonpath='{.metadata.id}') > > > > nebius compute instance create \ > > --name gateway-vm-example \ > > --resources-platform cpu-d3 \ > > --resources-preset 4vcpu-16gb \ > > --boot-disk-existing-disk-id $VM_BOOT_DISK_ID \ > > --boot-disk-attach-mode read_write \ > > --boot-disk-device-id boot-disk \ > > --network-interfaces "[{ > > \"name\": \"eth0\", > > \"ip_address\": { > > \"allocation_id\": \"\" > > }, > > \"subnet_id\": \"\", > > \"public_ip_address\": {} > > }]" \ > > --cloud-init-user-data "users: > > - name: $USER > > sudo: ALL=(ALL) NOPASSWD:ALL > > shell: /bin/bash > > ssh_authorized_keys: > > - $(cat ~/.ssh/id_ed25519.pub)" > > ``` > > For more details about VM parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Go SDK > > 1. Get the ID of the network that contains the subnets for which you want to set up routing. List the networks in the project, with `ParentId` set to the project ID: > > ```go > natNetworksService := sdk.Services().VPC().V1(). > Network() > natNetworksResponse, err := natNetworksService.List( > ctx, > &vpc.ListNetworksRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(natNetworksResponse) > ``` > > Save the network's ID from `Metadata.Id`. > > 2. Create a subnet for the gateway VM. Set `Metadata.ParentId` to the project ID and `Spec.NetworkId` to the network ID: > > ```go > gatewaySubnetService := sdk.Services().VPC().V1(). > Subnet() > gatewaySubnetOperation, err := gatewaySubnetService.Create( > ctx, > &vpc.CreateSubnetRequest{ > Metadata: &common.ResourceMetadata{ > Name: "gateway-subnet", > ParentId: "", > }, > Spec: &vpc.SubnetSpec{ > NetworkId: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = gatewaySubnetOperation.Wait(ctx); err != nil { > return err > } > gatewaySubnetID := gatewaySubnetOperation.ResourceID() > fmt.Println(gatewaySubnetOperation) > ``` > > The code saves the subnet ID to `gatewaySubnetID`. > > 3. Create a private allocation for the gateway VM. Set `Metadata.ParentId` to the project ID and `SubnetId` to the gateway subnet ID: > > ```go > gatewayIpService := sdk.Services().VPC().V1(). > Allocation() > gatewayIpOperation, err := gatewayIpService.Create( > ctx, > &vpc.CreateAllocationRequest{ > Metadata: &common.ResourceMetadata{ > Name: "gateway-allocation", > ParentId: "", > }, > Spec: &vpc.AllocationSpec{ > IpSpec: &vpc.AllocationSpec_Ipv4Private{ > Ipv4Private: &vpc.IPv4PrivateAllocationSpec{ > Pool: &vpc.IPv4PrivateAllocationSpec_SubnetId{ > SubnetId: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = gatewayIpOperation.Wait(ctx); err != nil { > return err > } > allocationID := gatewayIpOperation.ResourceID() > fmt.Println(gatewayIpOperation) > ``` > > The code saves the allocation ID to `allocationID`. > > 4. Create the gateway VM. It must have a network interface that is located in the created subnet, has the allocated private IP address and a public IP address: > > ```go > gatewayInstanceService := sdk.Services().Compute().V1(). > Instance() > gatewayInstanceOperation, err := gatewayInstanceService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "gateway-vm", > ParentId: "", > }, > Spec: &compute.InstanceSpec{ > Resources: &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > }, > BootDisk: &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ExistingDisk{ > ExistingDisk: &compute.ExistingDisk{ > Id: "", > }, > }, > DeviceId: "boot-device-id", > }, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: "", > IpAddress: &compute.IPAddress{ > AllocationId: "", > }, > PublicIpAddress: &compute.PublicIPAddress{}, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = gatewayInstanceOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(gatewayInstanceOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.ParentId`: ID of the project. > * `Id` under `Spec.BootDisk`: ID of the boot disk. > * `SubnetId`: ID of the gateway subnet. > * `AllocationId`: ID of the gateway allocation. > > `PublicIpAddress` gives the VM a public IP address. `Spec.Resources.Platform` and `Preset` under `Spec.Resources.Size` are example values; change them if needed. > > > [accordion] Full example > > > > The full example also creates a boot disk and adds a user through cloud-init. Set `` and `` to the username and the public SSH key for connecting to the VM. > > > > ```go > > exampleDiskService := sdk.Services().Compute().V1(). > > Disk() > > exampleDiskOperation, err := exampleDiskService.Create( > > ctx, > > &compute.CreateDiskRequest{ > > Metadata: &common.ResourceMetadata{ > > Name: "gateway-boot-disk", > > ParentId: "", > > }, > > Spec: &compute.DiskSpec{ > > Size: &compute.DiskSpec_SizeGibibytes{ > > SizeGibibytes: 50, > > }, > > BlockSizeBytes: 4096, > > Type: compute.DiskSpec_NETWORK_SSD, > > Source: &compute.DiskSpec_SourceImageFamily{ > > SourceImageFamily: &compute.SourceImageFamily{ > > ImageFamily: "ubuntu24.04-cuda13.0", > > }, > > }, > > }, > > }, > > ) > > if err != nil { > > return err > > } > > if _, err = exampleDiskOperation.Wait(ctx); err != nil { > > return err > > } > > exampleCloudInit := fmt.Sprintf( > > "users:\n"+ > > " - name: %s\n"+ > > " sudo: ALL=(ALL) NOPASSWD:ALL\n"+ > > " shell: /bin/bash\n"+ > > " ssh_authorized_keys:\n"+ > > " - %s\n", > > "", > > "", > > ) > > exampleInstanceService := sdk.Services().Compute().V1(). > > Instance() > > exampleInstanceOperation, err := exampleInstanceService.Create( > > ctx, > > &compute.CreateInstanceRequest{ > > Metadata: &common.ResourceMetadata{ > > Name: "gateway-vm-example", > > ParentId: "", > > }, > > Spec: &compute.InstanceSpec{ > > Resources: &compute.ResourcesSpec{ > > Platform: "cpu-d3", > > Size: &compute.ResourcesSpec_Preset{ > > Preset: "4vcpu-16gb", > > }, > > }, > > BootDisk: &compute.AttachedDiskSpec{ > > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > > Type: &compute.AttachedDiskSpec_ExistingDisk{ > > ExistingDisk: &compute.ExistingDisk{ > > Id: exampleDiskOperation.ResourceID(), > > }, > > }, > > DeviceId: "boot-disk", > > }, > > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > > &compute.NetworkInterfaceSpec{ > > Name: "eth0", > > SubnetId: "", > > IpAddress: &compute.IPAddress{ > > AllocationId: "", > > }, > > PublicIpAddress: &compute.PublicIPAddress{}, > > }, > > }, > > CloudInitUserData: exampleCloudInit, > > }, > > }, > > ) > > if err != nil { > > return err > > } > > if _, err = exampleInstanceOperation.Wait(ctx); err != nil { > > return err > > } > > fmt.Println(exampleInstanceOperation) > > ``` > > For more details about VM parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] Python SDK > > 1. Get the ID of the network that contains the subnets for which you want to set up routing. List the networks in the project, with `parent_id` set to the project ID: > > ```python > nat_networks_service = NetworkServiceClient(sdk) > nat_networks_response = await nat_networks_service.list( > ListNetworksRequest( > parent_id="", > ), > ) > print(nat_networks_response) > ``` > > Save the network's ID from `metadata.id`. > > 2. Create a subnet for the gateway VM. Set `parent_id` to the project ID and `network_id` to the network ID: > > ```python > gateway_subnet_service = SubnetServiceClient(sdk) > gateway_subnet_operation = await gateway_subnet_service.create( > CreateSubnetRequest( > metadata=ResourceMetadata( > name="gateway-subnet", > parent_id="", > ), > spec=SubnetSpec( > network_id="", > ), > ), > ) > await gateway_subnet_operation.wait() > gateway_subnet_id = gateway_subnet_operation.resource_id > print(gateway_subnet_operation) > ``` > > The code saves the subnet ID to `gateway_subnet_id`. > > 3. Create a private allocation for the gateway VM. Set `parent_id` to the project ID and `subnet_id` to the gateway subnet ID: > > ```python > gateway_ip_service = AllocationServiceClient(sdk) > gateway_ip_operation = await gateway_ip_service.create( > CreateAllocationRequest( > metadata=ResourceMetadata( > name="gateway-allocation", > parent_id="", > ), > spec=AllocationSpec( > ipv4_private=IPv4PrivateAllocationSpec( > subnet_id="", > ), > ), > ), > ) > await gateway_ip_operation.wait() > allocation_id = gateway_ip_operation.resource_id > print(gateway_ip_operation) > ``` > > The code saves the allocation ID to `allocation_id`. > > 4. Create the gateway VM. It must have a network interface that is located in the created subnet, has the allocated private IP address and a public IP address: > > ```python > gateway_instance_service = InstanceServiceClient(sdk) > gateway_instance_operation = await gateway_instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="gateway-vm", > parent_id="", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > existing_disk=ExistingDisk( > id="", > ), > device_id="boot-device-id", > ), > network_interfaces=[ > NetworkInterfaceSpec( > name="eth0", > subnet_id="", > ip_address=IPAddress( > allocation_id="", > ), > public_ip_address=PublicIPAddress(), > ), > ], > ), > ), > ) > await gateway_instance_operation.wait() > print(gateway_instance_operation) > ``` > > In the code, set the following parameters: > > * `parent_id`: ID of the project. > * `existing_disk.id`: ID of the boot disk. > * `subnet_id`: ID of the gateway subnet. > * `allocation_id`: ID of the gateway allocation. > > `public_ip_address` gives the VM a public IP address. `resources.platform` and `resources.preset` are example values; change them if needed. > > > [accordion] Full example > > > > The full example also creates a boot disk and adds a user through cloud-init. Set `` and `` to the username and the public SSH key for connecting to the VM. > > > > ```python > > example_disk_service = DiskServiceClient(sdk) > > example_disk_operation = await example_disk_service.create( > > CreateDiskRequest( > > metadata=ResourceMetadata( > > name="gateway-boot-disk", > > parent_id="", > > ), > > spec=DiskSpec( > > size_gibibytes=50, > > block_size_bytes=4096, > > type=DiskSpec.DiskType.NETWORK_SSD, > > source_image_family=SourceImageFamily( > > image_family="ubuntu24.04-cuda13.0", > > ), > > ), > > ), > > ) > > await example_disk_operation.wait() > > example_cloud_init = ( > > "users:\n" > > " - name: {}\n" > > " sudo: ALL=(ALL) NOPASSWD:ALL\n" > > " shell: /bin/bash\n" > > " ssh_authorized_keys:\n" > > " - {}\n" > > ).format("", "") > > example_instance_service = InstanceServiceClient(sdk) > > example_instance_operation = await example_instance_service.create( > > CreateInstanceRequest( > > metadata=ResourceMetadata( > > name="gateway-vm-example", > > parent_id="", > > ), > > spec=InstanceSpec( > > resources=ResourcesSpec( > > platform="cpu-d3", > > preset="4vcpu-16gb", > > ), > > boot_disk=AttachedDiskSpec( > > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > > existing_disk=ExistingDisk( > > id=example_disk_operation.resource_id, > > ), > > device_id="boot-disk", > > ), > > network_interfaces=[ > > NetworkInterfaceSpec( > > name="eth0", > > subnet_id="", > > ip_address=IPAddress( > > allocation_id="", > > ), > > public_ip_address=PublicIPAddress(), > > ), > > ], > > cloud_init_user_data=example_cloud_init, > > ), > > ), > > ) > > await example_instance_operation.wait() > > print(example_instance_operation) > > ``` > > For more details about VM parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). > [tab] JavaScript SDK > > 1. Get the ID of the network that contains the subnets for which you want to set up routing. List the networks in the project, with `parentId` set to the project ID: > > ```ts > const natNetworksService = new NetworkService(sdk); > const natNetworksResponse = await natNetworksService.list( > ListNetworksRequest.create({ > parentId: "", > }), > ).result; > console.log(natNetworksResponse); > ``` > > Save the network's ID from `metadata.id`. > > 2. Create a subnet for the gateway VM. Set `parentId` to the project ID and `networkId` to the network ID: > > ```ts > const gatewaySubnetService = new SubnetService(sdk); > const gatewaySubnetOperation = await gatewaySubnetService.create( > CreateSubnetRequest.create({ > metadata: { > name: "gateway-subnet", > parentId: "", > }, > spec: { > networkId: "", > }, > }), > ).result; > await gatewaySubnetOperation.wait(); > const gatewaySubnetId = gatewaySubnetOperation.resourceId(); > console.log(gatewaySubnetOperation); > ``` > > The code saves the subnet ID to `gatewaySubnetId`. > > 3. Create a private allocation for the gateway VM. Set `parentId` to the project ID and `subnetId` to the gateway subnet ID: > > ```ts > const gatewayIpService = new AllocationService(sdk); > const gatewayIpOperation = await gatewayIpService.create( > CreateAllocationRequest.create({ > metadata: { > name: "gateway-allocation", > parentId: "", > }, > spec: { > ipSpec: { > "$case": "ipv4Private", > "ipv4Private": { > pool: { > "$case": "subnetId", > "subnetId": "", > }, > }, > }, > }, > }), > ).result; > await gatewayIpOperation.wait(); > const allocationId = gatewayIpOperation.resourceId(); > console.log(gatewayIpOperation); > ``` > > The code saves the allocation ID to `allocationId`. > > 4. Create the gateway VM. It must have a network interface that is located in the created subnet, has the allocated private IP address and a public IP address: > > ```ts > const gatewayInstanceService = new InstanceService(sdk); > const gatewayInstanceOperation = await gatewayInstanceService.create( > CreateInstanceRequest.create({ > metadata: { > name: "gateway-vm", > parentId: "", > }, > spec: { > resources: { > platform: "cpu-e2", > size: { > "$case": "preset", > "preset": "2vcpu-8gb", > }, > }, > bootDisk: { > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > "$case": "existingDisk", > "existingDisk": { > id: "", > }, > }, > deviceId: "boot-device-id", > }, > networkInterfaces: [ > { > name: "eth0", > subnetId: "", > ipAddress: { > allocationId: "", > }, > publicIpAddress: {}, > }, > ], > }, > }), > ).result; > await gatewayInstanceOperation.wait(); > console.log(gatewayInstanceOperation); > ``` > > In the code, set the following parameters: > > * `parentId`: ID of the project. > * `existingDisk.id`: ID of the boot disk. > * `subnetId`: ID of the gateway subnet. > * `allocationId`: ID of the gateway allocation. > > `publicIpAddress` gives the VM a public IP address. `resources.platform` and `preset` under `resources.size` are example values; change them if needed. > > > [accordion] Full example > > > > The full example also creates a boot disk and adds a user through cloud-init. Set `` and `` to the username and the public SSH key for connecting to the VM. > > > > ```ts > > const exampleDiskService = new DiskService(sdk); > > const exampleDiskOperation = await exampleDiskService.create( > > CreateDiskRequest.create({ > > metadata: { > > name: "gateway-boot-disk", > > parentId: "", > > }, > > spec: { > > size: { > > "$case": "sizeGibibytes", > > "sizeGibibytes": 50, > > }, > > blockSizeBytes: 4096, > > type: DiskSpec_DiskType.NETWORK_SSD, > > source: { > > "$case": "sourceImageFamily", > > "sourceImageFamily": { > > imageFamily: "ubuntu24.04-cuda13.0", > > }, > > }, > > }, > > }), > > ).result; > > await exampleDiskOperation.wait(); > > const exampleCloudInit = [ > > "users:", > > " - name: " + "", > > " sudo: ALL=(ALL) NOPASSWD:ALL", > > " shell: /bin/bash", > > " ssh_authorized_keys:", > > " - " + "", > > ].join("\n"); > > const exampleInstanceService = new InstanceService(sdk); > > const exampleInstanceOperation = await exampleInstanceService.create( > > CreateInstanceRequest.create({ > > metadata: { > > name: "gateway-vm-example", > > parentId: "", > > }, > > spec: { > > resources: { > > platform: "cpu-d3", > > size: { > > "$case": "preset", > > "preset": "4vcpu-16gb", > > }, > > }, > > bootDisk: { > > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > > type: { > > "$case": "existingDisk", > > "existingDisk": { > > id: exampleDiskOperation.resourceId(), > > }, > > }, > > deviceId: "boot-disk", > > }, > > networkInterfaces: [ > > { > > name: "eth0", > > subnetId: "", > > ipAddress: { > > allocationId: "", > > }, > > publicIpAddress: {}, > > }, > > ], > > cloudInitUserData: exampleCloudInit, > > }, > > }), > > ).result; > > await exampleInstanceOperation.wait(); > > console.log(exampleInstanceOperation); > > ``` > > For more details about VM parameters, see [How to create a virtual machine in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/create.md). ### Set up the gateway VM 1. Connect to the gateway VM by using SSH: ```bash ssh @ ``` For more details, see [How to connect to virtual machines in Nebius AI Cloud](https://docs.nebius.com/compute/virtual-machines/connect.md). 2. Enable IPv4 routing and make this change persistent: ```bash sudo sysctl -w net.ipv4.ip_forward=1 sudo sed -i -E 's/^(#\s?)?net.ipv4.ip_forward.*/net.ipv4.ip_forward=1/' /etc/sysctl.conf ``` 3. Enable egress NAT and make this change persistent: ```bash sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo apt-get install iptables-persistent ``` The latter command asks you whether to save your current `iptables` IPv4 and IPv6 rules to files. Answer "yes" to both. 4. Disconnect from the gateway VM: ```bash exit ``` ### Set up routing > [tab] CLI > > 1. Create a routing table in the network: > > ```bash > nebius vpc route-table create \ > --name gateway-table \ > --network-id > ``` > > Save the routing table's ID from the `.metadata.id` parameter. > > 2. Create a route in the routing table to send egress traffic to the gateway private allocation: > > ```bash > nebius vpc route create \ > --name route-to-allocation \ > --parent-id \ > --destination-cidr 0.0.0.0/0 \ > --next-hop-allocation-id > ``` > > 3. Assign the routing table to the subnets that should use the NAT gateway: > > ```bash > nebius vpc subnet update \ > --route-table-id > ``` > > Repeat for each subnet as needed. Do not assign the routing table to the subnet of the gateway VM (`gateway-subnet`). > [tab] Go SDK > > 1. Create a routing table in the network. Set `Metadata.ParentId` to the project ID and `Spec.NetworkId` to the network ID: > > ```go > gatewayTableService := sdk.Services().VPC().V1(). > RouteTable() > gatewayTableOperation, err := gatewayTableService.Create( > ctx, > &vpc.CreateRouteTableRequest{ > Metadata: &common.ResourceMetadata{ > Name: "gateway-table", > ParentId: "", > }, > Spec: &vpc.RouteTableSpec{ > NetworkId: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = gatewayTableOperation.Wait(ctx); err != nil { > return err > } > routingTableID := gatewayTableOperation.ResourceID() > fmt.Println(gatewayTableOperation) > ``` > > The code saves the routing table ID to `routingTableID`. > > 2. Create a route in the routing table to send egress traffic to the gateway private allocation. Set `Metadata.ParentId` to the routing table ID and `Id` under `Spec.NextHop.Allocation` to the gateway allocation ID: > > ```go > gatewayRouteService := sdk.Services().VPC().V1(). > Route() > gatewayRouteOperation, err := gatewayRouteService.Create( > ctx, > &vpc.CreateRouteRequest{ > Metadata: &common.ResourceMetadata{ > Name: "route-to-allocation", > ParentId: "", > }, > Spec: &vpc.RouteSpec{ > Destination: &vpc.DestinationMatch{ > Cidr: "0.0.0.0/0", > }, > NextHop: &vpc.NextHop{ > NextHop: &vpc.NextHop_Allocation{ > Allocation: &vpc.AllocationNextHop{ > Id: "", > }, > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = gatewayRouteOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(gatewayRouteOperation) > ``` > > 3. Assign the routing table to the subnets that should use the NAT gateway. Set `Id` to the subnet ID and `Spec.RouteTableId` to the routing table ID: > > ```go > clientSubnetService := sdk.Services().VPC().V1(). > Subnet() > clientSubnet, err := clientSubnetService.Get( > ctx, > &vpc.GetSubnetRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > clientSubnet.Spec.RouteTableId = "" > clientSubnetOperation, err := clientSubnetService.Update( > ctx, > &vpc.UpdateSubnetRequest{ > Metadata: clientSubnet.Metadata, > Spec: clientSubnet.Spec, > }, > ) > if err != nil { > return err > } > if _, err = clientSubnetOperation.Wait(ctx); err != nil { > return err > } > ``` > > Repeat for each subnet as needed. Do not assign the routing table to the subnet of the gateway VM (`gateway-subnet`). > [tab] Python SDK > > 1. Create a routing table in the network. Set `parent_id` to the project ID and `network_id` to the network ID: > > ```python > gateway_table_service = RouteTableServiceClient(sdk) > gateway_table_operation = await gateway_table_service.create( > CreateRouteTableRequest( > metadata=ResourceMetadata( > name="gateway-table", > parent_id="", > ), > spec=RouteTableSpec( > network_id="", > ), > ), > ) > await gateway_table_operation.wait() > routing_table_id = gateway_table_operation.resource_id > print(gateway_table_operation) > ``` > > The code saves the routing table ID to `routing_table_id`. > > 2. Create a route in the routing table to send egress traffic to the gateway private allocation. Set `parent_id` to the routing table ID and `next_hop.allocation.id` to the gateway allocation ID: > > ```python > gateway_route_service = RouteServiceClient(sdk) > gateway_route_operation = await gateway_route_service.create( > CreateRouteRequest( > metadata=ResourceMetadata( > name="route-to-allocation", > parent_id="", > ), > spec=RouteSpec( > destination=DestinationMatch( > cidr="0.0.0.0/0", > ), > next_hop=NextHop( > allocation=AllocationNextHop( > id="", > ), > ), > ), > ), > ) > await gateway_route_operation.wait() > print(gateway_route_operation) > ``` > > 3. Assign the routing table to the subnets that should use the NAT gateway. Set `id` to the subnet ID and `spec.route_table_id` to the routing table ID: > > ```python > client_subnet_service = SubnetServiceClient(sdk) > client_subnet = await client_subnet_service.get( > GetSubnetRequest( > id="", > ), > ) > client_subnet.spec.route_table_id = "" > client_subnet_operation = await client_subnet_service.update( > UpdateSubnetRequest( > metadata=client_subnet.metadata, > spec=client_subnet.spec, > ), > ) > await client_subnet_operation.wait() > ``` > > Repeat for each subnet as needed. Do not assign the routing table to the subnet of the gateway VM (`gateway-subnet`). > [tab] JavaScript SDK > > 1. Create a routing table in the network. Set `parentId` to the project ID and `networkId` to the network ID: > > ```ts > const gatewayTableService = new RouteTableService(sdk); > const gatewayTableOperation = await gatewayTableService.create( > CreateRouteTableRequest.create({ > metadata: { > name: "gateway-table", > parentId: "", > }, > spec: { > networkId: "", > }, > }), > ).result; > await gatewayTableOperation.wait(); > const routingTableId = gatewayTableOperation.resourceId(); > console.log(gatewayTableOperation); > ``` > > The code saves the routing table ID to `routingTableId`. > > 2. Create a route in the routing table to send egress traffic to the gateway private allocation. Set `parentId` to the routing table ID and `id` under `nextHop.allocation` to the gateway allocation ID: > > ```ts > const gatewayRouteService = new RouteService(sdk); > const gatewayRouteOperation = await gatewayRouteService.create( > CreateRouteRequest.create({ > metadata: { > name: "route-to-allocation", > parentId: "", > }, > spec: { > destination: { > cidr: "0.0.0.0/0", > }, > nextHop: { > nextHop: { > "$case": "allocation", > "allocation": { > id: "", > }, > }, > }, > }, > }), > ).result; > await gatewayRouteOperation.wait(); > console.log(gatewayRouteOperation); > ``` > > 3. Assign the routing table to the subnets that should use the NAT gateway. Set `id` to the subnet ID and `spec.routeTableId` to the routing table ID: > > ```ts > const clientSubnetService = new SubnetService(sdk); > const clientSubnet = await clientSubnetService.get( > GetSubnetRequest.create({ > id: "", > }), > ).result; > clientSubnet.spec.routeTableId = ""; > const clientSubnetOperation = await clientSubnetService.update( > UpdateSubnetRequest.create({ > metadata: clientSubnet.metadata, > spec: clientSubnet.spec, > }), > ).result; > await clientSubnetOperation.wait(); > ``` > > Repeat for each subnet as needed. Do not assign the routing table to the subnet of the gateway VM (`gateway-subnet`). ### Test routing To test that the routing table works, send traffic from a VM in a subnet to which you assigned the routing table (a test VM) and check its source IP address: 1. Connect to the test VM by using the gateway VM as the jump host: ```bash ssh -J @ @ ``` 2. Verify that egress traffic from the test VM to the internet is routed through the gateway VM, by using a public service that looks up the traffic's source IP address: ```bash curl ifconfig.me ``` The command should return the public IP address of the gateway VM. If it returns the private address of the test VM instead: * Check that you assigned the routing table to the subnet: run `nebius vpc route-table get ` and then find the subnet in the `.status.assignment.subnets` parameter. * Check that the test VM belongs to this subnet: run `nebius compute instance get ` and then find the subnet in the `.spec.network_interfaces[0].subnet_id` parameter. * Check that you specified the gateway VM's private allocation as the next hop in the route: run `nebius vpc route list --parent-id ` and then find the allocation in the `.spec.next_hop.allocation.id` parameter. ## How to delete the created resources The created Compute virtual machines are chargeable. If you don't need them, [delete these VMs](https://docs.nebius.com/compute/virtual-machines/delete.md), so Nebius AI Cloud doesn't charge for them. You can also delete the [routing tables](https://docs.nebius.com/vpc/routing/manage.md#deleting-routing-tables) and [allocations](https://docs.nebius.com/cli/reference/vpc/allocation/delete.md) if you no longer need them. # About DNS Source: https://docs.nebius.com/vpc/dns/overview.md DNS in Nebius AI Cloud resolves names privately inside a [network](https://docs.nebius.com/vpc/overview.md#network). A *DNS zone* is attached to exactly one network, and the names in it resolve only from workloads in that network, never from the internet. These names give your workloads stable internal endpoints, which you can serve under a domain name of your choosing rather than the one that Nebius AI Cloud assigns. DNS zones and records are subject to [quotas and constraints](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md). ## How name resolution works Every virtual machine (VM) in a network sends its DNS queries to the network resolver at `169.254.169.2`, which Nebius AI Cloud configures on the VM automatically. The resolver answers from the zones attached to the VM's network and forwards every other name to an upstream resolver managed by Nebius AI Cloud. You can't replace this resolver or forward a domain to a name server of your own. A zone answers authoritatively for every name under its domain name, so a query for a name that the zone doesn't contain returns a "record not found" response rather than being forwarded. ```mermaid graph LR classDef default fill:#dbefff,stroke-width:0px,color:#111c30; VM[VM in a network] -->|query| R[Network resolver] R -->|name under a zone on this network| Z["Zone answers, or returns 'record not found'"] R -->|any other name| U[Upstream resolver] ``` ## DNS zones A zone is a container for a domain name and every name under it. Its domain name is a fully qualified domain name ([FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md)) that ends with a dot, for example, `my.example.`. Neither the domain name nor the attached network can change after the zone is created. To serve the same domain name in another network, [create a second zone](https://docs.nebius.com/vpc/dns/manage-zones.md#creating-dns-zones) there. Zones that share a domain name across networks are independent and hold separate records. A network can't contain two zones with the same domain name, but it can contain zones whose domain names nest. If a network contains both `my.example.` and `sub.my.example.`, the zone with the longest matching domain name answers, so names under `sub.my.example.` are never served from `my.example.`. For instructions, see [Managing DNS zones](https://docs.nebius.com/vpc/dns/manage-zones.md). ## DNS records A *record* holds one name, type, and value inside a zone. To serve several values for one name, [create several records](https://docs.nebius.com/vpc/dns/manage-records.md#creating-dns-records) that share a relative name and type. A record's relative name joined to the zone's domain name is the name that the record answers at, for example, `www` in the zone `my.example.` answers queries for `www.my.example.`. For instructions, see [Managing DNS records](https://docs.nebius.com/vpc/dns/manage-records.md). ## System-managed and custom zones Every network has a system-managed zone, `.compute.internal.`, with a record for each VM's [FQDN](https://docs.nebius.com/compute/virtual-machines/fqdn.md). You can't change this zone or its records. Nebius AI Cloud configures `compute.internal` and `.compute.internal` as search domains on every VM. A VM appends these domains to a short name before it queries the resolver, so it reaches another VM in the same network by that VM's hostname or ID alone. When you [add custom zones](https://docs.nebius.com/vpc/dns/manage-zones.md#creating-dns-zones) to a network, VMs in the network resolve names from both the custom zones and the system-managed zone. Names in custom zones don't resolve by short name, so to reach the record `www` in the zone `my.example.`, query `www.my.example.`. ## Choosing a zone domain name Use a domain name that you don't need to resolve publicly from the same network, because the zone answers authoritatively for its whole domain name. If you name a zone after a publicly resolved domain, workloads in the network lose every name in that domain except the ones that you recreate in the zone. Some domain names aren't available for a zone. See [DNS quotas and constraints](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#constraints). ## Roles and permissions Access to DNS zones and records comes from the [general roles](https://docs.nebius.com/iam/authorization/roles.md#general-roles) that a [group](https://docs.nebius.com/iam/authorization/groups/index.md) holds within the tenant or project. The only role that treats the two differently is `auditor`, which can view zones but not records. ## What's next * [Managing DNS zones](https://docs.nebius.com/vpc/dns/manage-zones.md) * [Managing DNS records](https://docs.nebius.com/vpc/dns/manage-records.md) * [DNS quotas and constraints](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md) # Managing DNS zones Source: https://docs.nebius.com/vpc/dns/manage-zones.md Nebius AI Cloud creates a [system-managed DNS zone](https://docs.nebius.com/vpc/dns/overview.md#system-managed-and-custom-zones) for each virtual network automatically, but you can also create [custom DNS zones](https://docs.nebius.com/vpc/dns/overview.md#dns-zones) and manage them. Custom zones are private. Names in them resolve only from workloads inside the network the zone is attached to. > [!NOTE] > > System-managed zones, for example, `.compute.internal.`, are read-only and cannot be modified or deleted. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Creating DNS zones > [tab] Web console > > > [!NOTE] > > > > If you want to set a name for the zone or configure the negative caching time-to-live (TTL), use a different interface. The web console doesn't support these settings. > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > 2. Click **Actions** → **Create DNS zone**. > 3. In the window that opens, enter a fully qualified domain name (FQDN) that ends with a dot (`.`), for example, `my.example.`. Single-label names, such as `example.`, and reserved names, such as `console.nebius.`, aren't allowed. Learn more in [Zone domain name restrictions](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#zone-domain-name-restrictions). > 4. Select the network to attach the DNS zone to. > 5. Click **Create DNS zone**. > > You cannot change the domain name or attached network after creating the zone. To use another domain name or network, [delete the zone](https://docs.nebius.com/vpc/dns/manage-zones.md#deleting-dns-zones-web-console) and create a new one. > [tab] CLI > > Run the following command: > > ```bash > nebius dns zone create \ > --domain-name \ > --parent-id \ > --name \ > --labels =,= \ > --soa-spec-negative-ttl \ > --vpc-primary-network-id > ``` > > In the command, specify the following parameters: > > * `--domain-name`: Domain name for the zone. Use a fully qualified domain name (FQDN) that ends with a dot (`.`), for example, `my.example.`. You cannot change the domain name after the zone is created. Top-level domains such as `example.` and some names that are reserved for internal use, such as `console.nebius.`, aren't allowed. Learn more in [Zone domain name restrictions](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#zone-domain-name-restrictions). > * `--parent-id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli). > * `--vpc-primary-network-id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli) of the network to attach the zone to. You cannot change the network after the zone is created. > * `--name` (optional): Name of the zone. > * `--labels` (optional): Labels in the `key=value` format. > * `--soa-spec-negative-ttl` (optional): How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > > The output looks like the following: > > ```yaml > metadata: > id: dnszone-e00** > parent_id: project-e00** > resource_version: "144465" > created_at: "2026-06-30T12:50:55.335401Z" > updated_at: "2026-06-30T12:50:55.335401Z" > spec: > domain_name: my.example. > vpc: > primary_network_id: vpcnetwork-e00** > soa_spec: > negative_ttl: "300" > status: > record_count: "2" > ``` > > The returned resource shows the parameters you specified and the following: > > * `resource_version` is the current version of the zone. If you later update or delete the zone, you can pass this value in `--resource-version` to make sure that the command applies only to this version of the zone. > * `status.record_count` shows how many [DNS records](https://docs.nebius.com/vpc/dns/manage-records.md) the zone currently contains. This value can already be greater than `0` after creation because the zone includes service-managed records that are automatically created. > [tab] Terraform > > 1. Create the following configuration file: > > ```hcl > resource "nebius_dns_v1_zone" "my_zone" { > domain_name = "" > parent_id = "" > > vpc = { > primary_network_id = "" > } > > name = "" > > labels = { > = "" > } > > soa_spec = { > negative_ttl = > } > } > ``` > > In the configuration, specify the following parameters: > > * `domain_name`: Domain name for the zone. Use a fully qualified domain name (FQDN) that ends with a dot (`.`), for example, `my.example.`. You cannot change the domain name after the zone is created. Top-level domains such as `example.` and some names that are reserved for internal use, such as `console.nebius.`, aren't allowed. Learn more in [Zone domain name restrictions](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#zone-domain-name-restrictions). > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-terraform). > * `vpc.primary_network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id) of the network to attach the zone to. You cannot change the network after the zone is created. > * `name` (optional): Name of the zone. > * `labels` (optional): Labels in the `key = "value"` format. > * `soa_spec.negative_ttl` (optional): How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > > For all the parameters of the resource, see [nebius\_dns\_v1\_zone](https://docs.nebius.com/terraform-provider/reference/resources/dns_v1_zone.md) in the Terraform provider reference. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > Run the following code: > > ```go > zoneLabels := map[string]string{} > for _, label := range strings.Split("=,=", ",") { > key, value, _ := strings.Cut(label, "=") > zoneLabels[key] = value > } > dnsZoneService := sdk.Services().DNS().V1(). > Zone() > dnsZoneOperation, err := dnsZoneService.Create( > ctx, > &dns.CreateZoneRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > Labels: zoneLabels, > }, > Spec: &dns.ZoneSpec{ > DomainName: "", > Scope: &dns.ZoneSpec_Vpc{ > Vpc: &dns.VpcZoneScope{ > PrimaryNetworkId: "", > }, > }, > SoaSpec: &dns.SoaSpec{ > NegativeTtl: , > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = dnsZoneOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(dnsZoneOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name` (optional): Name of the zone. > * `Metadata.ParentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). > * `Metadata.Labels` (optional): Labels. The code builds them from the comma-separated `key=value` pairs in `zoneLabels`. > * `Spec.DomainName`: Domain name for the zone. Use a fully qualified domain name (FQDN) that ends with a dot (`.`), for example, `my.example.`. You cannot change the domain name after the zone is created. Top-level domains such as `example.` and some names that are reserved for internal use, such as `console.nebius.`, aren't allowed. Learn more in [Zone domain name restrictions](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#zone-domain-name-restrictions). > * `PrimaryNetworkId` under `Spec.Scope`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk) of the network to attach the zone to. You cannot change the network after the zone is created — delete and recreate the zone instead. > * `Spec.SoaSpec.NegativeTtl` (optional): How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > > To get the zone ID, use `dnsZoneOperation.ResourceID()`. > [tab] Python SDK > > Run the following code: > > ```python > zone_labels = dict( > label.split("=", 1) > for label in "=,=".split(",") > ) > dns_zone_service = ZoneServiceClient(sdk) > dns_zone_operation = await dns_zone_service.create( > CreateZoneRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > labels=zone_labels, > ), > spec=ZoneSpec( > domain_name="", > vpc=VpcZoneScope( > primary_network_id="", > ), > soa_spec=SoaSpec( > negative_ttl=, > ), > ), > ), > ) > await dns_zone_operation.wait() > print(dns_zone_operation) > ``` > > In the code, set the following parameters: > > * `name` (optional): Name of the zone. > * `parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). > * `labels` (optional): Labels. The code builds them from the comma-separated `key=value` pairs in `zone_labels`. > * `domain_name`: Domain name for the zone. Use a fully qualified domain name (FQDN) that ends with a dot (`.`), for example, `my.example.`. You cannot change the domain name after the zone is created. Top-level domains such as `example.` and some names that are reserved for internal use, such as `console.nebius.`, aren't allowed. Learn more in [Zone domain name restrictions](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#zone-domain-name-restrictions). > * `vpc.primary_network_id`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk) of the network to attach the zone to. You cannot change the network after the zone is created — delete and recreate the zone instead. > * `soa_spec.negative_ttl` (optional): How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > > To get the zone ID, use `dns_zone_operation.resource_id`. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const zoneLabels = Object.fromEntries( > "=,=".split(",").map((label) => { > const index = label.indexOf("="); > return [label.slice(0, index), label.slice(index + 1)]; > }), > ); > const dnsZoneService = new ZoneService(sdk); > const dnsZoneOperation = await dnsZoneService.create( > CreateZoneRequest.create({ > metadata: { > name: "", > parentId: "", > labels: zoneLabels, > }, > spec: { > domainName: "", > scope: { > "$case": "vpc", > "vpc": { > primaryNetworkId: "", > }, > }, > soaSpec: { > negativeTtl: , > }, > }, > }), > ).result; > await dnsZoneOperation.wait(); > console.log(dnsZoneOperation); > ``` > > In the code, set the following parameters: > > * `metadata.name` (optional): Name of the zone. > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). > * `metadata.labels` (optional): Labels. The code builds them from the comma-separated `key=value` pairs in `zoneLabels`. > * `spec.domainName`: Domain name for the zone. Use a fully qualified domain name (FQDN) that ends with a dot (`.`), for example, `my.example.`. You cannot change the domain name after the zone is created. Top-level domains such as `example.` and some names that are reserved for internal use, such as `console.nebius.`, aren't allowed. Learn more in [Zone domain name restrictions](https://docs.nebius.com/vpc/dns/resources/quotas-limits.md#zone-domain-name-restrictions). > * `primaryNetworkId` under `spec.scope`: [Network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk) of the network to attach the zone to. You cannot change the network after the zone is created — delete and recreate the zone instead. > * `spec.soaSpec.negativeTtl` (optional): How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > > To get the zone ID, use `dnsZoneOperation.resourceId()`. ## Updating DNS zones > [!NOTE] > > You cannot update DNS zones in the web console. To update a custom DNS zone, use a different interface. > [tab] CLI > > 1. Get the ID of the zone that you want to update: > > ```bash > nebius dns zone list > ``` > > Find the zone that you want to update. The output contains the zone ID in the `.metadata.id` parameter. > > 2. Run the following command: > > ```bash > nebius dns zone update \ > --name \ > --soa-spec-negative-ttl \ > --resource-version > > # To replace all labels, add: > # --labels =,= > # > # To add or remove specific labels, add: > # --labels-add = > # --labels-remove > ``` > > Specify the zone ID you got in the previous step as ``. In the command, you can specify the following parameters to update them: > > * `--name` (optional): Name of the zone. > * `--labels` (optional): Replace all labels with the specified labels, in the `key=value` format. > * `--labels-add` (optional): Add labels, in the `key=value` format, without replacing the existing labels. > * `--labels-remove` (optional): Remove existing labels by key. > * `--soa-spec-negative-ttl` (optional): How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > * `--resource-version` (optional): Current version of the zone. Use the `metadata.resource_version` value returned when you create the zone or when you get its ID and details if you want to update only the current version that you last checked. If the zone changed and has a different version, the command fails. > [tab] Terraform > > 1. In the configuration file, update the `nebius_dns_v1_zone` resource: > > ```hcl > resource "nebius_dns_v1_zone" "my_zone" { > name = "" > > labels = { > = "" > } > > soa_spec = { > negative_ttl = > } > > # ... > } > ``` > > You can update the following parameters: > > * `name`: Name of the zone. > * `labels`: Labels in the `key = "value"` format. > * `soa_spec.negative_ttl`: How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > > Terraform recreates a DNS zone if you change `domain_name` or `vpc.primary_network_id`. You cannot change them in an already existing DNS zone. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the zone that you want to update. List the zones in the project, with `ParentId` set to the project ID: > > ```go > dnsZonesService := sdk.Services().DNS().V1(). > Zone() > dnsZonesResponse, err := dnsZonesService.List( > ctx, > &dns.ListZonesRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(dnsZonesResponse) > ``` > > Find the zone that you want to update in `Items`. The zone ID is in `Metadata.Id`. > > 2. Update the zone: > > ```go > updatedZoneService := sdk.Services().DNS().V1(). > Zone() > updatedZone, err := updatedZoneService.Get( > ctx, > &dns.GetZoneRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > updatedZone.Metadata.Name = "" > updatedZone.Metadata.ResourceVersion = > updatedZone.Spec.SoaSpec = &dns.SoaSpec{ > NegativeTtl: , > } > // Optionally replace, add, or remove labels: > // updatedZone.Metadata.Labels = map[string]string{ > // "environment": "stage", "team": "docs", > // } > // updatedZone.Metadata.Labels["owner"] = "platform" > // delete(updatedZone.Metadata.Labels, "team") > zoneUpdateOperation, err := updatedZoneService.Update( > ctx, > &dns.UpdateZoneRequest{ > Metadata: updatedZone.Metadata, > Spec: updatedZone.Spec, > }, > ) > if err != nil { > return err > } > if _, err = zoneUpdateOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the zone ID you got in the previous step. The code gets the zone and updates the following parameters. Remove the lines for the parameters that you don't want to change: > > * `Metadata.Name`: Name of the zone. > * `Metadata.ResourceVersion`: Version of the zone that you last checked. If the zone changed and has a different version, the update fails. > * `Spec.SoaSpec.NegativeTtl`: How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > * `Metadata.Labels`: To replace, add or remove labels, uncomment the corresponding lines in the code. > [tab] Python SDK > > 1. Get the ID of the zone that you want to update. List the zones in the project, with `parent_id` set to the project ID: > > ```python > dns_zones_service = ZoneServiceClient(sdk) > dns_zones_response = await dns_zones_service.list( > ListZonesRequest( > parent_id="", > ), > ) > print(dns_zones_response) > ``` > > Find the zone that you want to update in `items`. The zone ID is in `metadata.id`. > > 2. Update the zone: > > ```python > updated_zone_service = ZoneServiceClient(sdk) > updated_zone = await updated_zone_service.get( > GetZoneRequest( > id="", > ), > ) > updated_zone.metadata.name = "" > updated_zone.metadata.resource_version = > updated_zone.spec.soa_spec = SoaSpec( > negative_ttl=, > ) > # Optionally replace, add, or remove labels: > # updated_zone.metadata.labels = { > # "environment": "stage", "team": "docs", > # } > # updated_zone.metadata.labels["owner"] = "platform" > # updated_zone.metadata.labels.pop("team", None) > zone_update_operation = await updated_zone_service.update( > UpdateZoneRequest( > metadata=updated_zone.metadata, > spec=updated_zone.spec, > ), > ) > await zone_update_operation.wait() > ``` > > Set `id` to the zone ID you got in the previous step. The code gets the zone and updates the following parameters. Remove the lines for the parameters that you don't want to change: > > * `metadata.name`: Name of the zone. > * `metadata.resource_version`: Version of the zone that you last checked. If the zone changed and has a different version, the update fails. > * `spec.soa_spec.negative_ttl`: How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > * `metadata.labels`: To replace, add or remove labels, uncomment the corresponding lines in the code. > [tab] JavaScript SDK > > 1. Get the ID of the zone that you want to update. List the zones in the project, with `parentId` set to the project ID: > > ```ts > const dnsZonesService = new ZoneService(sdk); > const dnsZonesResponse = await dnsZonesService.list( > ListZonesRequest.create({ > parentId: "", > }), > ).result; > console.log(dnsZonesResponse); > ``` > > Find the zone that you want to update in `items`. The zone ID is in `metadata.id`. > > 2. Update the zone: > > ```ts > const updatedZoneService = new ZoneService(sdk); > const updatedZone = await updatedZoneService.get( > GetZoneRequest.create({ > id: "", > }), > ).result; > updatedZone.metadata.name = ""; > updatedZone.metadata.resourceVersion = ; > updatedZone.spec.soaSpec = { > negativeTtl: , > }; > // Optionally replace, add, or remove labels: > // updatedZone.metadata.labels = { > // environment: "stage", team: "docs", > // }; > // updatedZone.metadata.labels.owner = "platform"; > // delete updatedZone.metadata.labels.team; > const zoneUpdateOperation = await updatedZoneService.update( > UpdateZoneRequest.create({ > metadata: updatedZone.metadata, > spec: updatedZone.spec, > }), > ).result; > await zoneUpdateOperation.wait(); > ``` > > Set `id` to the zone ID you got in the previous step. The code gets the zone and updates the following parameters. Remove the lines for the parameters that you don't want to change: > > * `metadata.name`: Name of the zone. > * `metadata.resourceVersion`: Version of the zone that you last checked. If the zone changed and has a different version, the update fails. > * `spec.soaSpec.negativeTtl`: How long DNS resolvers can cache a "record not found" response for this zone, in seconds. Values below `5` are ignored, and the service default of `900` is used instead. > * `metadata.labels`: To replace, add or remove labels, uncomment the corresponding lines in the code. ## Deleting DNS zones You cannot delete system-managed DNS zones. To delete a custom DNS zone, first [delete all records](https://docs.nebius.com/vpc/dns/manage-records.md#deleting-dns-records) except the default `NS @` and `SOA @` records. > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > 2. On the **DNS** tab, find the zone and click → **Delete**. > 3. Confirm the deletion. > [tab] CLI > > 1. Get the ID of the zone that you want to delete: > > ```bash > nebius dns zone list > ``` > > Find the zone that you want to delete. The output contains the zone ID in the `.metadata.id` parameter. > > 2. Run the following command: > > ```bash > nebius dns zone delete \ > --id \ > --resource-version > ``` > > In the command, specify the following parameters: > > * `--id`: ID of the DNS zone to delete, ``. > * `--resource-version` (optional): Current version of the zone. Use the `metadata.resource_version` value returned when you create the zone or when you get its ID and details if you want to delete only the current version that you last checked. If the zone changed and has a different version, the command fails. If you omit this parameter or set it to `0`, the command uses the current version of the zone. > [tab] Terraform > > 1. Remove the corresponding `nebius_dns_v1_zone` resource from the configuration file. > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the zone that you want to delete. List the zones in the project, with `ParentId` set to the project ID: > > ```go > dnsZonesService := sdk.Services().DNS().V1(). > Zone() > dnsZonesResponse, err := dnsZonesService.List( > ctx, > &dns.ListZonesRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(dnsZonesResponse) > ``` > > Find the zone that you want to delete in `Items`. The zone ID is in `Metadata.Id`. > > 2. Delete the zone: > > ```go > deletedZoneService := sdk.Services().DNS().V1(). > Zone() > deletedZoneOperation, err := deletedZoneService.Delete( > ctx, > &dns.DeleteZoneRequest{ > Id: "", > ResourceVersion: , > }, > ) > if err != nil { > return err > } > if _, err = deletedZoneOperation.Wait(ctx); err != nil { > return err > } > ``` > > In the code, set the following parameters: > > * `Id`: ID of the DNS zone to delete. > * `ResourceVersion` (optional): Version of the zone that you last checked, from its `Metadata.ResourceVersion`. If the zone changed and has a different version, the deletion fails. If you set it to `0`, the deletion uses the current version of the zone. > [tab] Python SDK > > 1. Get the ID of the zone that you want to delete. List the zones in the project, with `parent_id` set to the project ID: > > ```python > dns_zones_service = ZoneServiceClient(sdk) > dns_zones_response = await dns_zones_service.list( > ListZonesRequest( > parent_id="", > ), > ) > print(dns_zones_response) > ``` > > Find the zone that you want to delete in `items`. The zone ID is in `metadata.id`. > > 2. Delete the zone: > > ```python > deleted_zone_service = ZoneServiceClient(sdk) > deleted_zone_operation = await deleted_zone_service.delete( > DeleteZoneRequest( > id="", > resource_version=, > ), > ) > await deleted_zone_operation.wait() > ``` > > In the code, set the following parameters: > > * `id`: ID of the DNS zone to delete. > * `resource_version` (optional): Version of the zone that you last checked, from its `metadata.resource_version`. If the zone changed and has a different version, the deletion fails. If you set it to `0`, the deletion uses the current version of the zone. > [tab] JavaScript SDK > > 1. Get the ID of the zone that you want to delete. List the zones in the project, with `parentId` set to the project ID: > > ```ts > const dnsZonesService = new ZoneService(sdk); > const dnsZonesResponse = await dnsZonesService.list( > ListZonesRequest.create({ > parentId: "", > }), > ).result; > console.log(dnsZonesResponse); > ``` > > Find the zone that you want to delete in `items`. The zone ID is in `metadata.id`. > > 2. Delete the zone: > > ```ts > const deletedZoneService = new ZoneService(sdk); > const deletedZoneOperation = await deletedZoneService.delete( > DeleteZoneRequest.create({ > id: "", > resourceVersion: , > }), > ).result; > await deletedZoneOperation.wait(); > ``` > > In the code, set the following parameters: > > * `id`: ID of the DNS zone to delete. > * `resourceVersion` (optional): Version of the zone that you last checked, from its `metadata.resourceVersion`. If the zone changed and has a different version, the deletion fails. If you set it to `0`, the deletion uses the current version of the zone. # Managing DNS records Source: https://docs.nebius.com/vpc/dns/manage-records.md In a custom [DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md), you can create DNS records that resolve from inside the [network](https://docs.nebius.com/vpc/overview.md#network) attached to the zone. This page shows how to create, update, and delete DNS records. ## Prerequisites > [tab] Web console > > 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 2. [Create a custom DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md) to which to add records. > [tab] CLI > > 1. [Install and configure the Nebius AI Cloud CLI](https://docs.nebius.com/cli/quickstart.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Create a custom DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md) to which to add records. > [tab] Terraform > > 1. [Install and configure](https://docs.nebius.com/terraform-provider/install.md) the Nebius AI Cloud provider for Terraform. > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Create a custom DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md) to which to add records. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Create a custom DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md) to which to add records. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Create a custom DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md) to which to add records. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Create a custom DNS zone](https://docs.nebius.com/vpc/dns/manage-zones.md) to which to add records. ## Record types A record stores its data in the **Data** parameter as the RDATA part of the record in the [presentation (zonefile) format](https://datatracker.ietf.org/doc/html/rfc9499#name-resource-records). For example, for a `www 600 IN A 192.0.2.10` resource record in a zonefile, the record data is `192.0.2.10`. You can create the following record types in a custom DNS zone: | Type | Example data value | Format | | - | - | - | | `a` | `192.0.2.10` | IPv4 address | | `mx` | `10 mail.my.example.` | Priority and mail server domain name | | `txt` | `"v=spf1 -all"` | One or more quoted text strings | | `srv` | `10 5 5060 sip.my.example.` | Priority, weight, port, and target domain name | | `caa` | `0 issue "letsencrypt.org"` | Flags, tag, and quoted value | | `svcb` | `1 backend.my.example. port=8080` | Priority, target domain name, and service parameters | | `https` | `1 backend.my.example. alpn=h2` | Priority, target domain name, and service parameters | The following record types are restricted: * `ns`: Custom DNS zones do not support delegation. Nebius AI Cloud creates an NS record at the zone apex together with the zone. You cannot create, update, or delete NS records. * `soa`: Each zone contains exactly one SOA record that Nebius AI Cloud creates together with the zone. You cannot create additional SOA records or delete the existing one. To control how long resolvers cache a "record not found" response, [set the zone's negative caching time-to-live (TTL)](https://docs.nebius.com/vpc/dns/manage-zones.md#creating-dns-zones). This value appears in the last field of the SOA record data. * `cname`: CNAME records are not supported. Instead of an alias, create a record of the required type directly at that name, for example, an `a` record with the target's IP address. * `aaaa`: AAAA records are not supported in custom DNS zones. > [!NOTE] > > In Terraform, write the record type in uppercase, for example, `A` or `TXT`. The provider rejects the lowercase values that the CLI uses. ## Creating DNS records > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > > 2. On the **DNS** tab, select the zone to which you want to add records. > > 3. Click **Create record**. > > 4. In **Relative domain name**, enter the zone-relative name of the record, for example, `www` for `www.`. Use `@` to create the record at the zone apex. Use `*` as the leftmost label to create a wildcard record that answers queries for names that do not otherwise exist in the zone. > > 5. In **Record type**, select the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types) and fill the fields that appear: > > > [accordion] A > > > > * **IPv4 address**: IPv4 address to which the name resolves. > > > [accordion] MX > > > > * **Hostname**: Hostname of the mail server. > > * **Priority**: Priority of the mail server. > > > [accordion] TXT > > > > * **Value**: Text to store in the record. > > > > For email records such as DMARC and SPF, split text longer than 255 characters into multiple quoted blocks of 1–255 characters each. > > > [accordion] SRV > > > > * **Target**: Hostname of the target server. > > * **Priority**: Priority of the target host. > > * **Weight**: Relative weight of the target host among records with the same priority. > > * **Port**: Port on which the service is available. > > * **Protocol** (optional): Protocol used by the service, for example, `_tcp` or `_udp`. > > * **Service** (optional): Name of the service. > > > [accordion] CAA > > > > * **Value**: Value associated with the selected tag. > > * **Flag**: CAA record flag. > > * **Tag**: Tag type. Select `issue`, `issuewild` or `iodef`. > > > [accordion] SVCB > > > > * **Target**: Hostname of the service endpoint. > > * **Priority**: Priority of the service endpoint. > > * **Parameters** (optional): Service parameters. > > > [accordion] HTTPS > > > > * **Target**: Hostname of the HTTPS service endpoint. > > * **Priority**: Priority of the HTTPS service endpoint. > > * **Parameters** (optional): Service parameters. > > 6. (Optional) In **TTL**, enter how long DNS resolvers can cache the record, in seconds. > > 7. (Optional) Enable **Delete protection** to protect the record from accidental deletion. > > 8. Click **Create record**. > [tab] CLI > > To create a DNS record, run the following command: > > ```bash > nebius dns record create \ > --parent-id \ > --name \ > --relative-name \ > --type \ > --data \ > --ttl > ``` > > In the command, specify the following parameters: > > * `--parent-id`: ID of the DNS zone to create the record in. To get zone IDs, run `nebius dns zone list`. > > * `--name` (optional): Name of the record resource. This is not the domain name of the record. The resource name identifies the record in Nebius AI Cloud and lets you look the record up by name. The name must be unique within the zone. Records that Nebius AI Cloud creates automatically have no resource name. > > * `--relative-name`: Zone-relative name of the record, for example, `www` for `www.`. Use `@` to create the record at the zone apex. Use `*` as the leftmost label to create a wildcard record that answers queries for names that do not otherwise exist in the zone. You cannot change the relative name after the record is created. > > * `--type`: [Record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). You cannot change the type after the record is created. > > * `--data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). Each record holds one value. To serve several values for the same name, for example, several IP addresses in a round robin, create several records with the same relative name and type. Their data must differ; creating a record that repeats the relative name, type and data of an existing record fails with an `AlreadyExists` error. > > Write domain names in `--data` in fully qualified form with a trailing dot, for example, `service.my.example.`. For TXT records, enclose the values in double quotes. For SVCB and HTTPS records, specify the target as a domain name. The `.` shorthand for the record's own name is not supported. > > * `--ttl` (optional): Time-to-live in seconds. How long resolvers cache the record before querying again. Default: `600`. Give records that share a relative name and type the same TTL, because resolvers handle a set with mixed TTLs inconsistently. > > * `--labels` (optional): Labels in the `key=value` format. > > The output looks like the following: > > ```yaml > metadata: > id: dnsrecord-e00** > parent_id: dnszone-e00** > name: www-a-record > resource_version: "126446" > created_at: "2026-07-08T14:15:01.805225Z" > updated_at: "2026-07-08T14:15:01.805225Z" > spec: > relative_name: www > type: A > ttl: "600" > data: 192.0.2.10 > status: > zone_domain_name: my.example. > effective_fqdn: www.my.example. > ``` > > The returned resource shows the parameters you specified and the following: > > * `status.effective_fqdn` is the absolute domain name that the record resolves at: the relative name joined with the zone domain name. You need this value to [verify the DNS record](https://docs.nebius.com/vpc/dns/manage-records.md#verifying-dns-records-cli). > * `metadata.resource_version` is the current version of the record. If you later update or delete the record, you can pass this value in `--resource-version` to make sure that the command applies only to this version of the record. > > To protect a record from accidental deletion, add the `--deletion-protection` parameter: > > ```bash > nebius dns record create \ > --parent-id \ > --name spf-record \ > --relative-name "@" \ > --type txt \ > --data '"v=spf1 -all"' \ > --ttl 3600 \ > --deletion-protection > ``` > > With `--deletion-protection` enabled, you can [delete](https://docs.nebius.com/vpc/dns/manage-records.md#deleting-dns-records-cli) a protected record only by using the `--force` parameter. > [tab] Terraform > > 1. Create the following configuration file: > > ```hcl > resource "nebius_dns_v1_record" "my_record" { > parent_id = "" > name = "" > relative_name = "" > type = "" > data = "" > ttl = > > labels = { > = "" > } > } > ``` > > In the configuration, specify the following parameters: > > * `parent_id`: ID of the DNS zone to create the record in. If you create a record in the same configuration file where the DNS zone configuration is located, refer to this zone as `nebius_dns_v1_zone.my_zone.id`. > > * `name` (optional): Name of the record resource. This is not the domain name of the record. The resource name identifies the record in Nebius AI Cloud and lets you look the record up by name. The name must be unique within the zone. Records that Nebius AI Cloud creates automatically have no resource name. > > * `relative_name`: Zone-relative name of the record, for example, `www` for `www.`. Use `@` to create the record at the zone apex. Use `*` as the leftmost label to create a wildcard record that answers queries for names that do not otherwise exist in the zone. You cannot change the relative name after the record is created. > > * `type`: [Record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types) in uppercase, for example, `A`. You cannot change the type after the record is created. > > * `data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). Each record holds one value. To serve several values for the same name, for example, several IP addresses in a round robin, create several records with the same relative name and type. Their data must differ; creating a record that repeats the relative name, type and data of an existing record fails with an `AlreadyExists` error. > > Write domain names in `data` in fully qualified form with a trailing dot, for example, `service.my.example.`. For TXT records, enclose the values in double quotes and escape them, for example, `data = "\"v=spf1 -all\""`. For SVCB and HTTPS records, specify the target as a domain name. The `.` shorthand for the record's own name is not supported. > > * `ttl` (optional): Time-to-live in seconds, as a number without quotes. How long resolvers cache the record before querying again. Default: `600`. Give records that share a relative name and type the same TTL, because resolvers handle a set with mixed TTLs inconsistently. > > * `labels` (optional): Labels in the `key = "value"` format. > > For all the parameters of the resource, see [nebius\_dns\_v1\_record](https://docs.nebius.com/terraform-provider/reference/resources/dns_v1_record.md) in the Terraform provider reference. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > > To protect a record from accidental deletion, add the `deletion_protection` attribute: > > ```hcl > resource "nebius_dns_v1_record" "my_protected_record" { > parent_id = "" > name = "spf-record" > relative_name = "@" > type = "TXT" > data = "\"v=spf1 -all\"" > ttl = 3600 > > deletion_protection = true > } > ``` > > If you want to delete this record later, set `deletion_protection` to `false`, apply the changes and then [delete the record](https://docs.nebius.com/vpc/dns/manage-records.md#deleting-dns-records-terraform). > [tab] Go SDK > > Run the following code: > > ```go > dnsRecordService := sdk.Services().DNS().V1(). > Record() > dnsRecordOperation, err := dnsRecordService.Create( > ctx, > &dns.CreateRecordRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "", > }, > Spec: &dns.RecordSpec{ > RelativeName: "", > Type: dns.RecordSpec_A, > Data: "", > Ttl: , > }, > }, > ) > if err != nil { > return err > } > if _, err = dnsRecordOperation.Wait(ctx); err != nil { > return err > } > dnsRecordID := dnsRecordOperation.ResourceID() > fmt.Println(dnsRecordOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.ParentId`: ID of the DNS zone to create the record in. > > * `Metadata.Name` *(optional)*: Name of the record resource. This is not the domain name of the record. The resource name identifies the record in Nebius AI Cloud and lets you look the record up by name. The name must be unique within the zone. Records that Nebius AI Cloud creates automatically have no resource name. > > * `Spec.RelativeName`: Zone-relative name of the record, for example, `www` for `www.`. Use `@` to create the record at the zone apex. Use `*` as the leftmost label to create a wildcard record that answers queries for names that do not otherwise exist in the zone. You cannot change the relative name after the record is created. > > * `Spec.Type`: [Record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). The example uses `dns.RecordSpec_A`. You cannot change the type after the record is created. > > * `Spec.Data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). Each record holds one value. To serve several values for the same name, for example, several IP addresses in a round robin, create several records with the same relative name and type. Their data must differ; creating a record that repeats the relative name, type and data of an existing record fails with an `AlreadyExists` error. > > Write domain names in `Spec.Data` in fully qualified form with a trailing dot, for example, `service.my.example.`. For TXT records, enclose the values in double quotes. For SVCB and HTTPS records, specify the target as a domain name. The `.` shorthand for the record's own name is not supported. > > * `Spec.Ttl` *(optional)*: Time-to-live in seconds. How long resolvers cache the record before querying again. Default: `600`. Give records that share a relative name and type the same TTL, because resolvers handle a set with mixed TTLs inconsistently. > > The code saves the record ID to `dnsRecordID`. The record's `Status.EffectiveFqdn` is the absolute domain name that the record resolves at: the relative name joined with the zone domain name. You need this value to [verify the DNS record](https://docs.nebius.com/vpc/dns/manage-records.md#verifying-dns-records). > > To protect a record from accidental deletion, set `Spec.DeletionProtection` to `true`: > > ```go > protectedRecordService := sdk.Services().DNS().V1(). > Record() > protectedRecordOperation, err := protectedRecordService.Create( > ctx, > &dns.CreateRecordRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "spf-record", > }, > Spec: &dns.RecordSpec{ > RelativeName: "@", > Type: dns.RecordSpec_TXT, > Data: "\"v=spf1 -all\"", > Ttl: 3600, > DeletionProtection: true, > }, > }, > ) > if err != nil { > return err > } > if _, err = protectedRecordOperation.Wait(ctx); err != nil { > return err > } > protectedRecordID := protectedRecordOperation.ResourceID() > fmt.Println(protectedRecordOperation) > ``` > > With `Spec.DeletionProtection` enabled, you can [delete](https://docs.nebius.com/vpc/dns/manage-records.md#deleting-dns-records-go-sdk) a protected record only by setting `Force` to `true`. > [tab] Python SDK > > Run the following code: > > ```python > dns_record_service = RecordServiceClient(sdk) > dns_record_operation = await dns_record_service.create( > CreateRecordRequest( > metadata=ResourceMetadata( > parent_id="", > name="", > ), > spec=RecordSpec( > relative_name="", > type=RecordSpec.RecordType.A, > data="", > ttl=, > ), > ), > ) > await dns_record_operation.wait() > dns_record_id = dns_record_operation.resource_id > print(dns_record_operation) > ``` > > In the code, set the following parameters: > > * `parent_id`: ID of the DNS zone to create the record in. > > * `name` *(optional)*: Name of the record resource. This is not the domain name of the record. The resource name identifies the record in Nebius AI Cloud and lets you look the record up by name. The name must be unique within the zone. Records that Nebius AI Cloud creates automatically have no resource name. > > * `relative_name`: Zone-relative name of the record, for example, `www` for `www.`. Use `@` to create the record at the zone apex. Use `*` as the leftmost label to create a wildcard record that answers queries for names that do not otherwise exist in the zone. You cannot change the relative name after the record is created. > > * `type`: [Record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). The example uses `RecordSpec.RecordType.A`. You cannot change the type after the record is created. > > * `data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). Each record holds one value. To serve several values for the same name, for example, several IP addresses in a round robin, create several records with the same relative name and type. Their data must differ; creating a record that repeats the relative name, type and data of an existing record fails with an `AlreadyExists` error. > > Write domain names in `data` in fully qualified form with a trailing dot, for example, `service.my.example.`. For TXT records, enclose the values in double quotes. For SVCB and HTTPS records, specify the target as a domain name. The `.` shorthand for the record's own name is not supported. > > * `ttl` *(optional)*: Time-to-live in seconds. How long resolvers cache the record before querying again. Default: `600`. Give records that share a relative name and type the same TTL, because resolvers handle a set with mixed TTLs inconsistently. > > The code saves the record ID to `dns_record_id`. The record's `status.effective_fqdn` is the absolute domain name that the record resolves at: the relative name joined with the zone domain name. You need this value to [verify the DNS record](https://docs.nebius.com/vpc/dns/manage-records.md#verifying-dns-records). > > To protect a record from accidental deletion, set `deletion_protection` to `True`: > > ```python > protected_record_service = RecordServiceClient(sdk) > protected_record_operation = await protected_record_service.create( > CreateRecordRequest( > metadata=ResourceMetadata( > parent_id="", > name="spf-record", > ), > spec=RecordSpec( > relative_name="@", > type=RecordSpec.RecordType.TXT, > data="\"v=spf1 -all\"", > ttl=3600, > deletion_protection=True, > ), > ), > ) > await protected_record_operation.wait() > protected_record_id = protected_record_operation.resource_id > print(protected_record_operation) > ``` > > With `deletion_protection` enabled, you can [delete](https://docs.nebius.com/vpc/dns/manage-records.md#deleting-dns-records-python-sdk) a protected record only by setting `force` to `True`. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const dnsRecordService = new RecordService(sdk); > const dnsRecordOperation = await dnsRecordService.create( > CreateRecordRequest.create({ > metadata: { > parentId: "", > name: "", > }, > spec: { > relativeName: "", > type: RecordSpec_RecordType.A, > data: "", > ttl: , > }, > }), > ).result; > await dnsRecordOperation.wait(); > const dnsRecordId = dnsRecordOperation.resourceId(); > console.log(dnsRecordOperation); > ``` > > In the code, set the following parameters: > > * `parentId`: ID of the DNS zone to create the record in. > > * `name` *(optional)*: Name of the record resource. This is not the domain name of the record. The resource name identifies the record in Nebius AI Cloud and lets you look the record up by name. The name must be unique within the zone. Records that Nebius AI Cloud creates automatically have no resource name. > > * `relativeName`: Zone-relative name of the record, for example, `www` for `www.`. Use `@` to create the record at the zone apex. Use `*` as the leftmost label to create a wildcard record that answers queries for names that do not otherwise exist in the zone. You cannot change the relative name after the record is created. > > * `type`: [Record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). The example uses `RecordSpec_RecordType.A`. You cannot change the type after the record is created. > > * `data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). Each record holds one value. To serve several values for the same name, for example, several IP addresses in a round robin, create several records with the same relative name and type. Their data must differ; creating a record that repeats the relative name, type and data of an existing record fails with an `AlreadyExists` error. > > Write domain names in `data` in fully qualified form with a trailing dot, for example, `service.my.example.`. For TXT records, enclose the values in double quotes. For SVCB and HTTPS records, specify the target as a domain name. The `.` shorthand for the record's own name is not supported. > > * `ttl` *(optional)*: Time-to-live in seconds. How long resolvers cache the record before querying again. Default: `600`. Give records that share a relative name and type the same TTL, because resolvers handle a set with mixed TTLs inconsistently. > > The code saves the record ID to `dnsRecordId`. The record's `status.effectiveFqdn` is the absolute domain name that the record resolves at: the relative name joined with the zone domain name. You need this value to [verify the DNS record](https://docs.nebius.com/vpc/dns/manage-records.md#verifying-dns-records). > > To protect a record from accidental deletion, set `deletionProtection` to `true`: > > ```ts > const protectedRecordService = new RecordService(sdk); > const protectedRecordOperation = await protectedRecordService.create( > CreateRecordRequest.create({ > metadata: { > parentId: "", > name: "spf-record", > }, > spec: { > relativeName: "@", > type: RecordSpec_RecordType.TXT, > data: "\"v=spf1 -all\"", > ttl: 3600, > deletionProtection: true, > }, > }), > ).result; > await protectedRecordOperation.wait(); > const protectedRecordId = protectedRecordOperation.resourceId(); > console.log(protectedRecordOperation); > ``` > > With `deletionProtection` enabled, you can [delete](https://docs.nebius.com/vpc/dns/manage-records.md#deleting-dns-records-javascript-sdk) a protected record only by setting `force` to `true`. ## Verifying DNS records DNS records resolve only from the [DNS zone's network](https://docs.nebius.com/vpc/dns/overview.md#dns-zones). To verify a record, query its fully qualified domain name (FQDN) from a virtual machine (VM) attached to one of the network's subnets. > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > 2. On the **DNS** tab, find the zone that contains the record you want to verify. The **Network** column shows the zone's network. > 3. Click the network name to view its subnets. > 4. Return to the **DNS** tab and select the DNS zone. > 5. Find the record and click next to its FQDN. > 6. [Connect to a VM](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh) attached to one of the network's subnets. > 7. Query the copied FQDN from the VM, for example: > > ```bash > dig www.my.example. > ``` > [tab] CLI > > To verify a record in a custom DNS zone, [connect to a VM](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh-cli) attached to a subnet of the zone's network and query the FQDN from the record's `status.effective_fqdn`: > > ```bash > dig www.my.example. > ``` The VM resolves the name through the network resolver at `169.254.169.2` without additional configuration. The output contains the record data in the answer section: ```bash ;; ANSWER SECTION: www.my.example. 600 IN A 192.0.2.10 ``` A newly created record becomes visible within a minute. If you queried the name before creating the record, the resolver keeps returning the cached "record not found" response until the zone's [negative caching TTL](https://docs.nebius.com/vpc/dns/manage-zones.md#creating-dns-zones) expires, which takes 15 minutes by default. ## Updating DNS records > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > 2. On the **DNS** tab, select the zone that contains the record you want to update. > 3. Find the record and click . > 4. Change the record data, **TTL**, or **Delete protection**. > 5. Click **Save changes**. > [tab] CLI > > 1. Get the ID of the record that you want to update. List the records in the zone: > > ```bash > nebius dns record list \ > --parent-id > ``` > > Find the record you want to update and take its ID from the `.metadata.id` parameter. To list every record in one response instead of the first 100, add the `--all` parameter. > > If you set a resource name for the record when you created it, you can look it up by that name instead: > > ```bash > nebius dns record get-by-name \ > --parent-id \ > --name > ``` > > Here `--name` is the record's resource name from `metadata.name`, not its domain name. > > 2. Update the record: > > ```bash > nebius dns record update \ > --data \ > --ttl > ``` > > Specify the record ID you got in the previous step as ``. In the command, you can specify the following parameters to update them: > > * `--data` (optional): Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). > > * `--ttl` (optional): Record TTL in seconds. > > * `--name` (optional): Name of the record resource. > > * `--deletion-protection` (optional): Protection from the record deletion. When enabled, you can delete a protected record only by using the `--force` parameter. > > Set to `false` to remove the protection. > > * `--labels` (optional): Replace all labels with the specified labels, in the `key=value` format. > > * `--labels-add` (optional): Add labels, in the `key=value` format, without replacing the existing labels. > > * `--labels-remove` (optional): Remove existing labels by key. > > * `--resource-version` (optional): Current version of the record from `metadata.resource_version`. If the record changed and has a different version, the command fails. > [tab] Terraform > > 1. In the configuration file, update the `nebius_dns_v1_record` resource: > > ```hcl > resource "nebius_dns_v1_record" "my_record" { > name = "" > data = "" > ttl = > > labels = { > = "" > } > > deletion_protection = > > # ... > } > ``` > > You can update the following parameters: > > * `name`: Name of the record resource. > * `data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). > * `ttl`: Record TTL in seconds. > * `labels`: Labels in the `key = "value"` format. > * `deletion_protection`: Protection from the record deletion. When enabled, you cannot delete the record. > > Set to `false` to remove the protection. > > 2. Check that the configuration is correct: > ```bash > terraform validate > ``` > > 3. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the record that you want to update. List the records in the zone with `ParentId` set to the zone ID: > > ```go > dnsRecordsService := sdk.Services().DNS().V1(). > Record() > dnsRecordsResponse, err := dnsRecordsService.List( > ctx, > &dns.ListRecordsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(dnsRecordsResponse) > ``` > > Find the record you want to update in `Items` and take its ID from `Metadata.Id`. > > If you set a resource name for the record when you created it, you can look it up by that name instead: > > ```go > namedRecordService := sdk.Services().DNS().V1(). > Record() > namedRecord, err := namedRecordService.GetByName( > ctx, > &common.GetByNameRequest{ > ParentId: "", > Name: "", > }, > ) > if err != nil { > return err > } > fmt.Println(namedRecord) > ``` > > Here `Name` is the record's resource name from `Metadata.Name`, not its domain name. > > 2. Update the record: > > ```go > updatedRecordService := sdk.Services().DNS().V1(). > Record() > updatedRecord, err := updatedRecordService.Get( > ctx, > &dns.GetRecordRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > updatedRecord.Spec.Data = "" > updatedRecord.Spec.Ttl = > recordUpdateOperation, err := updatedRecordService.Update( > ctx, > &dns.UpdateRecordRequest{ > Metadata: updatedRecord.Metadata, > Spec: updatedRecord.Spec, > }, > ) > if err != nil { > return err > } > if _, err = recordUpdateOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the record ID you got in the previous step. The code gets the record and updates the following parameters: > > * `Spec.Data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). > * `Spec.Ttl`: Record TTL in seconds. > > To change other settings, such as `Metadata.Name`, `Metadata.Labels` or `Spec.DeletionProtection`, set them on `updatedRecord` before the update in the same way. Set `Spec.DeletionProtection` to `false` to remove the protection. > [tab] Python SDK > > 1. Get the ID of the record that you want to update. List the records in the zone with `parent_id` set to the zone ID: > > ```python > dns_records_service = RecordServiceClient(sdk) > dns_records_response = await dns_records_service.list( > ListRecordsRequest( > parent_id="", > ), > ) > print(dns_records_response) > ``` > > Find the record you want to update in `items` and take its ID from `metadata.id`. > > If you set a resource name for the record when you created it, you can look it up by that name instead: > > ```python > named_record_service = RecordServiceClient(sdk) > named_record = await named_record_service.get_by_name( > GetByNameRequest( > parent_id="", > name="", > ), > ) > print(named_record) > ``` > > Here `name` is the record's resource name from `metadata.name`, not its domain name. > > 2. Update the record: > > ```python > updated_record_service = RecordServiceClient(sdk) > updated_record = await updated_record_service.get( > GetRecordRequest( > id="", > ), > ) > updated_record.spec.data = "" > updated_record.spec.ttl = > record_update_operation = await updated_record_service.update( > UpdateRecordRequest( > metadata=updated_record.metadata, > spec=updated_record.spec, > ), > ) > await record_update_operation.wait() > ``` > > Set `id` to the record ID you got in the previous step. The code gets the record and updates the following parameters: > > * `spec.data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). > * `spec.ttl`: Record TTL in seconds. > > To change other settings, such as `metadata.name`, `metadata.labels` or `spec.deletion_protection`, set them on `updated_record` before the update in the same way. Set `spec.deletion_protection` to `False` to remove the protection. > [tab] JavaScript SDK > > 1. Get the ID of the record that you want to update. List the records in the zone with `parentId` set to the zone ID: > > ```ts > const dnsRecordsService = new RecordService(sdk); > const dnsRecordsResponse = await dnsRecordsService.list( > ListRecordsRequest.create({ > parentId: "", > }), > ).result; > console.log(dnsRecordsResponse); > ``` > > Find the record you want to update in `items` and take its ID from `metadata.id`. > > If you set a resource name for the record when you created it, you can look it up by that name instead: > > ```ts > const namedRecordService = new RecordService(sdk); > const namedRecord = await namedRecordService.getByName( > GetByNameRequest.create({ > parentId: "", > name: "", > }), > ).result; > console.log(namedRecord); > ``` > > Here `name` is the record's resource name from `metadata.name`, not its domain name. > > 2. Update the record: > > ```ts > const updatedRecordService = new RecordService(sdk); > const updatedRecord = await updatedRecordService.get( > GetRecordRequest.create({ > id: "", > }), > ).result; > updatedRecord.spec.data = ""; > updatedRecord.spec.ttl = ; > const recordUpdateOperation = await updatedRecordService.update( > UpdateRecordRequest.create({ > metadata: updatedRecord.metadata, > spec: updatedRecord.spec, > }), > ).result; > await recordUpdateOperation.wait(); > ``` > > Set `id` to the record ID you got in the previous step. The code gets the record and updates the following parameters: > > * `spec.data`: Record data in the format that corresponds to the [record type](https://docs.nebius.com/vpc/dns/manage-records.md#record-types). > * `spec.ttl`: Record TTL in seconds. > > To change other settings, such as `metadata.name`, `metadata.labels` or `spec.deletionProtection`, set them on `updatedRecord` before the update in the same way. Set `spec.deletionProtection` to `false` to remove the protection. The relative name and type of a record cannot be updated. To move a record to a different name or change its type, delete the record and create a new one. An updated record becomes visible within a minute, and resolvers can serve the previous value until the record's TTL expires. ## Deleting DNS records > [tab] Web console > > 1. In the sidebar, go to **Networking** → **Virtual Networks**. > > 2. On the **DNS** tab, select the zone that contains the record you want to delete. > > 3. If the record has deletion protection: > > 1. Next to the record, click . > 2. Disable **Delete protection** and click **Save changes**. > > 4. Find the record and click → **Delete**. > > 5. Confirm the deletion. > [tab] CLI > > 1. Get the ID of the record that you want to delete. List the records in the zone: > > ```bash > nebius dns record list \ > --parent-id > ``` > > Find the record you want to delete and take its ID from the `.metadata.id` parameter. To list every record in one response instead of the first 100, add the `--all` parameter. > > 2. Delete the record: > > ```bash > nebius dns record delete > ``` > > 3. If the record is protected from deletion, the command fails with a `FailedPrecondition` error. To delete a protected record, add the `--force` parameter: > > ```bash > nebius dns record delete \ > --force > ``` > [tab] Terraform > > 1. If the record is protected from deletion, set `deletion_protection` to `false` in the `nebius_dns_v1_record` resource. Then, apply the changes. Otherwise, `terraform apply` fails with the `FailedPrecondition` error. > 2. Remove the corresponding `nebius_dns_v1_record` resource from the configuration file. > 3. Check that the configuration is correct: > ```bash > terraform validate > ``` > 4. Apply the changes: > ```bash > terraform apply > ``` > [tab] Go SDK > > 1. Get the ID of the record that you want to delete. List the records in the zone with `ParentId` set to the zone ID: > > ```go > dnsRecordsService := sdk.Services().DNS().V1(). > Record() > dnsRecordsResponse, err := dnsRecordsService.List( > ctx, > &dns.ListRecordsRequest{ > ParentId: "", > }, > ) > if err != nil { > return err > } > fmt.Println(dnsRecordsResponse) > ``` > > Find the record you want to delete in `Items` and take its ID from `Metadata.Id`. > > 2. Delete the record. Set `Id` to the record ID: > > ```go > deletedRecordService := sdk.Services().DNS().V1(). > Record() > deletedRecordOperation, err := deletedRecordService.Delete( > ctx, > &dns.DeleteRecordRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deletedRecordOperation.Wait(ctx); err != nil { > return err > } > ``` > > 3. If the record is protected from deletion, the request fails with a `FailedPrecondition` error. To delete a protected record, set `Force` to `true`: > > ```go > forcedRecordService := sdk.Services().DNS().V1(). > Record() > forcedRecordOperation, err := forcedRecordService.Delete( > ctx, > &dns.DeleteRecordRequest{ > Id: "", > Force: true, > }, > ) > if err != nil { > return err > } > if _, err = forcedRecordOperation.Wait(ctx); err != nil { > return err > } > ``` > [tab] Python SDK > > 1. Get the ID of the record that you want to delete. List the records in the zone with `parent_id` set to the zone ID: > > ```python > dns_records_service = RecordServiceClient(sdk) > dns_records_response = await dns_records_service.list( > ListRecordsRequest( > parent_id="", > ), > ) > print(dns_records_response) > ``` > > Find the record you want to delete in `items` and take its ID from `metadata.id`. > > 2. Delete the record. Set `id` to the record ID: > > ```python > deleted_record_service = RecordServiceClient(sdk) > deleted_record_operation = await deleted_record_service.delete( > DeleteRecordRequest( > id="", > ), > ) > await deleted_record_operation.wait() > ``` > > 3. If the record is protected from deletion, the request fails with a `FailedPrecondition` error. To delete a protected record, set `force` to `True`: > > ```python > forced_record_service = RecordServiceClient(sdk) > forced_record_operation = await forced_record_service.delete( > DeleteRecordRequest( > id="", > force=True, > ), > ) > await forced_record_operation.wait() > ``` > [tab] JavaScript SDK > > 1. Get the ID of the record that you want to delete. List the records in the zone with `parentId` set to the zone ID: > > ```ts > const dnsRecordsService = new RecordService(sdk); > const dnsRecordsResponse = await dnsRecordsService.list( > ListRecordsRequest.create({ > parentId: "", > }), > ).result; > console.log(dnsRecordsResponse); > ``` > > Find the record you want to delete in `items` and take its ID from `metadata.id`. > > 2. Delete the record. Set `id` to the record ID: > > ```ts > const deletedRecordService = new RecordService(sdk); > const deletedRecordOperation = await deletedRecordService.delete( > DeleteRecordRequest.create({ > id: "", > }), > ).result; > await deletedRecordOperation.wait(); > ``` > > 3. If the record is protected from deletion, the request fails with a `FailedPrecondition` error. To delete a protected record, set `force` to `true`: > > ```ts > const forcedRecordService = new RecordService(sdk); > const forcedRecordOperation = await forcedRecordService.delete( > DeleteRecordRequest.create({ > id: "", > force: true, > }), > ).result; > await forcedRecordOperation.wait(); > ``` > [!NOTE] > > You cannot delete the zone's SOA record or the NS record at the zone apex. These records are deleted when you [delete the zone](https://docs.nebius.com/vpc/dns/manage-zones.md#deleting-dns-zones). # DNS quotas and constraints Source: https://docs.nebius.com/vpc/dns/resources/quotas-limits.md ## Quotas DNS has a quota on the number of [DNS zones](https://docs.nebius.com/vpc/dns/overview.md). System-managed zones, for example, `.compute.internal.`, count toward this quota. For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). | Quota name | Default value per [region](https://docs.nebius.com/overview/regions.md) | | - | - | | DNS zones | 100 | ## Constraints [DNS zones](https://docs.nebius.com/vpc/dns/manage-zones.md) and [DNS records](https://docs.nebius.com/vpc/dns/manage-records.md) have the following technical constraints: | Constraint | Value | | - | - | | Records in a zone | 1000 | | Records with the same relative name and type in a zone | 20 | | Characters in a zone domain name, including the trailing dot | 252 | | Characters in a record relative name | 252 | To raise the number of records in a specific zone, or the number of records with the same relative name and type in it, [contact support](https://console.nebius.com/support). ### Zone domain name restrictions Give a zone a domain name of at least two labels, for example, `my.example.`. Single-label names, such as `example.`, aren't available. Nebius AI Cloud also reserves the domain names that it owns: * The `internal.` domain * `ns.internal.`, `compute.internal.` and `nebius.internal.` and all of their subdomains * Domain names used for internal checks, such as `example.invalid.` If you use one of these domain names, creating the zone fails with a `PermissionDenied` error that no general role lifts. # Security groups in Nebius AI Cloud Source: https://docs.nebius.com/vpc/security-groups/overview.md *Security groups* in Nebius AI Cloud serve as a firewall for your [Compute](https://docs.nebius.com/compute/index.md) virtual machines (VMs), controlling ingress and egress traffic at the packet level. Security groups consist of *security rules*; each security rule describes whether ingress or egress traffic with certain parameters (source, destination, protocol) should be allowed or denied. For a security group to apply to a VM, you need to add a VM's network interface to the security group. Security groups and security rules are subject to [quotas and constraints](https://docs.nebius.com/vpc/resources/quotas-limits.md). ## Security groups and security rules Each security group is associated with a [network](https://docs.nebius.com/vpc/overview.md#network) and can only apply to VMs in this network. The network ID is specified in the `.spec.network_id` parameter of the security group's specification: ```yaml metadata: id: vpcsecuritygroup-*** parent_id: project-*** spec: network_id: vpcnetwork-*** ``` Security rules are child resources of a security group. Here is an example of a security rule that denies TCP egress traffic to the `192.0.2.0/24` CIDR block on port 8888: ```yaml metadata: id: vpcsecurityrule-*** parent_id: vpcsecuritygroup-*** spec: access: DENY egress: destination_cidrs: - 192.0.2.0/24 destination_ports: - 8888 protocol: TCP type: STATELESS priority: 500 ``` > [accordion] Description of the parameters > > * `.metadata.id`: ID of the security rule. > > * `.metadata.parent_id`: ID of the security group. The parent resource of a security rule is a security group; the parent resource of a security group is a [project](https://docs.nebius.com/iam/overview.md#projects). > > * `.spec.access`: Whether to `ALLOW` or `DENY` the ingress or egress traffic defined in the security rule. > > * `.spec.egress`: Source and destination of the egress traffic that should match the rule. Each security rule must have either `.spec.egress` or `.spec.ingress` (for ingress traffic). > > * `.spec.egress.destination_cidrs`, `.spec.egress.destination_ports`: Lists of up to eight CIDR blocks and eight ports that the traffic goes to. Both egress and ingress rules support these parameters as well as `source_cidrs` and `source_ports`. > > You can also specify a security group as the source in an ingress security rule (`.spec.ingress.source_security_group_id`) or as the destination in an egress security rule (`.spec.egress.destination_security_group_id`). > > * `.spec.protocol`: Networking protocol to which the rule applies. Supported values are `TCP`, `UDP`, `ICMP` and `ANY`. > > > [!NOTE] > > > > Port filtering applies to `TCP` and `UDP` only. `ANY` and `ICMP` don't support port filtering. > > * `.spec.type`: Rule type. Supported values are `STATEFUL` (connection tracking is enabled; default) and `STATELESS` (connection tracking is disabled). > > * `.spec.priority`: Priority of the rule. 1 is the highest priority, 1000 is the lowest. For instructions, see [Managing security groups and security rules](https://docs.nebius.com/vpc/security-groups/manage.md). ### Ignored CIDR blocks Traffic to and from `169.254.0.0/16` (`169.254.0.0`–`169.254.255.255`) isn't evaluated by security groups. These IP addresses are reserved for internal Nebius use. ### Security rule types: stateful and stateless A security rule can be stateful or stateless, which means it has connection tracking enabled or disabled: * *Stateful* security rules track connections in which the matching traffic is sent and automatically allow the response traffic within the same connection, even if it doesn't match any other rule. For example, if a VM sends a request that a stateful security rule in the VM's security group allows, the response to this request is allowed by the same rule. * *Stateless* security rules don't track connections like stateful security rules do. For your VM to be able to send or receive a response to ingress or egress traffic that a stateless security rule allows, you need to create a separate security rule. ### Security rule priorities Each security rule has a *priority* from 1 to 1000. When determining how to apply security rules to a traffic packet, Nebius AI Cloud looks for a matching security rule, starting from security rules with lower priority values — that is, going from 1 to 1000. Once a match is found, the lookup stops and the matching rule is applied. If no match is found, the traffic is denied. This means that adding a VM's network interface to an empty security group blocks all traffic to and from this network interface. If two or more security rules have the same priority, security rules that deny traffic take precedence over security rules that allow traffic. The default priority of a security rule is 500. Setting the priority at 0 is the same as the default value. If you add a network interface of a VM to multiple security groups, all security rules from these security groups are combined into one list that is then looked up by *effective priority*. Effective priority is automatically calculated for each security rule from its priority and returned in its `.status.effective_priority` parameter: ```yaml metadata: id: vpcsecurityrule-*** status: effective_priority: 3001 ``` ### Security groups as sources or destinations in security rules You can specify a security group as the source for an ingress security rule or as the destination for an egress security rule. For example: ```yaml metadata: id: vpcsecurityrule-*** spec: access: DENY egress: destination_security_group_id: vpcsecuritygroup-*** priority: 500 protocol: TCP type: STATELESS ``` The security group specified in a security rule and the security group that contains the security rule must be associated with the same network. You can use the source/destination security group together with the source/destination CIDR blocks and ports in a security rule: ```yaml metadata: id: vpcsecurityrule-*** spec: egress: destination_cidrs: - 192.0.2.0/24 destination_ports: - 8888 destination_security_group_id: vpcsecuritygroup-*** priority: 500 protocol: TCP type: STATELESS ``` In this case, the security rule applies to VMs' network interfaces that have the specified security group *and* an IP address from one of the specified CIDR blocks assigned to them. ## Default security groups Each network has a *default security group* that all VMs in this network are implicitly added to by default. It allows all ingress and egress traffic. > [accordion] Security rules in a default security group > > ```yaml > items: > - metadata: > id: vpcsecurityrule-*** > parent_id: vpcsecuritygroup-*** > spec: > access: ALLOW > ingress: {} > priority: 500 > protocol: ANY > type: STATELESS > - metadata: > id: vpcsecurityrule-*** > parent_id: vpcsecuritygroup-*** > spec: > access: ALLOW > egress: {} > priority: 500 > protocol: ANY > type: STATELESS > ``` You can't change or delete default security groups. # Managing security groups and security rules Source: https://docs.nebius.com/vpc/security-groups/manage.md To set up a firewall for your [Compute](https://docs.nebius.com/compute/index.md) virtual machines (VMs), you can create [security groups](https://docs.nebius.com/vpc/security-groups/overview.md) with security rules that control ingress and egress traffic at the packet level, and then add the VMs' network interfaces to the security groups. ## Prerequisites > [tab] Web console > > 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 2. [Get the ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-web-console) where you want to manage security groups and security rules. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Install [jq](https://jqlang.github.io/jq/) to modify the VM specification returned by the Nebius AI Cloud CLI when you [add a VM to a security group](https://docs.nebius.com/vpc/security-groups/manage.md#adding-vms-to-security-groups-cli): > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > > 3. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > 4. [Get the ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli) where you want to manage security groups and security rules. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Get the ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-go-sdk) where you want to manage security groups and security rules. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Get the ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-python-sdk) where you want to manage security groups and security rules. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > 3. [Get the ID of the network](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-javascript-sdk) where you want to manage security groups and security rules. ## Creating security groups > [tab] Web console > > To create a security group: > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. Open the network where you want to create a security group. > 3. Click **Create** and select **Security group**. > 4. In the window that opens, enter the security group name and click **Create security group**. > [tab] CLI > > To create a security group, run `nebius vpc security-group create`: > > ```bash > nebius vpc security-group create \ > --name \ > --network-id > ``` > > The command contains the following parameters: > > * `--name`: Name of the security group. > * `--network-id`: ID of the network for the security group. You can only add VMs within this network to a security group. For instructions, see [How to get a network ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-network-id-cli). > > For more details, see the [command reference](https://docs.nebius.com/cli/reference/vpc/security-group/create.md). > [tab] Go SDK > > Run the following code: > > ```go > securityGroupService := sdk.Services().VPC().V1(). > SecurityGroup() > securityGroupOperation, err := securityGroupService.Create( > ctx, > &vpc.CreateSecurityGroupRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.SecurityGroupSpec{ > NetworkId: "", > }, > }, > ) > if err != nil { > return err > } > if _, err = securityGroupOperation.Wait(ctx); err != nil { > return err > } > securityGroupID := securityGroupOperation.ResourceID() > fmt.Println(securityGroupOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the security group. > * `Metadata.ParentId`: ID of the project. > * `Spec.NetworkId`: ID of the network for the security group. You can only add VMs within this network to a security group. > > The code saves the security group ID to `securityGroupID`. > [tab] Python SDK > > Run the following code: > > ```python > security_group_service = SecurityGroupServiceClient(sdk) > security_group_operation = await security_group_service.create( > CreateSecurityGroupRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=SecurityGroupSpec( > network_id="", > ), > ), > ) > await security_group_operation.wait() > security_group_id = security_group_operation.resource_id > print(security_group_operation) > ``` > > In the code, set the following parameters: > > * `name`: Name of the security group. > * `parent_id`: ID of the project. > * `network_id`: ID of the network for the security group. You can only add VMs within this network to a security group. > > The code saves the security group ID to `security_group_id`. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const securityGroupService = new SecurityGroupService(sdk); > const securityGroupOperation = await securityGroupService.create( > CreateSecurityGroupRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > networkId: "", > }, > }), > ).result; > await securityGroupOperation.wait(); > const securityGroupId = securityGroupOperation.resourceId(); > console.log(securityGroupOperation); > ``` > > In the code, set the following parameters: > > * `name`: Name of the security group. > * `parentId`: ID of the project. > * `networkId`: ID of the network for the security group. You can only add VMs within this network to a security group. > > The code saves the security group ID to `securityGroupId`. Security groups are created empty. After creating a security group, [create security rules in it](https://docs.nebius.com/vpc/security-groups/manage.md#adding-security-rules-to-security-groups) and then [add VMs to it](https://docs.nebius.com/vpc/security-groups/manage.md#adding-vms-to-security-groups). ## Adding security rules to security groups > [tab] Web console > > To add a rule to an existing security group: > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > > 2. Switch to the **Security groups** tab. > > 3. Open the security group that you want to add a rule to and click  **Create security rule**. > > 4. In the window that opens, enter the rule name and specify the following parameters: > > * **Direction**: **Ingress** or **Egress**. > > * **Action**: **Allow** or **Deny**. > > * **Source/Destination security group**: Security group as the source (if **Direction** is set to **Ingress**) or as the destination (if **Direction** is set to **Egress**). > > * **Source/Destination CIDR blocks**: List of up to eight CIDR blocks that define the range of IP addresses for the source (if **Direction** is set to **Ingress**) or the destination traffic (if **Direction** is set to **Egress**). > > If you specify both the security group and CIDR blocks, the security rule applies to the VMs' network interfaces that are added to the specified security group *and* are assigned an IP address from one of the specified CIDR blocks. For more information, see [Security groups as sources or destinations in security rules](https://docs.nebius.com/vpc/security-groups/overview.md#security-groups-as-sources-or-destinations-in-security-rules). > > Traffic to and from `169.254.0.0/16` (`169.254.0.0`–`169.254.255.255`) isn't evaluated by security groups. These IP addresses are reserved for internal Nebius use. > > * **Destination ports**: List of up to eight ports to which the rule applies. > > * **Protocol**: `TCP`, `UDP`, `ICMP` or `Any`. > > > [!NOTE] > > > > Only `TCP` and `UDP` support port filtering. Selecting `Any` or `ICMP` hides the **Ports** section. > > 5. (Optional) Under **Advanced settings**, specify: > > * **Type**: **Stateful** or **Stateless**. If a rule that allows traffic is stateful, it also allows the response traffic within the same connection. For more information, see [Security rule types: stateful and stateless](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-types-stateful-and-stateless). > * **Priority**: From 1 to 1000. Rules with lower priority are applied first; if priorities are equal, the deny rule wins. For more information, see [Security rule priorities](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-priorities). > > 6. Click **Create rule**. > [tab] CLI > > To add a security rule to a security group, run `nebius vpc security-rule create`. For example, to create an egress security rule, run the following command: > > ```bash > nebius vpc security-rule create \ > --parent-id \ > --name \ > --access \ > --egress-destination-cidrs ",,..." \ > --egress-destination-ports ",,..." \ > --egress-destination-security-group-id \ > --protocol \ > --type \ > --priority > ``` > > To get a security group ID, run `nebius vpc security-group list`. The output contains the ID in the `.metadata.id` parameter. > > Traffic to and from `169.254.0.0/16` (`169.254.0.0`–`169.254.255.255`) isn't evaluated by security groups. These IP addresses are reserved for internal Nebius use. > > For more details, see: > > * [Command reference](https://docs.nebius.com/cli/reference/vpc/security-rule/create.md) > * `--egress-destination-security-group-id` (and `--ingress-source-security-group-id`): [Security groups as sources or destinations in security rules](https://docs.nebius.com/vpc/security-groups/overview.md#security-groups-as-sources-or-destinations-in-security-rules) > * `--type`: [Security rule types: stateful and stateless](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-types-stateful-and-stateless) > * `--priority`: [Security rule priorities](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-priorities) > [tab] Go SDK > > For example, to create an egress security rule, run the following code: > > ```go > ruleCIDRs := strings.Split(",,...", ",") > var rulePorts []int32 > for _, port := range strings.Split(",,...", ",") { > value, err := strconv.ParseInt(port, 10, 32) > if err != nil { > return err > } > rulePorts = append(rulePorts, int32(value)) > } > securityRuleService := sdk.Services().VPC().V1(). > SecurityRule() > securityRuleOperation, err := securityRuleService.Create( > ctx, > &vpc.CreateSecurityRuleRequest{ > Metadata: &common.ResourceMetadata{ > Name: "", > ParentId: "", > }, > Spec: &vpc.SecurityRuleSpec{ > Access: vpc.RuleAccessAction_ALLOW, > Protocol: vpc.RuleProtocol_TCP, > Type: vpc.RuleType_STATEFUL, > Priority: , > Match: &vpc.SecurityRuleSpec_Egress{ > Egress: &vpc.RuleEgress{ > DestinationCidrs: ruleCIDRs, > DestinationPorts: rulePorts, > DestinationSecurityGroupId: "", > }, > }, > }, > }, > ) > if err != nil { > return err > } > if _, err = securityRuleOperation.Wait(ctx); err != nil { > return err > } > securityRuleID := securityRuleOperation.ResourceID() > fmt.Println(securityRuleOperation) > ``` > > In the code, set the following parameters: > > * `Metadata.Name`: Name of the security rule. > * `Metadata.ParentId`: ID of the security group. > * `Spec.Access`: Whether the rule allows or denies traffic. The example uses `vpc.RuleAccessAction_ALLOW`. > * `Spec.Protocol`: Protocol of the traffic. The example uses `vpc.RuleProtocol_TCP`. > * `Spec.Type`: [Security rule type](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-types-stateful-and-stateless). The example uses `vpc.RuleType_STATEFUL`. > * `Spec.Priority`: [Security rule priority](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-priorities), from `1` to `1000`. > * `DestinationCidrs` and `DestinationPorts` under `Spec.Match`: Destination CIDR blocks and ports. The code builds them from the comma-separated lists in `ruleCIDRs` and `rulePorts`. > * `DestinationSecurityGroupId` under `Spec.Match`: ID of the [destination security group](https://docs.nebius.com/vpc/security-groups/overview.md#security-groups-as-sources-or-destinations-in-security-rules). > > The code saves the security rule ID to `securityRuleID`. > [tab] Python SDK > > For example, to create an egress security rule, run the following code: > > ```python > rule_cidrs = ",,...".split(",") > rule_ports = [ > int(port) for port in ",,...".split(",") > ] > security_rule_service = SecurityRuleServiceClient(sdk) > security_rule_operation = await security_rule_service.create( > CreateSecurityRuleRequest( > metadata=ResourceMetadata( > name="", > parent_id="", > ), > spec=SecurityRuleSpec( > access=RuleAccessAction.ALLOW, > protocol=RuleProtocol.TCP, > type=RuleType.STATEFUL, > priority=, > egress=RuleEgress( > destination_cidrs=rule_cidrs, > destination_ports=rule_ports, > destination_security_group_id="", > ), > ), > ), > ) > await security_rule_operation.wait() > security_rule_id = security_rule_operation.resource_id > print(security_rule_operation) > ``` > > In the code, set the following parameters: > > * `name`: Name of the security rule. > * `parent_id`: ID of the security group. > * `access`: Whether the rule allows or denies traffic. The example uses `RuleAccessAction.ALLOW`. > * `protocol`: Protocol of the traffic. The example uses `RuleProtocol.TCP`. > * `type`: [Security rule type](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-types-stateful-and-stateless). The example uses `RuleType.STATEFUL`. > * `priority`: [Security rule priority](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-priorities), from `1` to `1000`. > * `egress.destination_cidrs` and `egress.destination_ports`: Destination CIDR blocks and ports. The code builds them from the comma-separated lists in `rule_cidrs` and `rule_ports`. > * `egress.destination_security_group_id`: ID of the [destination security group](https://docs.nebius.com/vpc/security-groups/overview.md#security-groups-as-sources-or-destinations-in-security-rules). > > The code saves the security rule ID to `security_rule_id`. > [tab] JavaScript SDK > > For example, to create an egress security rule, run the following code: > > ```ts > const ruleCidrs = ",,...".split(","); > const rulePorts = ",,...".split(",").map(Number); > const securityRuleService = new SecurityRuleService(sdk); > const securityRuleOperation = await securityRuleService.create( > CreateSecurityRuleRequest.create({ > metadata: { > name: "", > parentId: "", > }, > spec: { > access: RuleAccessAction.ALLOW, > protocol: RuleProtocol.TCP, > type: RuleType.STATEFUL, > priority: , > match: { > "$case": "egress", > "egress": { > destinationCidrs: ruleCidrs, > destinationPorts: rulePorts, > destinationSecurityGroupId: "", > }, > }, > }, > }), > ).result; > await securityRuleOperation.wait(); > const securityRuleId = securityRuleOperation.resourceId(); > console.log(securityRuleOperation); > ``` > > In the code, set the following parameters: > > * `name`: Name of the security rule. > * `parentId`: ID of the security group. > * `access`: Whether the rule allows or denies traffic. The example uses `RuleAccessAction.ALLOW`. > * `protocol`: Protocol of the traffic. The example uses `RuleProtocol.TCP`. > * `type`: [Security rule type](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-types-stateful-and-stateless). The example uses `RuleType.STATEFUL`. > * `priority`: [Security rule priority](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-priorities), from `1` to `1000`. > * `destinationCidrs` and `destinationPorts` under `match`: Destination CIDR blocks and ports. The code builds them from the comma-separated lists in `ruleCidrs` and `rulePorts`. > * `destinationSecurityGroupId` under `match`: ID of the [destination security group](https://docs.nebius.com/vpc/security-groups/overview.md#security-groups-as-sources-or-destinations-in-security-rules). > > The code saves the security rule ID to `securityRuleId`. > [!NOTE] > > You can't change a security rule once it's created. To change a rule in a custom security group, [delete](https://docs.nebius.com/vpc/security-groups/manage.md#deleting-security-rules) it and create a new one. Security rules in default security groups can't be deleted. ## Deleting security rules > [tab] Web console > > To delete a security rule from a security group: > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. Switch to the **Security groups** tab. > 3. Open the security group that you want to delete rules from. > 4. Do one of the following: > > * To delete a single rule, click next to the rule and select **Delete**. > * To delete multiple rules at once, check the boxes next to the required rules and click **Delete** in the banner that appears. > [tab] CLI > > To delete a security rule from a security group, run the `nebius vpc security-rule delete` command: > > ```bash > nebius vpc security-rule delete > ``` > > To get the security rule ID, run `nebius vpc security-rule list --parent-id `. > > For more details, see the [command reference](https://docs.nebius.com/cli/reference/vpc/security-rule/delete.md). > [tab] Go SDK > > Run the following code: > > ```go > deletedRuleService := sdk.Services().VPC().V1(). > SecurityRule() > deletedRuleOperation, err := deletedRuleService.Delete( > ctx, > &vpc.DeleteSecurityRuleRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deletedRuleOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the ID of the security rule that you want to delete. > [tab] Python SDK > > Run the following code: > > ```python > deleted_rule_service = SecurityRuleServiceClient(sdk) > deleted_rule_operation = await deleted_rule_service.delete( > DeleteSecurityRuleRequest( > id="", > ), > ) > await deleted_rule_operation.wait() > ``` > > Set `id` to the ID of the security rule that you want to delete. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const deletedRuleService = new SecurityRuleService(sdk); > const deletedRuleOperation = await deletedRuleService.delete( > DeleteSecurityRuleRequest.create({ > id: "", > }), > ).result; > await deletedRuleOperation.wait(); > ``` > > Set `id` to the ID of the security rule that you want to delete. If you delete all security rules from a security group, it denies all traffic to and from the VMs' network interfaces that are added to it. For more details, see [Security rule priorities](https://docs.nebius.com/vpc/security-groups/overview.md#security-rule-priorities). ## Adding VMs to security groups A VM and the security groups that it's added to must be associated with the same network. To add a VM's network interface to a security group, add the security group ID to the specification of the network interface when creating or modifying the VM. For example, to add an existing VM to a security group, perform the following steps: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Open the VM that you want to add to a security group. > > 3. Click **Actions** → **Add to security groups**. > > 4. In the window that opens: > > * If you have only one network interface configured, select one or multiple security groups from the list. > > * If you have multiple network interfaces configured: > > 1. Select the network interface that the security groups you want to add the VM to are associated with. > 2. Select one or multiple security groups from the list. > > 5. Click **Add VM to groups**. > [tab] CLI > > Run the following command: > > ```bash > nebius compute instance get --id --format json | \ > jq --arg nic "" --arg sg "" \ > '.spec.network_interfaces |= map(if .name == $nic then .security_groups += [{id: $sg}] else . end) | > {metadata: .metadata, spec: .spec}' | \ > nebius compute instance update - > ``` > > In the command, specify the following values: > > * ``: ID of the VM. > * ``: Name of the VM's network interface, for example, `eth0`. > * ``: ID of the security group. To get it, run `nebius vpc security-group list`. > > The command gets the VM specification, adds the security group to `security_groups` of the network interface, keeping the security groups that the interface already has, and then updates the VM with the full specification. The other network interfaces of the VM don't change. > > For more details, see the reference for commands that create and modify VMs: > > * [nebius compute instance create](https://docs.nebius.com/cli/reference/compute/instance/create.md) > * [nebius compute instance update](https://docs.nebius.com/cli/reference/compute/instance/update.md) > * [nebius compute instance edit](https://docs.nebius.com/cli/reference/compute/instance/edit.md) > [tab] Go SDK > > Run the following code: > > ```go > sgInstance, err := sdk.Services().Compute().V1(). > Instance().Get( > ctx, > &compute.GetInstanceRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if sgInstance.GetSpec() == nil { > return errors.New("instance spec is missing") > } > interfaceFound := false > for _, networkInterface := range sgInstance.Spec.NetworkInterfaces { > if networkInterface.GetName() == "" { > networkInterface.SecurityGroups = append( > networkInterface.SecurityGroups, > &compute.SecurityGroup{Id: ""}, > ) > interfaceFound = true > } > } > if !interfaceFound { > return errors.New("network interface not found") > } > sgUpdateOperation, err := sdk.Services().Compute().V1(). > Instance().Update( > ctx, > &compute.UpdateInstanceRequest{ > Metadata: sgInstance.Metadata, > Spec: sgInstance.Spec, > }, > ) > if err != nil { > return err > } > if _, err = sgUpdateOperation.Wait(ctx); err != nil { > return err > } > fmt.Println(sgUpdateOperation) > ``` > > In the code, specify the following values: > > * ``: ID of the VM. > * ``: Name of the VM's network interface, for example, `eth0`. > * ``: ID of the security group. When you [create a security group](https://docs.nebius.com/vpc/security-groups/manage.md#creating-security-groups-go-sdk), the code saves its ID to `securityGroupID`. > > The code gets the VM, adds the security group to `SecurityGroups` of the network interface, keeping the security groups that the interface already has, and then updates the VM. > [tab] Python SDK > > Run the following code: > > ```python > sg_instance_service = InstanceServiceClient(sdk) > sg_instance = await sg_instance_service.get( > GetInstanceRequest(id=""), > ) > if sg_instance.spec is None: > raise ValueError("instance spec is missing") > network_interfaces = list(sg_instance.spec.network_interfaces) > interface_found = False > for network_interface in network_interfaces: > if network_interface.name == "": > network_interface.security_groups = [ > *network_interface.security_groups, > SecurityGroup(id=""), > ] > interface_found = True > if not interface_found: > raise ValueError("network interface not found") > sg_instance.spec.network_interfaces = network_interfaces > sg_update_operation = await sg_instance_service.update( > UpdateInstanceRequest( > metadata=sg_instance.metadata, > spec=sg_instance.spec, > ), > ) > await sg_update_operation.wait() > print(sg_update_operation) > ``` > > In the code, specify the following values: > > * ``: ID of the VM. > * ``: Name of the VM's network interface, for example, `eth0`. > * ``: ID of the security group. When you [create a security group](https://docs.nebius.com/vpc/security-groups/manage.md#creating-security-groups-python-sdk), the code saves its ID to `security_group_id`. > > The code gets the VM, adds the security group to `security_groups` of the network interface, keeping the security groups that the interface already has, and then updates the VM. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const sgInstanceService = new InstanceService(sdk); > const sgInstance = await sgInstanceService.get( > GetInstanceRequest.create({ > id: "", > }), > ); > if (!sgInstance.spec) { > throw new Error("instance spec is missing"); > } > const sgInterface = (sgInstance.spec.networkInterfaces ?? []).find( > (networkInterface) => networkInterface.name === "", > ); > if (!sgInterface) { > throw new Error("network interface not found"); > } > sgInterface.securityGroups = [ > ...(sgInterface.securityGroups ?? []), > SecurityGroup.create({ id: "" }), > ]; > const sgUpdateOperation = await sgInstanceService.update( > UpdateInstanceRequest.create({ > metadata: sgInstance.metadata, > spec: sgInstance.spec, > }), > ).result; > await sgUpdateOperation.wait(); > console.log(sgUpdateOperation); > ``` > > In the code, specify the following values: > > * ``: ID of the VM. > * ``: Name of the VM's network interface, for example, `eth0`. > * ``: ID of the security group. When you [create a security group](https://docs.nebius.com/vpc/security-groups/manage.md#creating-security-groups-javascript-sdk), the code saves its ID to `securityGroupId`. > > The code gets the VM, adds the security group to `securityGroups` of the network interface, keeping the security groups that the interface already has, and then updates the VM. If a VM's network interface isn't added to any security group, the [default security group](https://docs.nebius.com/vpc/security-groups/overview.md#default-security-groups) of the VM's network controls traffic to and from this network interface. You can achieve this by making the list of the network interface's security groups empty. ## Deleting security groups > [!WARNING] > > You can only delete non-default security groups that don't have any associated VMs. Before deleting a security group, add any associated VMs to other security groups or revert these VMs to defaults. For more details, see [Adding VMs to security groups](https://docs.nebius.com/vpc/security-groups/manage.md#adding-vms-to-security-groups). > [tab] Web console > > To delete a security group: > > 1. In the sidebar, go to  **Networking** → **Virtual Networks**. > 2. Switch to the **Security groups** tab. > 3. Click next to the security group you want to delete and select **Delete**. > 4. In the window that opens, enter the name of the security group and click **Delete security group**. > > > [!NOTE] > > > > If the security group has any rules in it, you will first need to [delete the rules](https://docs.nebius.com/vpc/security-groups/manage.md#deleting-security-rules-web-console). > [tab] CLI > > To delete a security group, run `nebius vpc security-group delete`: > > ```bash > nebius vpc security-group delete > ``` > > To get the security group ID, run `nebius vpc security-group list`. > [tab] Go SDK > > Run the following code: > > ```go > deletedGroupService := sdk.Services().VPC().V1(). > SecurityGroup() > deletedGroupOperation, err := deletedGroupService.Delete( > ctx, > &vpc.DeleteSecurityGroupRequest{ > Id: "", > }, > ) > if err != nil { > return err > } > if _, err = deletedGroupOperation.Wait(ctx); err != nil { > return err > } > ``` > > Set `Id` to the ID of the security group that you want to delete. > [tab] Python SDK > > Run the following code: > > ```python > deleted_group_service = SecurityGroupServiceClient(sdk) > deleted_group_operation = await deleted_group_service.delete( > DeleteSecurityGroupRequest( > id="", > ), > ) > await deleted_group_operation.wait() > ``` > > Set `id` to the ID of the security group that you want to delete. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const deletedGroupService = new SecurityGroupService(sdk); > const deletedGroupOperation = await deletedGroupService.delete( > DeleteSecurityGroupRequest.create({ > id: "", > }), > ).result; > await deletedGroupOperation.wait(); > ``` > > Set `id` to the ID of the security group that you want to delete. # Nebius VPN Gateway Source: https://docs.nebius.com/vpc/nebius-vpn-gateway.md To establish site-to-site VPN connectivity with external networks in other cloud providers or on-premises data centers, deploy Nebius VPN Gateway, an open-source, VM-based IPsec gateway provided by Nebius Professional Services. This solution supports [Internet Key Exchange version 2](https://en.wikipedia.org/wiki/Internet_Key_Exchange) (IKEv2) with [strongSwan](https://github.com/strongswan/strongswan), [Border Gateway Protocol](https://en.wikipedia.org/wiki/Border_Gateway_Protocol) (BGP) dynamic routing via [FRRouting](https://github.com/FRRouting/frr), active/passive high availability (HA), and includes peer config importers for [Cloud VPN](https://docs.cloud.google.com/network-connectivity/docs/vpn/concepts/overview) in Google Cloud, [AWS Site-to-Site VPN](https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html), [Azure VPN Gateway](https://learn.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-about-vpngateways) and Cisco IOS. For details and instructions, see [Nebius VPN Gateway](https://github.com/nebius/nebius-ps-services/tree/main/services/vpngw) on GitHub. # Virtual Networks quotas and constraints Source: https://docs.nebius.com/vpc/resources/quotas-limits.md ## Quotas Virtual Networks has quotas on the number of networking resources. For details on what quotas are and how to manage them, see [Quotas in Nebius AI Cloud](https://docs.nebius.com/overview/quotas.md). | Quota name | Default value per [region](https://docs.nebius.com/overview/regions.md) | | - | - | | Allocations | 1000 | | Public IPv4 addresses | 3 | | Networks | 50 | | Pools | 50 | | Routes | 300 | | Route tables | 30 | | Subnets | 50 | | [Security groups](https://docs.nebius.com/vpc/security-groups/overview.md) | 200 | | Security rules | 1000 | ## Constraints Certain Virtual Networks resources have technical constraints that can't be changed directly. | Constraint name | Value | | - | - | | [Security groups](https://docs.nebius.com/vpc/security-groups/overview.md) associated with a network | 128 | | Security groups assigned to a VM's network interface | 8 | | Security rules in a security group | 60 | | CIDR blocks in a security rule | 8 | | Ports in a security rule | 8 | # Pricing in Virtual Networks Source: https://docs.nebius.com/vpc/resources/pricing.md The Virtual Networks service in Nebius AI Cloud is provided free of charge. ### Nebius Tunnels # Nebius Tunnels Source: https://docs.nebius.com/tunnels/index.md Nebius Tunnels lets you expose local services to the internet without opening firewall ports. Your application connects out to a public edge server, and the edge forwards internet requests back through that same connection. The service is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and is available in all [Nebius AI Cloud regions](https://docs.nebius.com/overview/regions.md). > [card] [About Nebius Tunnels](https://docs.nebius.com/tunnels/overview.md) > > Learn how tunnels forward public traffic through an outbound agent connection > [card] [Getting started](https://docs.nebius.com/tunnels/quickstart.md) > > Connect a service running on a VM to the internet through a tunnel > [card] [Creating a tunnel](https://docs.nebius.com/tunnels/create.md) > > Create a tunnel in the web console or by using the CLI > [card] [Connecting to a tunnel](https://docs.nebius.com/tunnels/connect.md) > > Configure and run a tunnel agent to expose a service through a tunnel > [card] [Deleting a tunnel](https://docs.nebius.com/tunnels/delete.md) > > Delete a tunnel that you no longer need # About Nebius Tunnels Source: https://docs.nebius.com/tunnels/overview.md Nebius Tunnels lets you expose a service running on a virtual machine (VM), on your laptop or behind a firewall to the internet without opening inbound firewall ports, assigning a public IP address to the service or configuring DNS and TLS certificates. ## How tunnels work A tunnel consists of: * A tunnel resource in Nebius AI Cloud. * A tunnel agent that runs next to your application. * One or more services in the agent configuration. Each service maps a public tunnel URL to a local HTTP or TCP endpoint. The agent opens an outbound TLS connection to a regional Nebius edge endpoint. When a client sends a request to the public tunnel URL, the edge forwards the request back through the existing agent connection. The VM or private network doesn't need to accept inbound connections from the internet for this traffic. ```mermaid graph LR User[Internet user] -->|request| Edge[Nebius edge] Edge -->|forwards through tunnel| Agent[Tunnel agent] Agent -->|forwards locally| App[Local service] Agent -.->|outbound connection| Edge ``` ## Supported traffic Nebius Tunnels supports: * HTTP services over HTTP/1.1, including WebSocket upgrade requests. * HTTP services over HTTP/2, including gRPC, by setting `protocol: h2` in the agent configuration. * TCP services. * Multiple services in one tunnel, each with its own service name and public URL. The agent-to-edge tunnel connection uses HTTP/2 multiplexing, so multiple client requests can share the same outbound connection from the agent to the edge. Each public URL uses this format: ```text https://-.tunnel.applications..nebius.cloud ``` Where: * `service_name` is the `services.name` value from the agent configuration. * `tunnel_masked_ID` is the mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. For example, for `applicationtunnel-e00abcdef123456789`, the tunnel ID mask is `abcdef123456789`. * `region` is the [region](https://docs.nebius.com/overview/regions.md) of the project where the tunnel was created, for example `eu-north1`. In the agent configuration, `services.name` can contain up to 20 characters and must use only lowercase Latin letters and digits (`[a-z0-9]`). Don't use dashes or dots. ## Authentication and access The tunnel agent authenticates with [Identity and Access Management](https://docs.nebius.com/iam/index.md). To connect to a tunnel, the service account used by the agent must have the `applicationtunnel.agent` role on that tunnel or on one of its parent resources. > [!WARNING] > > Nebius Tunnels secures the transport between the tunnel agent and Nebius edge, but it doesn't add user authentication or authorization to your application. Configure access control in the application itself before exposing it through a tunnel. The tunnel agent can authenticate as a service account by using: * An [authorized key pair](https://docs.nebius.com/iam/service-accounts/authorized-keys.md). This method works on Compute VMs and other hosts. * Metadata authentication, available on Compute VMs where you [specified a service account when creating the VM](https://docs.nebius.com/cli/compute-vm.md#specifying-the-service-account-on-vm-creation). ## What's next * [Get started with Nebius Tunnels](https://docs.nebius.com/tunnels/quickstart.md) * [Create a tunnel](https://docs.nebius.com/tunnels/create.md) * [Connect to a tunnel](https://docs.nebius.com/tunnels/connect.md) # Getting started with Nebius Tunnels: Connect a VM service to the internet Source: https://docs.nebius.com/tunnels/quickstart.md The Nebius Tunnels service exposes a service to the internet without configuring firewall ports. Your service could be running anywhere: on a VM, your local machine, or another cloud provider. In this guide, you'll create a tunnel, prepare access for a tunnel agent, create a Compute virtual machine (VM) with the agent preinstalled, deploy a demo service on it, and access the service through a public tunnel URL. ## Costs Nebius Tunnels is provided free of charge during preview. If you create a VM for this guide, Nebius AI Cloud charges you for [Compute resources](https://docs.nebius.com/compute/resources/pricing.md). ## Prerequisites 1. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. You need this role to create a group and grant it a role for the tunnel. You also need the `admin` role to create a VM with a service account attached. Create the service account in the same project as the VM. The tunnel agent authenticates as this service account, so it only needs the [applicationtunnel.agent](https://docs.nebius.com/iam/authorization/roles.md#nebius-tunnels) role for the tunnel. It doesn't need any Compute permissions. > [!NOTE] > > A VM's service account is set only at creation and can't be changed afterwards. To attach a different service account, [create a new VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). 2. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. 3. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: ```bash cat ~/.nebius/config.yaml ``` 4. [Get the subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id) for the VM you create. 5. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) and save it to an environment variable: ```bash export PROJECT_ID= ``` 6. [Get the tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-cli) and save it to an environment variable: ```bash export TENANT_ID= ``` You need the tenant ID when granting the service account access to Nebius Tunnels. ## Steps ### Create a tunnel Create a tunnel and save its ID: ```bash export TUNNEL_ID=$(nebius tunnel create \ --title "quickstart-tunnel" \ --format jsonpath='{.metadata.id}') ``` ### Prepare agent access On the VM, the tunnel agent authenticates through the instance metadata service — no need to generate or copy keys. 1. Create a service account for the tunnel agent and save its ID: ```bash export SA_ID=$(nebius iam service-account create \ --name "tunnel-agent" \ --parent-id "$PROJECT_ID" \ --format jsonpath='{.metadata.id}') ``` 2. Create a group for Nebius Tunnels service accounts and save its ID: ```bash export GROUP_ID=$(nebius iam group create \ --name "tunnel-agents" \ --parent-id "$TENANT_ID" \ --format jsonpath='{.metadata.id}') ``` 3. Grant the group the `applicationtunnel.agent` role for the tunnel: ```bash nebius iam access-permit create \ --parent-id "$GROUP_ID" \ --resource-id "$TUNNEL_ID" \ --role applicationtunnel.agent ``` 4. Add the service account to the group: ```bash nebius iam group-membership create \ --parent-id "$GROUP_ID" \ --member-id "$SA_ID" ``` ### Create the VM 1. Prepare the cloud-init configuration file. You'll attach it to the VM when you create it. Save the following configuration to a file named `cloud-init.yaml` in your working directory. Before saving, replace: * `` with the username you'll use to connect * `` with your SSH public key * `` with the value of `$TUNNEL_ID` > [accordion] cloud-init.yaml > > ```yaml > users: > - name: > sudo: "ALL=(ALL) NOPASSWD:ALL" > shell: /bin/bash > ssh_authorized_keys: > - > > write_files: > - path: /etc/nebius-tunnel-agent/config.yaml > permissions: "0640" > content: | > tunnel_id: > > iam: > metadata: > enabled: true > > services: > - name: web > target: 127.0.0.1:8080 > type: http > > - path: /etc/systemd/system/nebius-tunnel-agent.service > permissions: "0644" > content: | > [Unit] > Description=Nebius tunnel agent > Documentation=https://docs.nebius.com/tunnels > After=network-online.target > Wants=network-online.target > > [Service] > Type=simple > User=tunna > Group=tunna > ExecStart=/usr/local/bin/nebius-tunnel-agent --config /etc/nebius-tunnel-agent/config.yaml > Restart=always > RestartSec=5 > NoNewPrivileges=true > ProtectSystem=strict > ProtectHome=true > PrivateTmp=true > ReadOnlyPaths=/etc/nebius-tunnel-agent > > [Install] > WantedBy=multi-user.target > > - path: /usr/local/sbin/install-nebius-tunnel-agent > permissions: "0755" > content: | > #!/bin/bash > set -euo pipefail > > VERSION="${AGENT_VERSION:-latest}" > BASE="https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent" > CONF_DIR=/etc/nebius-tunnel-agent > > # Select the agent archive for the VM architecture > case "$(uname -m)" in > x86_64) PLATFORM=linux-x86_64 ;; > aarch64|arm64) PLATFORM=linux-aarch64 ;; > *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; > esac > ASSET="nebius-tunnel-agent-${PLATFORM}.tar.gz" > > TMP="$(mktemp -d)" > trap 'rm -rf "$TMP"' EXIT > > # Download a file with retry handling > fetch() { > curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$2" "$1" > } > > # Download and verify the agent archive > fetch "$BASE/$VERSION/$ASSET" "$TMP/$ASSET" > fetch "$BASE/$VERSION/checksums-sha256.txt" "$TMP/checksums-sha256.txt" > (cd "$TMP" && sha256sum --ignore-missing -c checksums-sha256.txt) > > # Install the agent binary > tar -xzf "$TMP/$ASSET" -C "$TMP" > install -m0755 "$TMP/nebius-tunnel-agent" /usr/local/bin/nebius-tunnel-agent > > # Create the dedicated system user and start the service > getent group tunna >/dev/null || groupadd --system tunna > id -u tunna >/dev/null 2>&1 || useradd --system --gid tunna \ > --no-create-home --shell /usr/sbin/nologin tunna > chown -R tunna:tunna "$CONF_DIR" > chmod 0750 "$CONF_DIR" > chmod 0640 "$CONF_DIR/config.yaml" > > systemctl daemon-reload > systemctl enable nebius-tunnel-agent.service > systemctl restart nebius-tunnel-agent.service > > runcmd: > - [/usr/local/sbin/install-nebius-tunnel-agent] > ``` > > This configuration enables the following actions: > > * Add a username and a public SSH key to the VM. > * Download the tunnel agent, verify its checksum and install it as a systemd service running under a dedicated `tunna` system user. > * Authenticate by using the service account attached to the VM, through the instance metadata service. No key files are involved. > * Create the `web` [Nebius Tunnels service](https://docs.nebius.com/tunnels/overview.md#supported-traffic) that exposes `127.0.0.1:8080` on the VM. 2. Create the VM: ```bash nebius compute instance create \ --name tunnel-agent-vm \ --resources-platform cpu-d3 \ --resources-preset 4vcpu-16gb \ --boot-disk-attach-mode READ_WRITE \ --boot-disk-managed-disk-name tunnel-agent-vm-boot \ --boot-disk-managed-disk-type network_ssd \ --boot-disk-managed-disk-size-gibibytes 20 \ --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"public_ip_address\": {}, \"subnet_id\": \"\"}]" \ --service-account-id \ --cloud-init-user-data "$(cat cloud-init.yaml)" ``` In the command, specify the subnet ID from [Prerequisites](https://docs.nebius.com/tunnels/quickstart.md#prerequisites) and the ID of the service account you created earlier. 3. Get the public IP address of the VM: ```bash export PUBLIC_IP_ADDRESS=$(nebius compute instance get-by-name \ --name \ --format json \ | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') ``` In the command, specify the name of the VM you created. 4. Connect to the VM: ```bash ssh @ ``` ### Prepare and deploy a local HTTP service > [!NOTE] > > Follow this section on your VM via SSH. Start the `busybox` HTTP server on your VM: 1. Install the `busybox` package: ```sh sudo apt-get update && sudo apt-get install -y busybox ``` 2. In your home directory, create a `www/` directory and add an HTML file to serve via the tunnel: ```sh mkdir -p ~/www cat > ~/www/index.html <<'EOF' Nebius Tunnels test

Nebius Tunnels test page

This page tests the functionality of the Nebius Tunnels service.

EOF ``` 3. Create a unit file: ```sh sudo tee /etc/systemd/system/busybox-httpd.service > /dev/null <<'EOF' [Unit] Description=Busybox HTTP service After=network.target [Service] ExecStart=/bin/busybox httpd -f -p 8080 -h /home//www Restart=on-failure User= [Install] WantedBy=multi-user.target EOF ``` In the unit file, replace `` with the username you used to connect to the VM. 4. Apply the new unit file, start the `busybox-httpd` service and check its status: ```sh sudo systemctl daemon-reload sudo systemctl enable --now busybox-httpd sudo systemctl status busybox-httpd ``` ### Verify the tunnel agent > [!NOTE] > > Follow this section on your VM via SSH. The cloud-init configuration installs and starts the tunnel agent automatically when the VM boots, so there's nothing left to run manually. To confirm that the agent registered with the tunnel, check the status of the service: ```bash sudo systemctl status nebius-tunnel-agent ``` For live logs, run: ```bash sudo journalctl -u nebius-tunnel-agent -f ``` If the agent doesn't register, check the logs for these common causes: * **The VM has no service account attached.** `systemctl status` still shows `active (running)`, but the agent retries indefinitely, showing `IMDS token request failed: 404 Not Found` followed by `connection closed before registering`. You can't attach a service account to an existing VM. Create a new one with `--service-account-id` instead. * **The attached service account doesn't have the `applicationtunnel.agent` role.** The agent authenticates, but the tunnel rejects the connection. Grant the role to the service account as described earlier in this guide. In the log output, the agent reports the public endpoint in the following format: ```text -.tunnel.applications..nebius.cloud ``` Where: * `service_name` is the `services.name` value from the agent configuration. * `tunnel_masked_ID` is the mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. For example, for `applicationtunnel-e00abcdef123456789`, the tunnel ID mask is `abcdef123456789`. * `region` is the [region](https://docs.nebius.com/overview/regions.md) of the project where the tunnel was created, for example `eu-north1`. ### Access the service on the VM via the tunnel On your local machine, add `https://` to the beginning of the public endpoint address and open it in your browser, or run `curl https://` in your terminal. # How to create a tunnel in Nebius Tunnels Source: https://docs.nebius.com/tunnels/create.md A *tunnel* is the Nebius AI Cloud resource that receives public traffic and forwards it to a tunnel agent. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > ```bash > cat ~/.nebius/config.yaml > ``` > > 3. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Creating a tunnel > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Networking** → **Tunnels**. > > 2. Click **Create tunnel**. > > 3. Specify a name for the tunnel. > > 4. (Optional) Add a description. > > 5. Click **Create**. > [tab] CLI > > Create a tunnel: > > ```bash > nebius tunnel create \ > --title > ``` > > The command uses the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) from your CLI profile configuration. > [tab] Go SDK > > Create a tunnel: > > ```go > createTunnelService := sdk.Services().Tunnel().V1(). > Tunnel() > createTunnelOperation, err := createTunnelService.Create( > ctx, > &tunnel.CreateTunnelRequest{ > Spec: &tunnel.TunnelSpec{ > Title: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create tunnel: %w", err) > } > createTunnelOperation, err = createTunnelOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create tunnel: %w", err) > } > ``` > > In the code, set `Title` in `TunnelSpec` to the tunnel title. The code uses the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk) that you set with `gosdk.WithParentID` when initializing the SDK. > [tab] Python SDK > > Create a tunnel: > > ```python > create_tunnel_service = TunnelServiceClient(sdk) > create_tunnel_operation = await create_tunnel_service.create( > CreateTunnelRequest( > spec=TunnelSpec( > title="", > ), > ), > ) > await create_tunnel_operation.wait() > ``` > > In the code, set `title` in `TunnelSpec` to the tunnel title. The code uses the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk) that you set in `parent_id` when initializing the SDK. > [tab] JavaScript SDK > > Create a tunnel: > > ```ts > const createTunnelService = new TunnelService(sdk); > const createTunnelOperation = await createTunnelService.create( > CreateTunnelRequest.create({ > metadata: ResourceMetadata.create({}), > spec: TunnelSpec.create({ > title: "", > }), > }), > ).result; > await createTunnelOperation.wait(); > ``` > > In the code, set `title` in `TunnelSpec` to the tunnel title. The code uses the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk) that you set in `parentId` when initializing the SDK. After you create a tunnel, you can [connect a service to it](https://docs.nebius.com/tunnels/connect.md) by configuring and running a tunnel agent. # How to connect to a tunnel Source: https://docs.nebius.com/tunnels/connect.md To connect a service to a tunnel, configure and run a tunnel agent. You'll need the tunnel ID in the agent configuration. ## Prerequisites > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > You need this role to create a group and grant it a role for the tunnel. > > 3. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) and the [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-cli), and save them to environment variables: > > ```bash > export PROJECT_ID= > ``` > > ```bash > export TENANT_ID= > ``` > > 4. Get the tunnel ID by listing tunnels in your project: > > ```bash > nebius tunnel list > ``` > > The command uses the project ID from your CLI profile configuration. Copy the ID of the tunnel that you want to connect to and save it to an environment variable: > > ```bash > export TUNNEL_ID= > ``` > > 5. If you plan to run the agent on a VM, [get the subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) for the VM you want to create. > > You also need the `admin` role to create a VM with a service account attached. > > Create the service account in the same project as the VM. The tunnel agent authenticates as this service account, so it only needs the [applicationtunnel.agent](https://docs.nebius.com/iam/authorization/roles.md#nebius-tunnels) role for the tunnel. It doesn't need any Compute permissions. > > > [!NOTE] > > > > A VM's service account is set only at creation and can't be changed afterwards. To attach a different service account, [create a new VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > You need this role to create a group and grant it a role for the tunnel. > > 3. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk) and the [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-go-sdk). You specify them in the code later. > > 4. Get the tunnel ID by listing tunnels in your project: > > ```go > listTunnelsService := sdk.Services().Tunnel().V1(). > Tunnel() > listTunnels, err := listTunnelsService.List( > ctx, > &tunnel.ListTunnelRequest{}, > ) > if err != nil { > return fmt.Errorf("list tunnels: %w", err) > } > fmt.Println(listTunnels) > ``` > > The code uses the project ID that you set with `gosdk.WithParentID` when initializing the SDK. In the response, find the tunnel that you want to connect to and copy its ID from `Metadata.Id`. > > 5. If you plan to run the agent on a VM, [get the subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) for the VM you want to create. > > You also need the `admin` role to create a VM with a service account attached. > > Create the service account in the same project as the VM. The tunnel agent authenticates as this service account, so it only needs the [applicationtunnel.agent](https://docs.nebius.com/iam/authorization/roles.md#nebius-tunnels) role for the tunnel. It doesn't need any Compute permissions. > > > [!NOTE] > > > > A VM's service account is set only at creation and can't be changed afterwards. To attach a different service account, [create a new VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > You need this role to create a group and grant it a role for the tunnel. > > 3. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk) and the [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-python-sdk). You specify them in the code later. > > 4. Get the tunnel ID by listing tunnels in your project: > > ```python > list_tunnels_service = TunnelServiceClient(sdk) > list_tunnels = await list_tunnels_service.list( > ListTunnelRequest(), > ) > print(list_tunnels) > ``` > > The code uses the project ID that you set in `parent_id` when initializing the SDK. In the response, find the tunnel that you want to connect to and copy its ID from `metadata.id`. > > 5. If you plan to run the agent on a VM, [get the subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) for the VM you want to create. > > You also need the `admin` role to create a VM with a service account attached. > > Create the service account in the same project as the VM. The tunnel agent authenticates as this service account, so it only needs the [applicationtunnel.agent](https://docs.nebius.com/iam/authorization/roles.md#nebius-tunnels) role for the tunnel. It doesn't need any Compute permissions. > > > [!NOTE] > > > > A VM's service account is set only at creation and can't be changed afterwards. To attach a different service account, [create a new VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` role within your tenant or project; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > You need this role to create a group and grant it a role for the tunnel. > > 3. [Get the project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk) and the [tenant ID](https://docs.nebius.com/iam/get-tenants.md#how-to-get-a-tenant-id-javascript-sdk). You specify them in the code later. > > 4. Get the tunnel ID by listing tunnels in your project: > > ```ts > const listTunnelsService = new TunnelService(sdk); > const listTunnels = await listTunnelsService.list( > ListTunnelRequest.create({}), > ).result; > console.log(listTunnels); > ``` > > The code uses the project ID that you set in `parentId` when initializing the SDK. In the response, find the tunnel that you want to connect to and copy its ID from `metadata.id`. > > 5. If you plan to run the agent on a VM, [get the subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) for the VM you want to create. > > You also need the `admin` role to create a VM with a service account attached. > > Create the service account in the same project as the VM. The tunnel agent authenticates as this service account, so it only needs the [applicationtunnel.agent](https://docs.nebius.com/iam/authorization/roles.md#nebius-tunnels) role for the tunnel. It doesn't need any Compute permissions. > > > [!NOTE] > > > > A VM's service account is set only at creation and can't be changed afterwards. To attach a different service account, [create a new VM](https://docs.nebius.com/compute/virtual-machines/create.md#create-a-vm). ## Connecting a service To connect to a tunnel, first set up access for the tunnel agent and then launch this agent. ### Setting up access for the tunnel agent 1. Create a service account and save its ID: > [tab] CLI > > ```bash > export SA_ID=$(nebius iam service-account create \ > --name "tunnel-agent" \ > --parent-id "$PROJECT_ID" \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > createSaService := sdk.Services().IAM().V1(). > ServiceAccount() > createSaOperation, err := createSaService.Create( > ctx, > &iam.CreateServiceAccountRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agent", > ParentId: "", > }, > Spec: &iam.ServiceAccountSpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create service account: %w", err) > } > createSaOperation, err = createSaOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create service account: %w", err) > } > saID := createSaOperation.ResourceID() > fmt.Println(saID) > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the project ID. The code prints the ID of the service account. > [tab] Python SDK > > ```python > create_sa_service = ServiceAccountServiceClient(sdk) > create_sa_operation = await create_sa_service.create( > CreateServiceAccountRequest( > metadata=ResourceMetadata( > name="tunnel-agent", > parent_id="", > ), > spec=ServiceAccountSpec(), > ), > ) > await create_sa_operation.wait() > sa_id = create_sa_operation.resource_id > print(sa_id) > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the project ID. The code prints the ID of the service account. > [tab] JavaScript SDK > > ```ts > const createSaService = new ServiceAccountService(sdk); > const createSaOperation = await createSaService.create( > CreateServiceAccountRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agent", > parentId: "", > }), > spec: ServiceAccountSpec.create({}), > }), > ).result; > await createSaOperation.wait(); > const saId = createSaOperation.resourceId(); > console.log(saId); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the project ID. The code prints the ID of the service account. > [!NOTE] > > To grant wider access instead of creating a dedicated group with the `applicationtunnel.agent` role, you can [add the service account to the `editors` group](https://docs.nebius.com/iam/service-accounts/manage#granting-editor-access-to-the-service-account). 2. Create a group for Nebius Tunnels service accounts and save its ID: > [tab] CLI > > ```bash > export GROUP_ID=$(nebius iam group create \ > --name "tunnel-agents" \ > --parent-id "$TENANT_ID" \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > createGroupService := sdk.Services().IAM().V1(). > Group() > createGroupOperation, err := createGroupService.Create( > ctx, > &iam.CreateGroupRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agents", > ParentId: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group: %w", err) > } > createGroupOperation, err = createGroupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group: %w", err) > } > groupID := createGroupOperation.ResourceID() > fmt.Println(groupID) > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the tenant ID. The code prints the ID of the group. > [tab] Python SDK > > ```python > create_group_service = GroupServiceClient(sdk) > create_group_operation = await create_group_service.create( > CreateGroupRequest( > metadata=ResourceMetadata( > name="tunnel-agents", > parent_id="", > ), > ), > ) > await create_group_operation.wait() > group_id = create_group_operation.resource_id > print(group_id) > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the tenant ID. The code prints the ID of the group. > [tab] JavaScript SDK > > ```ts > const createGroupService = new GroupService(sdk); > const createGroupOperation = await createGroupService.create( > CreateGroupRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agents", > parentId: "", > }), > }), > ).result; > await createGroupOperation.wait(); > const groupId = createGroupOperation.resourceId(); > console.log(groupId); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the tenant ID. The code prints the ID of the group. 3. Grant the group the `applicationtunnel.agent` role for the tunnel: > [tab] CLI > > ```bash > nebius iam access-permit create \ > --parent-id "$GROUP_ID" \ > --resource-id "$TUNNEL_ID" \ > --role applicationtunnel.agent > ``` > [tab] Go SDK > > ```go > accessPermitService := sdk.Services().IAM().V1(). > AccessPermit() > accessPermitOperation, err := accessPermitService.Create( > ctx, > &iam.CreateAccessPermitRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.AccessPermitSpec{ > ResourceId: "", > Role: "applicationtunnel.agent", > }, > }, > ) > if err != nil { > return fmt.Errorf("create access permit: %w", err) > } > accessPermitOperation, err = accessPermitOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create access permit: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `ResourceId` in `AccessPermitSpec` to the tunnel ID. > [tab] Python SDK > > ```python > access_permit_service = AccessPermitServiceClient(sdk) > access_permit_operation = await access_permit_service.create( > CreateAccessPermitRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=AccessPermitSpec( > resource_id="", > role="applicationtunnel.agent", > ), > ), > ) > await access_permit_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `resource_id` in `AccessPermitSpec` to the tunnel ID. > [tab] JavaScript SDK > > ```ts > const accessPermitService = new AccessPermitService(sdk); > const accessPermitOperation = await accessPermitService.create( > CreateAccessPermitRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: AccessPermitSpec.create({ > resourceId: "", > role: "applicationtunnel.agent", > }), > }), > ).result; > await accessPermitOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `resourceId` in `AccessPermitSpec` to the tunnel ID. > [!NOTE] > > To grant access to more tunnels, create the permit on a broader resource: a project or a tenant. A permit on a project applies to all tunnels in that project. A permit on a tenant applies to all tunnels in all projects in the tenant. 4. Add the service account to the group: > [tab] CLI > > ```bash > nebius iam group-membership create \ > --parent-id "$GROUP_ID" \ > --member-id "$SA_ID" > ``` > [tab] Go SDK > > ```go > membershipService := sdk.Services().IAM().V1(). > GroupMembership() > membershipOperation, err := membershipService.Create( > ctx, > &iam.CreateGroupMembershipRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.GroupMembershipSpec{ > MemberId: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group membership: %w", err) > } > membershipOperation, err = membershipOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group membership: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `MemberId` in `GroupMembershipSpec` to the service account ID. > [tab] Python SDK > > ```python > membership_service = GroupMembershipServiceClient(sdk) > membership_operation = await membership_service.create( > CreateGroupMembershipRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=GroupMembershipSpec( > member_id="", > ), > ), > ) > await membership_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `member_id` in `GroupMembershipSpec` to the service account ID. > [tab] JavaScript SDK > > ```ts > const membershipService = new GroupMembershipService(sdk); > const membershipOperation = await membershipService.create( > CreateGroupMembershipRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: GroupMembershipSpec.create({ > memberId: "", > }), > }), > ).result; > await membershipOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `memberId` in `GroupMembershipSpec` to the service account ID. ### Installing and running the agent You can run the tunnel agent [in Docker](https://docs.nebius.com/tunnels/connect.md#running-the-agent-in-docker), in a Kubernetes cluster [by using Helm](https://docs.nebius.com/tunnels/connect.md#running-the-agent-by-using-helm) or [on a Nebius VM](https://docs.nebius.com/tunnels/connect.md#running-the-agent-on-a-vm). #### Creating an authorized key for Docker and Helm In Docker and Kubernetes, the agent authenticates as the service account by using an [authorized key](https://docs.nebius.com/iam/service-accounts/authorized-keys.md). On a Nebius VM, the agent doesn't need a key, so go to [Running the agent on a VM](https://docs.nebius.com/tunnels/connect.md#running-the-agent-on-a-vm). 1. Create a key pair: ```bash openssl genrsa -out ./private_key.pem 4096 openssl rsa -in ./private_key.pem -pubout -out ./public_key.pem ``` The command creates the `private_key.pem` and `public_key.pem` files in the current directory. 2. Upload the public key and save its ID: > [tab] CLI > > ```bash > export PUBLIC_KEY_ID=$(nebius iam auth-public-key create \ > --account-service-account-id "$SA_ID" \ > --data "$(cat ./public_key.pem)" \ > --format jsonpath='{.metadata.id}') > ``` > [tab] Go SDK > > ```go > publicKeyData, err := os.ReadFile("./public_key.pem") > if err != nil { > return fmt.Errorf("read public key: %w", err) > } > keyAccount := &iam.Account{ > Type: &iam.Account_ServiceAccount_{ > ServiceAccount: &iam.Account_ServiceAccount{ > Id: "", > }, > }, > } > publicKeyService := sdk.Services().IAM().V1(). > AuthPublicKey() > publicKeyOperation, err := publicKeyService.Create( > ctx, > &iam.CreateAuthPublicKeyRequest{ > Spec: &iam.AuthPublicKeySpec{ > Account: keyAccount, > Data: string(publicKeyData), > }, > }, > ) > if err != nil { > return fmt.Errorf("create auth public key: %w", err) > } > publicKeyOperation, err = publicKeyOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create auth public key: %w", err) > } > publicKeyID := publicKeyOperation.ResourceID() > fmt.Println(publicKeyID) > ``` > > In the code, set `Id` in `Account_ServiceAccount` to the service account ID. The code reads the public key from the `public_key.pem` file and prints the ID of the authorized key. > [tab] Python SDK > > ```python > public_key_data = Path("./public_key.pem").read_text() > key_account = Account( > service_account=Account__ServiceAccount( > id="", > ), > ) > public_key_service = AuthPublicKeyServiceClient(sdk) > public_key_operation = await public_key_service.create( > CreateAuthPublicKeyRequest( > spec=AuthPublicKeySpec( > account=key_account, > data=public_key_data, > ), > ), > ) > await public_key_operation.wait() > public_key_id = public_key_operation.resource_id > print(public_key_id) > ``` > > In the code, set `id` in `Account__ServiceAccount` to the service account ID. The code reads the public key from the `public_key.pem` file and prints the ID of the authorized key. > [tab] JavaScript SDK > > ```ts > const publicKeyData = > await readFile("./public_key.pem", "utf8"); > const keyAccount = Account.create({ > type: { > $case: "serviceAccount", > serviceAccount: Account_ServiceAccount.create({ > id: "", > }), > }, > }); > const publicKeyService = new AuthPublicKeyService(sdk); > const publicKeyOperation = await publicKeyService.create( > CreateAuthPublicKeyRequest.create({ > metadata: ResourceMetadata.create({}), > spec: AuthPublicKeySpec.create({ > account: keyAccount, > data: publicKeyData, > }), > }), > ).result; > await publicKeyOperation.wait(); > const publicKeyId = publicKeyOperation.resourceId(); > console.log(publicKeyId); > ``` > > In the code, set `id` in `Account_ServiceAccount` to the service account ID. The code reads the public key from the `public_key.pem` file and prints the ID of the authorized key. #### Running the agent in Docker 1. Install [Docker Engine](https://docs.docker.com/engine/install/). 2. In the directory with the `private_key.pem` file, create `config.yaml` for the agent: ```yaml tunnel_id: iam: service_account: service_account_id: public_key_id: private_key_path: "./private_key.pem" services: - name: web target: localhost:8080 type: http ``` In the file, replace: * `` with the tunnel ID. If you use the CLI, it's the value of `$TUNNEL_ID`. * `` with the service account ID. If you use the CLI, it's the value of `$SA_ID`. * `` with the ID of the authorized key. If you use the CLI, it's the value of `$PUBLIC_KEY_ID`. In the agent configuration, `services.name` can contain up to 20 characters and must use only lowercase Latin letters and digits (`[a-z0-9]`). Don't use dashes or dots. For multiple services, configure the `services` section like this: ```yaml services: - name: api target: localhost:8080 type: http - name: grpc target: localhost:9090 type: http protocol: h2 - name: db target: localhost:5432 type: tcp ``` 3. Run the agent using a cross-platform Docker image: ```bash docker run -v $PWD:/home/nonroot \ cr.eu-north1.nebius.cloud/marketplace/docker/nebius-tunnel-agent:latest \ -config ./config.yaml ``` When the agent connects, it returns the public endpoint for each service. The endpoint format is: ```text -.tunnel.applications..nebius.cloud:443 ``` Where: * `service_name` is the `services.name` value from the agent configuration. * `tunnel_masked_ID` is the mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. For example, for `applicationtunnel-e00abcdef123456789`, the tunnel ID mask is `abcdef123456789`. * `region` is the [region](https://docs.nebius.com/overview/regions.md) of the project where the tunnel was created, for example `eu-north1`. #### Running the agent by using Helm 1. [Install Helm](https://helm.sh/docs/intro/install/). 2. Create `custom.values.yaml` with the service account credentials and agent config: ```yaml secret: data: private_key.pem: | # Your private key items: - key: private_key.pem path: sa/private_key.pem config: tunnel_id: iam: service_account: service_account_id: public_key_id: private_key_path: sa/private_key.pem services: - name: web target: localhost:8080 type: http ``` In the file, replace: * `` with the tunnel ID. If you use the CLI, it's the value of `$TUNNEL_ID`. * `` with the service account ID. If you use the CLI, it's the value of `$SA_ID`. * `` with the ID of the authorized key. If you use the CLI, it's the value of `$PUBLIC_KEY_ID`. * The private key placeholder with the contents of `private_key.pem`. In the agent configuration, `services.name` can contain up to 20 characters and must use only lowercase Latin letters and digits (`[a-z0-9]`). Don't use dashes or dots. For multiple services, add them to the `config.services` section: ```yaml config: services: - name: api target: localhost:8080 type: http - name: grpc target: localhost:9090 type: http protocol: h2 - name: db target: localhost:5432 type: tcp ``` 3. Install the agent in your Kubernetes cluster: ```bash helm install nebius-tunnel-agent \ oci://cr.eu-north1.nebius.cloud/marketplace/chart/nebius-tunnel-agent \ -f custom.values.yaml ``` When the agent connects, it returns the public endpoint for each service. The endpoint format is: ```text -.tunnel.applications..nebius.cloud:443 ``` Where: * `service_name` is the `services.name` value from the agent configuration. * `tunnel_masked_ID` is the mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. For example, for `applicationtunnel-e00abcdef123456789`, the tunnel ID mask is `abcdef123456789`. * `region` is the [region](https://docs.nebius.com/overview/regions.md) of the project where the tunnel was created, for example `eu-north1`. #### Running the agent on a VM On a Nebius VM, the agent authenticates through the instance metadata service. This requires attaching a service account to the VM when you create it, as described in [Prerequisites](https://docs.nebius.com/tunnels/connect.md#prerequisites). 1. Prepare the cloud-init configuration file. You'll attach it to the VM when you create it. Save the following configuration to a file named `cloud-init.yaml` in your working directory. Before saving, replace: * `` with the username you'll use to connect. * `` with your SSH public key. * `` with the tunnel ID. If you use the CLI, it's the value of `$TUNNEL_ID`. > [accordion] cloud-init.yaml > > ```yaml > users: > - name: > sudo: "ALL=(ALL) NOPASSWD:ALL" > shell: /bin/bash > ssh_authorized_keys: > - > > write_files: > - path: /etc/nebius-tunnel-agent/config.yaml > permissions: "0640" > content: | > tunnel_id: > > iam: > metadata: > enabled: true > > services: > - name: web > target: 127.0.0.1:8080 > type: http > > - path: /etc/systemd/system/nebius-tunnel-agent.service > permissions: "0644" > content: | > [Unit] > Description=Nebius tunnel agent > Documentation=https://docs.nebius.com/tunnels > After=network-online.target > Wants=network-online.target > > [Service] > Type=simple > User=tunna > Group=tunna > ExecStart=/usr/local/bin/nebius-tunnel-agent --config /etc/nebius-tunnel-agent/config.yaml > Restart=always > RestartSec=5 > NoNewPrivileges=true > ProtectSystem=strict > ProtectHome=true > PrivateTmp=true > ReadOnlyPaths=/etc/nebius-tunnel-agent > > [Install] > WantedBy=multi-user.target > > - path: /usr/local/sbin/install-nebius-tunnel-agent > permissions: "0755" > content: | > #!/bin/bash > set -euo pipefail > > VERSION="${AGENT_VERSION:-latest}" > BASE="https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent" > CONF_DIR=/etc/nebius-tunnel-agent > > # Select the agent archive for the VM architecture > case "$(uname -m)" in > x86_64) PLATFORM=linux-x86_64 ;; > aarch64|arm64) PLATFORM=linux-aarch64 ;; > *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; > esac > ASSET="nebius-tunnel-agent-${PLATFORM}.tar.gz" > > TMP="$(mktemp -d)" > trap 'rm -rf "$TMP"' EXIT > > # Download a file with retry handling > fetch() { > curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$2" "$1" > } > > # Download and verify the agent archive > fetch "$BASE/$VERSION/$ASSET" "$TMP/$ASSET" > fetch "$BASE/$VERSION/checksums-sha256.txt" "$TMP/checksums-sha256.txt" > (cd "$TMP" && sha256sum --ignore-missing -c checksums-sha256.txt) > > # Install the agent binary > tar -xzf "$TMP/$ASSET" -C "$TMP" > install -m0755 "$TMP/nebius-tunnel-agent" /usr/local/bin/nebius-tunnel-agent > > # Create the dedicated system user and start the service > getent group tunna >/dev/null || groupadd --system tunna > id -u tunna >/dev/null 2>&1 || useradd --system --gid tunna \ > --no-create-home --shell /usr/sbin/nologin tunna > chown -R tunna:tunna "$CONF_DIR" > chmod 0750 "$CONF_DIR" > chmod 0640 "$CONF_DIR/config.yaml" > > systemctl daemon-reload > systemctl enable nebius-tunnel-agent.service > systemctl restart nebius-tunnel-agent.service > > runcmd: > - [/usr/local/sbin/install-nebius-tunnel-agent] > ``` > > This configuration enables the following actions: > > * Add a username and a public SSH key to the VM. > * Download the tunnel agent, verify its checksum and install it as a systemd service running under a dedicated `tunna` system user. > * Authenticate by using the service account attached to the VM, through the instance metadata service. No key files are involved. > * Create the `web` [Nebius Tunnels service](https://docs.nebius.com/tunnels/overview.md#supported-traffic) that exposes `127.0.0.1:8080` on the VM. In the agent configuration, `services.name` can contain up to 20 characters and must use only lowercase Latin letters and digits (`[a-z0-9]`). Don't use dashes or dots. For multiple services, add them to the `services` section of `config.yaml` in the `cloud-init` file: ```yaml services: - name: api target: 127.0.0.1:8080 type: http - name: grpc target: 127.0.0.1:9090 type: http protocol: h2 - name: db target: 127.0.0.1:5432 type: tcp ``` 2. Create the VM: > [tab] CLI > > ```bash > nebius compute instance create \ > --name tunnel-agent-vm \ > --resources-platform cpu-d3 \ > --resources-preset 4vcpu-16gb \ > --boot-disk-attach-mode READ_WRITE \ > --boot-disk-managed-disk-name tunnel-agent-vm-boot \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 20 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"public_ip_address\": {}, \"subnet_id\": \"\"}]" \ > --service-account-id \ > --cloud-init-user-data "$(cat cloud-init.yaml)" > ``` > > In the command, specify the subnet ID from [Prerequisites](https://docs.nebius.com/tunnels/connect.md#prerequisites-cli) and the ID of the service account you created earlier. > [tab] Go SDK > > ```go > cloudInit, err := os.ReadFile("cloud-init.yaml") > if err != nil { > return fmt.Errorf("read cloud init: %w", err) > } > resources := &compute.ResourcesSpec{ > Platform: "cpu-d3", > Size: &compute.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > } > bootDiskSpec := &compute.DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 20, > }, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > } > bootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "tunnel-agent-vm-boot", > Spec: bootDiskSpec, > }, > }, > } > networkInterface := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: "", > IpAddress: &compute.IPAddress{}, > PublicIpAddress: &compute.PublicIPAddress{}, > } > createInstanceService := sdk.Services().Compute().V1(). > Instance() > createInstanceOperation, err := createInstanceService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agent-vm", > }, > Spec: &compute.InstanceSpec{ > Resources: resources, > BootDisk: bootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > networkInterface, > }, > ServiceAccountId: "", > CloudInitUserData: string(cloudInit), > }, > }, > ) > if err != nil { > return fmt.Errorf("create instance: %w", err) > } > createInstanceOperation, err = createInstanceOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create instance: %w", err) > } > ``` > > In the code, set `SubnetId` in `NetworkInterfaceSpec` to the subnet ID from [Prerequisites](https://docs.nebius.com/tunnels/connect.md#prerequisites-go-sdk) and `ServiceAccountId` in `InstanceSpec` to the ID of the service account you created earlier. The code reads the cloud-init configuration from the `cloud-init.yaml` file in the working directory. > [tab] Python SDK > > ```python > cloud_init = Path("cloud-init.yaml").read_text() > boot_disk_spec = DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > size_gibibytes=20, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-driverless", > ), > ) > boot_disk = AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > managed_disk=ManagedDisk( > name="tunnel-agent-vm-boot", > spec=boot_disk_spec, > ), > ) > network_interface = NetworkInterfaceSpec( > name="eth0", > subnet_id="", > ip_address=IPAddress(), > public_ip_address=PublicIPAddress(), > ) > create_instance_service = InstanceServiceClient(sdk) > create_instance_operation = await create_instance_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="tunnel-agent-vm", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > boot_disk=boot_disk, > network_interfaces=[network_interface], > service_account_id="", > cloud_init_user_data=cloud_init, > ), > ), > ) > await create_instance_operation.wait() > ``` > > In the code, set `subnet_id` in `NetworkInterfaceSpec` to the subnet ID from [Prerequisites](https://docs.nebius.com/tunnels/connect.md#prerequisites-python-sdk) and `service_account_id` in `InstanceSpec` to the ID of the service account you created earlier. The code reads the cloud-init configuration from the `cloud-init.yaml` file in the working directory. > [tab] JavaScript SDK > > ```ts > const cloudInit = await readFile("cloud-init.yaml", "utf8"); > const sourceImage = SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }); > const bootDiskSpec = DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 20, > }, > source: { > $case: "sourceImageFamily", > sourceImageFamily: sourceImage, > }, > }); > const managedDisk = ManagedDisk.create({ > name: "tunnel-agent-vm-boot", > spec: bootDiskSpec, > }); > const bootDisk = AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk, > }, > }); > const networkInterface = NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: "", > ipAddress: IPAddress.create({}), > publicIpAddress: PublicIPAddress.create({}), > }); > const createInstanceService = new InstanceService(sdk); > const createInstanceOperation = > await createInstanceService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agent-vm", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > bootDisk: bootDisk, > networkInterfaces: [networkInterface], > serviceAccountId: "", > cloudInitUserData: cloudInit, > }), > }), > ).result; > await createInstanceOperation.wait(); > ``` > > In the code, set `subnetId` in `NetworkInterfaceSpec` to the subnet ID from [Prerequisites](https://docs.nebius.com/tunnels/connect.md#prerequisites-javascript-sdk) and `serviceAccountId` in `InstanceSpec` to the ID of the service account you created earlier. The code reads the cloud-init configuration from the `cloud-init.yaml` file in the working directory. 3. Get the public IP address of the VM: > [tab] CLI > > ```bash > export PUBLIC_IP_ADDRESS=$(nebius compute instance get-by-name \ > --name \ > --format json \ > | jq -r '.status.network_interfaces[0].public_ip_address.address | split("/")[0]') > ``` > > In the command, specify the name of the VM you created. > [tab] Go SDK > > ```go > publicInstance, err := sdk.Services().Compute().V1(). > Instance().GetByName( > ctx, > &common.GetByNameRequest{ > Name: "", > }, > ) > if err != nil { > return err > } > publicAddress := publicInstance.GetStatus(). > GetNetworkInterfaces()[0].GetPublicIpAddress().GetAddress() > publicIPAddress := strings.Split(publicAddress, "/")[0] > if publicIPAddress == "" { > return fmt.Errorf("public IP address is missing") > } > ``` > > In the code, set `Name` in `GetByNameRequest` to the name of the VM you created. The code saves the public IP address to `publicIPAddress`. > [tab] Python SDK > > ```python > public_ip_service = InstanceServiceClient(sdk) > public_instance = await public_ip_service.get_by_name( > GetByNameRequest(name=""), > ) > public_address = ( > public_instance.status.network_interfaces[0] > .public_ip_address.address > ) > public_ip_address = public_address.split("/")[0] > ``` > > In the code, set `name` in `GetByNameRequest` to the name of the VM you created. The code saves the public IP address to `public_ip_address`. > [tab] JavaScript SDK > > ```ts > const publicIpInstanceService = new InstanceService(sdk); > const publicIpInstance = await publicIpInstanceService.getByName( > GetByNameRequest.create({ > name: "", > }), > ); > const publicAddress = publicIpInstance.status > ?.networkInterfaces[0]?.publicIpAddress?.address; > let publicIpAddress = publicAddress?.split("/")[0]; > ``` > > In the code, set `name` in `GetByNameRequest` to the name of the VM you created. The code saves the public IP address to `publicIpAddress`. To connect from another VM in the same network, get the [private IP address or FQDN](https://docs.nebius.com/compute/virtual-machines/connect.md#connect-to-the-vm-by-using-ssh) instead. 4. Connect to the VM: ```bash ssh @ ``` 5. Verify that the agent registered with the tunnel: To confirm that the agent registered with the tunnel, check the status of the service: ```bash sudo systemctl status nebius-tunnel-agent ``` For live logs, run: ```bash sudo journalctl -u nebius-tunnel-agent -f ``` If the agent doesn't register, check the logs for these common causes: * **The VM has no service account attached.** `systemctl status` still shows `active (running)`, but the agent retries indefinitely, showing `IMDS token request failed: 404 Not Found` followed by `connection closed before registering`. You can't attach a service account to an existing VM. Create a new one with `--service-account-id` instead. * **The attached service account doesn't have the `applicationtunnel.agent` role.** The agent authenticates, but the tunnel rejects the connection. Grant the role to the service account as described earlier in this guide. In the log output, the agent reports the public endpoint for each service. The endpoint format is: ```text -.tunnel.applications..nebius.cloud ``` Where: * `service_name` is the `services.name` value from the agent configuration. * `tunnel_masked_ID` is the mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. For example, for `applicationtunnel-e00abcdef123456789`, the tunnel ID mask is `abcdef123456789`. * `region` is the [region](https://docs.nebius.com/overview/regions.md) of the project where the tunnel was created, for example `eu-north1`. # How to delete a tunnel in Nebius Tunnels Source: https://docs.nebius.com/tunnels/delete.md When you delete a tunnel, its public service URLs stop working. Deleting a tunnel doesn't delete service accounts, groups, authorized keys, tunnel agent configuration files or virtual machines that you created for the agent. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > 2. Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > ```bash > cat ~/.nebius/config.yaml > ``` > > 3. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > 2. Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. ## Deleting a tunnel > [tab] Web console > > 1. In the [web console](https://console.nebius.com), go to **Networking** → **Tunnels**. > > 2. Click next to the tunnel that you want to delete and click **Delete**. > > 3. Confirm the deletion. > [tab] CLI > > 1. Get the list of tunnels: > > ```bash > nebius tunnel list > ``` > > In the output, find the tunnel by its title and copy its ID from the `metadata.id` field. The ID has the `applicationtunnel-...` format. > > 2. Delete the tunnel: > > ```bash > nebius tunnel delete --id > ``` > [tab] Go SDK > > 1. Get the list of tunnels: > > ```go > listTunnelsService := sdk.Services().Tunnel().V1(). > Tunnel() > listTunnels, err := listTunnelsService.List( > ctx, > &tunnel.ListTunnelRequest{}, > ) > if err != nil { > return fmt.Errorf("list tunnels: %w", err) > } > fmt.Println(listTunnels) > ``` > > In the output, find the tunnel by its title and copy its ID from `Metadata.Id`. The ID has the `applicationtunnel-...` format. > > 2. Delete the tunnel: > > ```go > deleteTunnelService := sdk.Services().Tunnel().V1(). > Tunnel() > deleteTunnelOperation, err := deleteTunnelService.Delete( > ctx, > &tunnel.DeleteTunnelRequest{ > Id: "", > }, > ) > if err != nil { > return fmt.Errorf("delete tunnel: %w", err) > } > deleteTunnelOperation, err = deleteTunnelOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for delete tunnel: %w", err) > } > ``` > > In the code, set `Id` in `DeleteTunnelRequest` to the tunnel ID. > [tab] Python SDK > > 1. Get the list of tunnels: > > ```python > list_tunnels_service = TunnelServiceClient(sdk) > list_tunnels = await list_tunnels_service.list( > ListTunnelRequest(), > ) > print(list_tunnels) > ``` > > In the output, find the tunnel by its title and copy its ID from `metadata.id`. The ID has the `applicationtunnel-...` format. > > 2. Delete the tunnel: > > ```python > delete_tunnel_service = TunnelServiceClient(sdk) > delete_tunnel_operation = await delete_tunnel_service.delete( > DeleteTunnelRequest( > id="", > ), > ) > await delete_tunnel_operation.wait() > ``` > > In the code, set `id` in `DeleteTunnelRequest` to the tunnel ID. > [tab] JavaScript SDK > > 1. Get the list of tunnels: > > ```ts > const listTunnelsService = new TunnelService(sdk); > const listTunnels = await listTunnelsService.list( > ListTunnelRequest.create({}), > ).result; > console.log(listTunnels); > ``` > > In the output, find the tunnel by its title and copy its ID from `metadata.id`. The ID has the `applicationtunnel-...` format. > > 2. Delete the tunnel: > > ```ts > const deleteTunnelService = new TunnelService(sdk); > const deleteTunnelOperation = await deleteTunnelService.delete( > DeleteTunnelRequest.create({ > id: "", > }), > ).result; > await deleteTunnelOperation.wait(); > ``` > > In the code, set `id` in `DeleteTunnelRequest` to the tunnel ID. If you created a dedicated service account and a group for the tunnel agent, delete them separately when you no longer need them. # Connecting to a virtual machine without a public IP address by using Nebius Tunnels Source: https://docs.nebius.com/tunnels/tutorials/connect-vm.md You can use SSH to connect to a virtual machine (VM) that has no public IP address by using a [tunnel](https://docs.nebius.com/tunnels/overview.md#how-tunnels-work) in Nebius Tunnels. The VM stays isolated from the internet, and you don't need a bastion host or a VPN to reach it. To establish the tunnel, the VM configuration includes a tunnel agent. The agent runs on the VM automatically after the VM starts. When you connect to the VM, the tunnel routes the traffic to the agent. Thus, only the IP address of the tunnel is exposed to the internet. > [!NOTE] > > Use one VM per tunnel. Do not add several VMs to a single tunnel. ## Costs Nebius AI Cloud charges you for the following billing items: * [Compute virtual machine](https://docs.nebius.com/compute/resources/pricing.md#virtual-machines-gpus-vcpus-ram) * [Boot disk](https://docs.nebius.com/compute/resources/pricing.md#disks) attached to the VM Nebius Tunnels is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and provided free of charge. ## Steps ### Create a tunnel > [tab] Web console > > 1. In the [web console](https://console.nebius.com), select the project where you want to create the infrastructure. All resources must be located in the same project. > 2. Go to  **Networking** → **Tunnels**. > 3. Click  **Create tunnel**. > 4. On the page that opens, set the tunnel name to `my-tunnel`. > 5. Click **Create tunnel**. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > When configuring the CLI profile, set the project where you want to create the infrastructure. All resources must be located in the same project. > > All `nebius` commands by default use the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) from your CLI profile configuration. > > 2. Create a tunnel: > > ```bash > nebius tunnel create --title my-tunnel > ``` > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `gosdk.WithParentID`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```go > createTunnelService := sdk.Services().Tunnel().V1(). > Tunnel() > createTunnelOperation, err := createTunnelService.Create( > ctx, > &tunnel.CreateTunnelRequest{ > Spec: &tunnel.TunnelSpec{ > Title: "my-tunnel", > }, > }, > ) > if err != nil { > return fmt.Errorf("create tunnel: %w", err) > } > createTunnelOperation, err = createTunnelOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create tunnel: %w", err) > } > tunnelID := createTunnelOperation.ResourceID() > fmt.Println(tunnelID) > ``` > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parent_id`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```python > create_tunnel_service = TunnelServiceClient(sdk) > create_tunnel_operation = await create_tunnel_service.create( > CreateTunnelRequest( > spec=TunnelSpec( > title="my-tunnel", > ), > ), > ) > await create_tunnel_operation.wait() > tunnel_id = create_tunnel_operation.resource_id > print(tunnel_id) > ``` > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parentId`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```ts > const createTunnelService = new TunnelService(sdk); > const createTunnelOperation = await createTunnelService.create( > CreateTunnelRequest.create({ > metadata: ResourceMetadata.create({}), > spec: TunnelSpec.create({ > title: "my-tunnel", > }), > }), > ).result; > await createTunnelOperation.wait(); > const tunnelId = createTunnelOperation.resourceId(); > console.log(tunnelId); > ``` ### Configure access for the tunnel agent To authorize the VM in the tunnel, prepare a service account with the `applicationtunnel.agent` role. Later, you attach this service account to the VM. 1. Create the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Service account**. > 3. In the window that opens, set the name to `tunnel-agent-sa` and select the project. > 4. Click **Create and continue**. > [tab] CLI > > ```bash > nebius iam service-account create --name tunnel-agent-sa > ``` > [tab] Go SDK > > ```go > createSaService := sdk.Services().IAM().V1(). > ServiceAccount() > createSaOperation, err := createSaService.Create( > ctx, > &iam.CreateServiceAccountRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agent-sa", > }, > Spec: &iam.ServiceAccountSpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create service account: %w", err) > } > createSaOperation, err = createSaOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create service account: %w", err) > } > saID := createSaOperation.ResourceID() > fmt.Println(saID) > ``` > [tab] Python SDK > > ```python > create_sa_service = ServiceAccountServiceClient(sdk) > create_sa_operation = await create_sa_service.create( > CreateServiceAccountRequest( > metadata=ResourceMetadata( > name="tunnel-agent-sa", > ), > spec=ServiceAccountSpec(), > ), > ) > await create_sa_operation.wait() > sa_id = create_sa_operation.resource_id > print(sa_id) > ``` > [tab] JavaScript SDK > > ```ts > const createSaService = new ServiceAccountService(sdk); > const createSaOperation = await createSaService.create( > CreateServiceAccountRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agent-sa", > }), > spec: ServiceAccountSpec.create({}), > }), > ).result; > await createSaOperation.wait(); > const saId = createSaOperation.resourceId(); > console.log(saId); > ``` 2. Create a [custom group](https://docs.nebius.com/iam/authorization/groups/index.md#custom-groups) in Identity and Access Management to assign the role to the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Group**. > 3. In the window that opens, set the group name to `tunnel-agents`. In the **Scope** field, select the project where you create all the resources. > 4. Click **Create**. > [tab] CLI > > ```bash > nebius iam group create --name tunnel-agents > ``` > [tab] Go SDK > > ```go > createGroupService := sdk.Services().IAM().V1(). > Group() > createGroupOperation, err := createGroupService.Create( > ctx, > &iam.CreateGroupRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agents", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group: %w", err) > } > createGroupOperation, err = createGroupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group: %w", err) > } > groupID := createGroupOperation.ResourceID() > fmt.Println(groupID) > ``` > [tab] Python SDK > > ```python > create_group_service = GroupServiceClient(sdk) > create_group_operation = await create_group_service.create( > CreateGroupRequest( > metadata=ResourceMetadata( > name="tunnel-agents", > ), > ), > ) > await create_group_operation.wait() > group_id = create_group_operation.resource_id > print(group_id) > ``` > [tab] JavaScript SDK > > ```ts > const createGroupService = new GroupService(sdk); > const createGroupOperation = await createGroupService.create( > CreateGroupRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agents", > }), > }), > ).result; > await createGroupOperation.wait(); > const groupId = createGroupOperation.resourceId(); > console.log(groupId); > ``` 3. Attach the tunnel and grant the `applicationtunnel.agent` role to this group. You can't grant this role in the web console. > [tab] CLI > > 1. Get the group ID: > > ```bash > nebius iam group list > ``` > > The ID is specified in the `items.metadata.id` parameter in the output. > > 2. Get the tunnel ID: > > ```bash > nebius tunnel list > ``` > > 3. Create an access permit in the custom group: > > ```bash > nebius iam access-permit create \ > --parent-id \ > --resource-id \ > --role applicationtunnel.agent > ``` > [tab] Go SDK > > 1. Get the group ID: > > ```go > listGroupsService := sdk.Services().IAM().V1(). > Group() > listGroups, err := listGroupsService.List( > ctx, > &iam.ListGroupsRequest{}, > ) > if err != nil { > return fmt.Errorf("list groups: %w", err) > } > fmt.Println(listGroups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `Metadata.Id`. > > 2. Get the tunnel ID: > > ```go > listTunnelsService := sdk.Services().Tunnel().V1(). > Tunnel() > listTunnels, err := listTunnelsService.List( > ctx, > &tunnel.ListTunnelRequest{}, > ) > if err != nil { > return fmt.Errorf("list tunnels: %w", err) > } > fmt.Println(listTunnels) > ``` > > 3. Create an access permit in the custom group: > > ```go > accessPermitService := sdk.Services().IAM().V1(). > AccessPermit() > accessPermitOperation, err := accessPermitService.Create( > ctx, > &iam.CreateAccessPermitRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.AccessPermitSpec{ > ResourceId: "", > Role: "applicationtunnel.agent", > }, > }, > ) > if err != nil { > return fmt.Errorf("create access permit: %w", err) > } > accessPermitOperation, err = accessPermitOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create access permit: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `ResourceId` in `AccessPermitSpec` to the tunnel ID. > [tab] Python SDK > > 1. Get the group ID: > > ```python > list_groups_service = GroupServiceClient(sdk) > list_groups = await list_groups_service.list( > ListGroupsRequest(), > ) > print(list_groups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```python > list_tunnels_service = TunnelServiceClient(sdk) > list_tunnels = await list_tunnels_service.list( > ListTunnelRequest(), > ) > print(list_tunnels) > ``` > > 3. Create an access permit in the custom group: > > ```python > access_permit_service = AccessPermitServiceClient(sdk) > access_permit_operation = await access_permit_service.create( > CreateAccessPermitRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=AccessPermitSpec( > resource_id="", > role="applicationtunnel.agent", > ), > ), > ) > await access_permit_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `resource_id` in `AccessPermitSpec` to the tunnel ID. > [tab] JavaScript SDK > > 1. Get the group ID: > > ```ts > const listGroupsService = new GroupService(sdk); > const listGroups = await listGroupsService.list( > ListGroupsRequest.create({}), > ).result; > console.log(listGroups); > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```ts > const listTunnelsService = new TunnelService(sdk); > const listTunnels = await listTunnelsService.list( > ListTunnelRequest.create({}), > ).result; > console.log(listTunnels); > ``` > > 3. Create an access permit in the custom group: > > ```ts > const accessPermitService = new AccessPermitService(sdk); > const accessPermitOperation = await accessPermitService.create( > CreateAccessPermitRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: AccessPermitSpec.create({ > resourceId: "", > role: "applicationtunnel.agent", > }), > }), > ).result; > await accessPermitOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `resourceId` in `AccessPermitSpec` to the tunnel ID. 4. Add the service account to the group: > [tab] Web console > > 1. Go to  **Administration** → **IAM**. > 2. On the **Groups** tab, find and open the `tunnel-agents` group. > 3. Click  **Add members**. > 4. In the window that opens, open the **Service accounts** tab and add the `tunnel-agent-sa` service account. > 5. Once the account is added, close the window. > > Check the group page in general. Make sure that: > > * The `tunnel-agent-sa` service account is specified on the **Members** tab. > * The tunnel and the `applicationtunnel.agent` role are specified on the **Access permits** tab. > [tab] CLI > > ```bash > nebius iam group-membership create \ > --parent-id \ > --member-id > ``` > > To get the service account ID, run: > > ```bash > nebius iam service-account list > ``` > [tab] Go SDK > > ```go > membershipService := sdk.Services().IAM().V1(). > GroupMembership() > membershipOperation, err := membershipService.Create( > ctx, > &iam.CreateGroupMembershipRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.GroupMembershipSpec{ > MemberId: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group membership: %w", err) > } > membershipOperation, err = membershipOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group membership: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `MemberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```go > listServiceAccountsService := sdk.Services().IAM().V1(). > ServiceAccount() > listServiceAccounts, err := listServiceAccountsService.List( > ctx, > &iam.ListServiceAccountRequest{}, > ) > if err != nil { > return fmt.Errorf("list service accounts: %w", err) > } > fmt.Println(listServiceAccounts) > ``` > [tab] Python SDK > > ```python > membership_service = GroupMembershipServiceClient(sdk) > membership_operation = await membership_service.create( > CreateGroupMembershipRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=GroupMembershipSpec( > member_id="", > ), > ), > ) > await membership_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `member_id` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```python > list_service_accounts_service = ( > ServiceAccountServiceClient(sdk) > ) > list_service_accounts = await list_service_accounts_service.list( > ListServiceAccountRequest(), > ) > print(list_service_accounts) > ``` > [tab] JavaScript SDK > > ```ts > const membershipService = new GroupMembershipService(sdk); > const membershipOperation = await membershipService.create( > CreateGroupMembershipRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: GroupMembershipSpec.create({ > memberId: "", > }), > }), > ).result; > await membershipOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `memberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```ts > const listServiceAccountsService = > new ServiceAccountService(sdk); > const listServiceAccounts = await listServiceAccountsService.list( > ListServiceAccountRequest.create({}), > ).result; > console.log(listServiceAccounts); > ``` ### Create a virtual machine Prepare the VM configuration that includes the tunnel agent. Then, create the VM. The agent is deployed on the VM automatically. > [!WARNING] > > If you need to change the VM configuration later, delete the VM and create a new one. A tunnel should be associated with only one VM, and you can't change the cloud-init configuration of an existing VM. 1. [Generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#generating-a-key-pair). 2. Prepare the cloud-init configuration file. You'll attach it to the VM. In this file, specify two parameters: * `users.ssh_authorized_keys`: Public SSH key. * `write_files.content.tunnel_id`: ID of the tunnel. > [accordion] ssh.yaml > > ```yaml > users: > - name: ubuntu > sudo: "ALL=(ALL) NOPASSWD:ALL" > shell: /bin/bash > ssh_authorized_keys: > - > > write_files: > - path: /etc/nebius-tunnel-agent/config.yaml > permissions: "0640" > content: | > tunnel_id: > > iam: > metadata: > enabled: true > > logging: > level: info > format: json > > services: > - name: ssh > type: tcp > target: 127.0.0.1:22 > > - path: /etc/systemd/system/nebius-tunnel-agent.service > permissions: "0644" > content: | > [Unit] > Description=Nebius tunnel agent > Documentation=https://docs.nebius.com/tunnels > After=network-online.target > Wants=network-online.target > > [Service] > Type=simple > User=tunna > Group=tunna > ExecStart=/usr/local/bin/nebius-tunnel-agent --config /etc/nebius-tunnel-agent/config.yaml > Restart=always > RestartSec=5 > NoNewPrivileges=true > ProtectSystem=strict > ProtectHome=true > PrivateTmp=true > ReadOnlyPaths=/etc/nebius-tunnel-agent > > [Install] > WantedBy=multi-user.target > > - path: /usr/local/sbin/install-nebius-tunnel-agent > permissions: "0755" > content: | > #!/bin/bash > set -euo pipefail > > VERSION="${AGENT_VERSION:-latest}" > BASE="https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent" > CONF_DIR=/etc/nebius-tunnel-agent > > case "$(uname -m)" in > x86_64) PLATFORM=linux-x86_64 ;; > aarch64|arm64) PLATFORM=linux-aarch64 ;; > *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; > esac > ASSET="nebius-tunnel-agent-${PLATFORM}.tar.gz" > > TMP="$(mktemp -d)" > trap 'rm -rf "$TMP"' EXIT > > fetch() { > curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$2" "$1" > } > fetch "$BASE/$VERSION/$ASSET" "$TMP/$ASSET" > fetch "$BASE/$VERSION/checksums-sha256.txt" "$TMP/checksums-sha256.txt" > > (cd "$TMP" && sha256sum --ignore-missing -c checksums-sha256.txt) > > tar -xzf "$TMP/$ASSET" -C "$TMP" > install -m0755 "$TMP/nebius-tunnel-agent" /usr/local/bin/nebius-tunnel-agent > > getent group tunna >/dev/null || groupadd --system tunna > id -u tunna >/dev/null 2>&1 || useradd --system --gid tunna \ > --no-create-home --shell /usr/sbin/nologin tunna > chown -R tunna:tunna "$CONF_DIR" > chmod 0750 "$CONF_DIR" > chmod 0640 "$CONF_DIR/config.yaml" > > systemctl daemon-reload > systemctl enable nebius-tunnel-agent.service > systemctl restart nebius-tunnel-agent.service > > runcmd: > - [/usr/local/sbin/install-nebius-tunnel-agent] > ``` > > This configuration enables the following actions: > > * Add a username and a public SSH key to the VM. > * Deploy the tunnel agent. > * Authenticate by using the service account attached to the VM. > * Create the `ssh` [Nebius Tunnels service](https://docs.nebius.com/tunnels/overview.md#supported-traffic). Use it to connect to the tunnel. 3. Create the VM: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. On the **Compute** step, configure computing resources: > > 1. In the **Platform** section, select: > > * Without GPUs > * Regular > * Non-GPU AMD Epyc Genoa > 2. In the **Settings** section, set: > > * **Preset**: 4 CPUs - 16 GiB RAM. > * **Project**: Project where you create all resources for the tunnel. > * **VM name**: `tunnel-vm`. > > 4. On the **Storage** step, preserve the **Ubuntu 24.04 LTS** disk image and the SSD disk type, but change the disk size to 20 GiB. > > 5. On the **Network** step, check the network and subnet. In the **Public IP address** field, select **None**. > > 6. On the **Configuration** step, configure the access, identity and VM startup settings: > > 1. In the **Service account** field, select the `tunnel-agent-sa` service account. > 2. In the **Custom cloud-init config** section, select **Enable custom cloud-init config**. > 3. In the field that appears, paste the contents of the `ssh.yaml` file prepared earlier. > > 7. On the **Review** step, check the full VM configuration. To change a section quickly, click  next to the corresponding block. The wizard opens the relevant step with your current settings. > > 8. Click **Create VM**. > [tab] CLI > > ```bash > nebius compute instance create \ > --name tunnel-vm \ > --resources-platform cpu-d3 \ > --resources-preset 4vcpu-16gb \ > --boot-disk-attach-mode READ_WRITE \ > --boot-disk-managed-disk-name tunnel-vm-boot \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 20 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"subnet_id\": \"\"}]" \ > --service-account-id \ > --cloud-init-user-data "$(cat ssh.yaml)" > ``` > > In the command, specify the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) and the ID of the `tunnel-agent-sa` service account. > [tab] Go SDK > > ```go > cloudInit, err := os.ReadFile("ssh.yaml") > if err != nil { > return fmt.Errorf("read cloud init: %w", err) > } > resources := &compute.ResourcesSpec{ > Platform: "cpu-d3", > Size: &compute.ResourcesSpec_Preset{ > Preset: "4vcpu-16gb", > }, > } > bootDiskSpec := &compute.DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 20, > }, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > } > bootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "tunnel-vm-boot", > Spec: bootDiskSpec, > }, > }, > } > networkInterface := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: "", > IpAddress: &compute.IPAddress{}, > } > createVmService := sdk.Services().Compute().V1(). > Instance() > createVmOperation, err := createVmService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-vm", > }, > Spec: &compute.InstanceSpec{ > Resources: resources, > BootDisk: bootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > networkInterface, > }, > ServiceAccountId: "", > CloudInitUserData: string(cloudInit), > }, > }, > ) > if err != nil { > return fmt.Errorf("create instance: %w", err) > } > createVmOperation, err = createVmOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create instance: %w", err) > } > ``` > > In the code, set `SubnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) and `ServiceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `ssh.yaml` file in the working directory. > [tab] Python SDK > > ```python > cloud_init = Path("ssh.yaml").read_text() > boot_disk_spec = DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > size_gibibytes=20, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-driverless", > ), > ) > boot_disk = AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > managed_disk=ManagedDisk( > name="tunnel-vm-boot", > spec=boot_disk_spec, > ), > ) > network_interface = NetworkInterfaceSpec( > name="eth0", > subnet_id="", > ip_address=IPAddress(), > ) > create_vm_service = InstanceServiceClient(sdk) > create_vm_operation = await create_vm_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="tunnel-vm", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-d3", > preset="4vcpu-16gb", > ), > boot_disk=boot_disk, > network_interfaces=[network_interface], > service_account_id="", > cloud_init_user_data=cloud_init, > ), > ), > ) > await create_vm_operation.wait() > ``` > > In the code, set `subnet_id` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) and `service_account_id` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `ssh.yaml` file in the working directory. > [tab] JavaScript SDK > > ```ts > const cloudInit = await readFile("ssh.yaml", "utf8"); > const sourceImage = SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }); > const bootDiskSpec = DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 20, > }, > source: { > $case: "sourceImageFamily", > sourceImageFamily: sourceImage, > }, > }); > const managedDisk = ManagedDisk.create({ > name: "tunnel-vm-boot", > spec: bootDiskSpec, > }); > const bootDisk = AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk, > }, > }); > const networkInterface = NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: "", > ipAddress: IPAddress.create({}), > }); > const createVmService = new InstanceService(sdk); > const createVmOperation = await createVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-vm", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "4vcpu-16gb", > }, > }), > bootDisk: bootDisk, > networkInterfaces: [networkInterface], > serviceAccountId: "", > cloudInitUserData: cloudInit, > }), > }), > ).result; > await createVmOperation.wait(); > ``` > > In the code, set `subnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) and `serviceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `ssh.yaml` file in the working directory. Wait for the VM to start running. ### Connect to the virtual machine Connect to the VM through the `ssh` tunnel service: ```bash ssh -o ProxyCommand="openssl s_client -quiet -verify_quiet -servername %h -connect %h:443" \ ubuntu@ssh-.tunnel.applications..nebius.cloud ``` In the VM address, specify: * `tunnel_masked_ID`: Mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. Contains the last 15 characters of the tunnel ID. For example, for `applicationtunnel-e00abcdef123456789`, the masked ID of the tunnel is `abcdef123456789`. * `region`: [Region](https://docs.nebius.com/overview/regions.md) of the project where you created the resources. For more information about the tunnel URL, see [Supported traffic](https://docs.nebius.com/tunnels/overview.md#supported-traffic). After the connection is established, the command line shows the prompt of the VM. The hostname of the VM matches its ID: ```text ubuntu@computeinstance-e00***:~$ ``` The VM can take a few minutes to become reachable after it starts running — it takes time to install the tunnel agent. If the connection fails, wait a few minutes and try again. ## How to delete the created resources The created VM and its boot disk are chargeable. If you don't need them, [delete the VM](https://docs.nebius.com/compute/virtual-machines/delete.md), so Nebius AI Cloud doesn't charge for the resources. The boot disk is deleted automatically when you delete the VM. You can also delete free resources: * [Tunnel](https://docs.nebius.com/tunnels/delete.md) * [Service account](https://docs.nebius.com/iam/service-accounts/manage.md#deleting-a-service-account) * [Custom group](https://docs.nebius.com/iam/authorization/groups/delete-groups.md) # Deploying JupyterLab® on a virtual machine by using Nebius Tunnels Source: https://docs.nebius.com/tunnels/tutorials/jupyterlab.md You can deploy and run JupyterLab® on a non-GPU virtual machine (VM) without a public IP address. Use a [tunnel](https://docs.nebius.com/tunnels/overview.md#how-tunnels-work) in Nebius Tunnels to access JupyterLab from your browser. This way, your VM stays secure and isolated while anyone can open JupyterLab from the internet and connect to the VM via a protective tunnel. To establish the tunnel, the VM configuration should include a tunnel agent. The agent runs on the VM automatically after the VM starts. When you open JupyterLab in the browser, the tunnel routes the traffic to the agent. Thus, only the IP address of the tunnel is exposed to the internet. > [!NOTE] > > Use one VM per tunnel. Do not add several VMs to a single tunnel. ## Costs Nebius AI Cloud charges you for the following billing items: * [Compute virtual machine](https://docs.nebius.com/compute/resources/pricing.md#virtual-machines-gpus-vcpus-ram) * [Boot disk](https://docs.nebius.com/compute/resources/pricing.md#disks) attached to the VM Nebius Tunnels is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and provided free of charge. ## Steps ### Create a tunnel > [tab] Web console > > 1. In the [web console](https://console.nebius.com), select the project where you want to create the infrastructure. All resources must be located in the same project. > 2. Go to  **Networking** → **Tunnels**. > 3. Click  **Create tunnel**. > 4. On the page that opens, set the tunnel name to `my-tunnel`. > 5. Click **Create tunnel**. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > When configuring the CLI profile, set the project where you want to create the infrastructure. All resources must be located in the same project. > > All `nebius` commands by default use the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) from your CLI profile configuration. > > 2. Create a tunnel: > > ```bash > nebius tunnel create --title my-tunnel > ``` > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `gosdk.WithParentID`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```go > createTunnelService := sdk.Services().Tunnel().V1(). > Tunnel() > createTunnelOperation, err := createTunnelService.Create( > ctx, > &tunnel.CreateTunnelRequest{ > Spec: &tunnel.TunnelSpec{ > Title: "my-tunnel", > }, > }, > ) > if err != nil { > return fmt.Errorf("create tunnel: %w", err) > } > createTunnelOperation, err = createTunnelOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create tunnel: %w", err) > } > tunnelID := createTunnelOperation.ResourceID() > fmt.Println(tunnelID) > ``` > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parent_id`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```python > create_tunnel_service = TunnelServiceClient(sdk) > create_tunnel_operation = await create_tunnel_service.create( > CreateTunnelRequest( > spec=TunnelSpec( > title="my-tunnel", > ), > ), > ) > await create_tunnel_operation.wait() > tunnel_id = create_tunnel_operation.resource_id > print(tunnel_id) > ``` > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parentId`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```ts > const createTunnelService = new TunnelService(sdk); > const createTunnelOperation = await createTunnelService.create( > CreateTunnelRequest.create({ > metadata: ResourceMetadata.create({}), > spec: TunnelSpec.create({ > title: "my-tunnel", > }), > }), > ).result; > await createTunnelOperation.wait(); > const tunnelId = createTunnelOperation.resourceId(); > console.log(tunnelId); > ``` ### Configure access for the tunnel agent To authorize the VM in the tunnel, prepare a service account with the `applicationtunnel.agent` role. Later, you attach this service account to the VM. 1. Create the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Service account**. > 3. In the window that opens, set the name to `tunnel-agent-sa` and select the project. > 4. Click **Create and continue**. > [tab] CLI > > ```bash > nebius iam service-account create --name tunnel-agent-sa > ``` > [tab] Go SDK > > ```go > createSaService := sdk.Services().IAM().V1(). > ServiceAccount() > createSaOperation, err := createSaService.Create( > ctx, > &iam.CreateServiceAccountRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agent-sa", > }, > Spec: &iam.ServiceAccountSpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create service account: %w", err) > } > createSaOperation, err = createSaOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create service account: %w", err) > } > saID := createSaOperation.ResourceID() > fmt.Println(saID) > ``` > [tab] Python SDK > > ```python > create_sa_service = ServiceAccountServiceClient(sdk) > create_sa_operation = await create_sa_service.create( > CreateServiceAccountRequest( > metadata=ResourceMetadata( > name="tunnel-agent-sa", > ), > spec=ServiceAccountSpec(), > ), > ) > await create_sa_operation.wait() > sa_id = create_sa_operation.resource_id > print(sa_id) > ``` > [tab] JavaScript SDK > > ```ts > const createSaService = new ServiceAccountService(sdk); > const createSaOperation = await createSaService.create( > CreateServiceAccountRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agent-sa", > }), > spec: ServiceAccountSpec.create({}), > }), > ).result; > await createSaOperation.wait(); > const saId = createSaOperation.resourceId(); > console.log(saId); > ``` 2. Create a [custom group](https://docs.nebius.com/iam/authorization/groups/index.md#custom-groups) in Identity and Access Management to assign the role to the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Group**. > 3. In the window that opens, set the group name to `tunnel-agents`. In the **Scope** field, select the project where you create all the resources. > 4. Click **Create**. > [tab] CLI > > ```bash > nebius iam group create --name tunnel-agents > ``` > [tab] Go SDK > > ```go > createGroupService := sdk.Services().IAM().V1(). > Group() > createGroupOperation, err := createGroupService.Create( > ctx, > &iam.CreateGroupRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agents", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group: %w", err) > } > createGroupOperation, err = createGroupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group: %w", err) > } > groupID := createGroupOperation.ResourceID() > fmt.Println(groupID) > ``` > [tab] Python SDK > > ```python > create_group_service = GroupServiceClient(sdk) > create_group_operation = await create_group_service.create( > CreateGroupRequest( > metadata=ResourceMetadata( > name="tunnel-agents", > ), > ), > ) > await create_group_operation.wait() > group_id = create_group_operation.resource_id > print(group_id) > ``` > [tab] JavaScript SDK > > ```ts > const createGroupService = new GroupService(sdk); > const createGroupOperation = await createGroupService.create( > CreateGroupRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agents", > }), > }), > ).result; > await createGroupOperation.wait(); > const groupId = createGroupOperation.resourceId(); > console.log(groupId); > ``` 3. Attach the tunnel and grant the `applicationtunnel.agent` role to this group. You can't grant this role in the web console. > [tab] CLI > > 1. Get the group ID: > > ```bash > nebius iam group list > ``` > > The ID is specified in the `items.metadata.id` parameter in the output. > > 2. Get the tunnel ID: > > ```bash > nebius tunnel list > ``` > > 3. Create an access permit in the custom group: > > ```bash > nebius iam access-permit create \ > --parent-id \ > --resource-id \ > --role applicationtunnel.agent > ``` > [tab] Go SDK > > 1. Get the group ID: > > ```go > listGroupsService := sdk.Services().IAM().V1(). > Group() > listGroups, err := listGroupsService.List( > ctx, > &iam.ListGroupsRequest{}, > ) > if err != nil { > return fmt.Errorf("list groups: %w", err) > } > fmt.Println(listGroups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `Metadata.Id`. > > 2. Get the tunnel ID: > > ```go > listTunnelsService := sdk.Services().Tunnel().V1(). > Tunnel() > listTunnels, err := listTunnelsService.List( > ctx, > &tunnel.ListTunnelRequest{}, > ) > if err != nil { > return fmt.Errorf("list tunnels: %w", err) > } > fmt.Println(listTunnels) > ``` > > 3. Create an access permit in the custom group: > > ```go > accessPermitService := sdk.Services().IAM().V1(). > AccessPermit() > accessPermitOperation, err := accessPermitService.Create( > ctx, > &iam.CreateAccessPermitRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.AccessPermitSpec{ > ResourceId: "", > Role: "applicationtunnel.agent", > }, > }, > ) > if err != nil { > return fmt.Errorf("create access permit: %w", err) > } > accessPermitOperation, err = accessPermitOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create access permit: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `ResourceId` in `AccessPermitSpec` to the tunnel ID. > [tab] Python SDK > > 1. Get the group ID: > > ```python > list_groups_service = GroupServiceClient(sdk) > list_groups = await list_groups_service.list( > ListGroupsRequest(), > ) > print(list_groups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```python > list_tunnels_service = TunnelServiceClient(sdk) > list_tunnels = await list_tunnels_service.list( > ListTunnelRequest(), > ) > print(list_tunnels) > ``` > > 3. Create an access permit in the custom group: > > ```python > access_permit_service = AccessPermitServiceClient(sdk) > access_permit_operation = await access_permit_service.create( > CreateAccessPermitRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=AccessPermitSpec( > resource_id="", > role="applicationtunnel.agent", > ), > ), > ) > await access_permit_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `resource_id` in `AccessPermitSpec` to the tunnel ID. > [tab] JavaScript SDK > > 1. Get the group ID: > > ```ts > const listGroupsService = new GroupService(sdk); > const listGroups = await listGroupsService.list( > ListGroupsRequest.create({}), > ).result; > console.log(listGroups); > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```ts > const listTunnelsService = new TunnelService(sdk); > const listTunnels = await listTunnelsService.list( > ListTunnelRequest.create({}), > ).result; > console.log(listTunnels); > ``` > > 3. Create an access permit in the custom group: > > ```ts > const accessPermitService = new AccessPermitService(sdk); > const accessPermitOperation = await accessPermitService.create( > CreateAccessPermitRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: AccessPermitSpec.create({ > resourceId: "", > role: "applicationtunnel.agent", > }), > }), > ).result; > await accessPermitOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `resourceId` in `AccessPermitSpec` to the tunnel ID. 4. Add the service account to the group: > [tab] Web console > > 1. Go to  **Administration** → **IAM**. > 2. On the **Groups** tab, find and open the `tunnel-agents` group. > 3. Click  **Add members**. > 4. In the window that opens, add the `tunnel-agent-sa` service account. > 5. Once the account is added, close the window. > > Check the group page in general. Make sure that: > > * The `tunnel-agent-sa` service account is specified on the **Members** tab. > * The tunnel and the `applicationtunnel.agent` role are specified on the **Access permits** tab. > [tab] CLI > > ```bash > nebius iam group-membership create \ > --parent-id \ > --member-id > ``` > > To get the service account ID, run: > > ```bash > nebius iam service-account list > ``` > [tab] Go SDK > > ```go > membershipService := sdk.Services().IAM().V1(). > GroupMembership() > membershipOperation, err := membershipService.Create( > ctx, > &iam.CreateGroupMembershipRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.GroupMembershipSpec{ > MemberId: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group membership: %w", err) > } > membershipOperation, err = membershipOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group membership: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `MemberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```go > listServiceAccountsService := sdk.Services().IAM().V1(). > ServiceAccount() > listServiceAccounts, err := listServiceAccountsService.List( > ctx, > &iam.ListServiceAccountRequest{}, > ) > if err != nil { > return fmt.Errorf("list service accounts: %w", err) > } > fmt.Println(listServiceAccounts) > ``` > [tab] Python SDK > > ```python > membership_service = GroupMembershipServiceClient(sdk) > membership_operation = await membership_service.create( > CreateGroupMembershipRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=GroupMembershipSpec( > member_id="", > ), > ), > ) > await membership_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `member_id` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```python > list_service_accounts_service = ( > ServiceAccountServiceClient(sdk) > ) > list_service_accounts = await list_service_accounts_service.list( > ListServiceAccountRequest(), > ) > print(list_service_accounts) > ``` > [tab] JavaScript SDK > > ```ts > const membershipService = new GroupMembershipService(sdk); > const membershipOperation = await membershipService.create( > CreateGroupMembershipRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: GroupMembershipSpec.create({ > memberId: "", > }), > }), > ).result; > await membershipOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `memberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```ts > const listServiceAccountsService = > new ServiceAccountService(sdk); > const listServiceAccounts = await listServiceAccountsService.list( > ListServiceAccountRequest.create({}), > ).result; > console.log(listServiceAccounts); > ``` ### Create a virtual machine Prepare the VM configuration that includes the JupyterLab image and the tunnel agent. Then, create the VM — the image and agent are deployed on the VM automatically. > [!WARNING] > > If you need to change the VM configuration later, delete the VM and create a new one. A tunnel should be associated with only one VM, and you can't change the cloud-init configuration of an existing VM. 1. [Generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#generating-a-key-pair). 2. Prepare the cloud-init configuration file. You'll attach it to the VM. In this file, specify two parameters: * `users.ssh_authorized_keys`: Public SSH key. * `write_files.content.tunnel_id`: ID of the tunnel. > [accordion] jupyterlab.yaml > > ```yaml > users: > - name: ubuntu > sudo: "ALL=(ALL) NOPASSWD:ALL" > shell: /bin/bash > ssh_authorized_keys: > - > > # The driverless images don't include Docker, so the configuration does. > package_update: true > packages: > - docker.io > > write_files: > - path: /etc/nebius-tunnel-agent/config.yaml > permissions: "0640" > content: | > tunnel_id: > > iam: > metadata: > enabled: true > > logging: > level: info > format: json > > services: > - name: jupyter > type: http > target: 127.0.0.1:8888 > # Preserve the ssh service, so you can get the JupyterLab token > - name: ssh > type: tcp > target: 127.0.0.1:22 > > - path: /etc/systemd/system/nebius-tunnel-agent.service > permissions: "0644" > content: | > [Unit] > Description=Nebius tunnel agent > Documentation=https://docs.nebius.com/tunnels > After=network-online.target > Wants=network-online.target > > [Service] > Type=simple > User=tunna > Group=tunna > ExecStart=/usr/local/bin/nebius-tunnel-agent --config /etc/nebius-tunnel-agent/config.yaml > Restart=always > RestartSec=5 > NoNewPrivileges=true > ProtectSystem=strict > ProtectHome=true > PrivateTmp=true > ReadOnlyPaths=/etc/nebius-tunnel-agent > > [Install] > WantedBy=multi-user.target > > - path: /usr/local/sbin/install-nebius-tunnel-agent > permissions: "0755" > content: | > #!/bin/bash > set -euo pipefail > > VERSION="${AGENT_VERSION:-latest}" > BASE="https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent" > CONF_DIR=/etc/nebius-tunnel-agent > > case "$(uname -m)" in > x86_64) PLATFORM=linux-x86_64 ;; > aarch64|arm64) PLATFORM=linux-aarch64 ;; > *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; > esac > ASSET="nebius-tunnel-agent-${PLATFORM}.tar.gz" > > TMP="$(mktemp -d)" > trap 'rm -rf "$TMP"' EXIT > > fetch() { > curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$2" "$1" > } > fetch "$BASE/$VERSION/$ASSET" "$TMP/$ASSET" > fetch "$BASE/$VERSION/checksums-sha256.txt" "$TMP/checksums-sha256.txt" > > (cd "$TMP" && sha256sum --ignore-missing -c checksums-sha256.txt) > > tar -xzf "$TMP/$ASSET" -C "$TMP" > install -m0755 "$TMP/nebius-tunnel-agent" /usr/local/bin/nebius-tunnel-agent > > getent group tunna >/dev/null || groupadd --system tunna > id -u tunna >/dev/null 2>&1 || useradd --system --gid tunna \ > --no-create-home --shell /usr/sbin/nologin tunna > chown -R tunna:tunna "$CONF_DIR" > chmod 0750 "$CONF_DIR" > chmod 0640 "$CONF_DIR/config.yaml" > > systemctl daemon-reload > systemctl enable nebius-tunnel-agent.service > systemctl restart nebius-tunnel-agent.service > > - path: /etc/systemd/system/jupyter.service > permissions: "0644" > content: | > [Unit] > Description=JupyterLab (behind a Nebius tunnel) > After=network-online.target docker.service > Wants=network-online.target > Requires=docker.service > > [Service] > EnvironmentFile=/etc/jupyter/env > ExecStartPre=-/usr/bin/docker rm -f jupyter > ExecStartPre=/usr/bin/docker pull quay.io/jupyter/base-notebook:latest > ExecStart=/usr/bin/docker run --rm --name jupyter \ > -p 127.0.0.1:8888:8888 \ > -e JUPYTER_TOKEN=${JUPYTER_TOKEN} \ > quay.io/jupyter/base-notebook:latest \ > start-notebook.py \ > --ServerApp.ip=0.0.0.0 \ > --ServerApp.allow_origin='*' \ > --ServerApp.allow_remote_access=True \ > --ServerApp.trust_xheaders=True > ExecStop=/usr/bin/docker stop jupyter > Restart=on-failure > RestartSec=10 > TimeoutStartSec=0 > > [Install] > WantedBy=multi-user.target > > runcmd: > # Agent first: the tunnel is working while the backend is still pulling images. > - [/usr/local/sbin/install-nebius-tunnel-agent] > - mkdir -p /etc/jupyter > - bash -c 'test -s /etc/jupyter/env || { umask 077; printf "JUPYTER_TOKEN=%s\n" "$(openssl rand -hex 24)" > /etc/jupyter/env; }' > - systemctl enable --now jupyter.service > ``` > > This configuration enables the following actions: > > * Add a username and a public SSH key to the VM. > * Install Docker on the VM. > * Deploy the tunnel agent. > * Authenticate by using the service account attached to the VM. > * Create two [Nebius Tunnels services](https://docs.nebius.com/tunnels/overview.md#supported-traffic): `jupyter` and `ssh`. Use them to connect to the tunnel. > * Deploy JupyterLab on the VM. > * Generate a JupyterLab token. With this token, you'll be able to authenticate to JupyterLab and open it. 3. Create the VM: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. On the **Compute** step, configure computing resources: > > 1. In the **Platform** section, select: > > * Without GPUs > * Regular > * Non-GPU AMD Epyc Genoa > 2. In the **Settings** section, set: > > * **Preset**: 8 CPUs - 32 GiB RAM. > * **Project**: Project where you create all resources for the tunnel. > * **VM name**: `tunnel-jupyter`. > > 4. On the **Storage** step, preserve the **Ubuntu 24.04 LTS** disk image and the SSD disk type, but change the disk size to 50 GiB. > > 5. On the **Network** step, check the network and subnet. Keep **None** in the **Public IP address** field. > > 6. On the **Configuration** step, configure the access, identity and VM startup settings: > > 1. In the **Service account** field, select the `tunnel-agent-sa` service account. > 2. Enable a custom cloud-init configuration file. > 3. In the field that appears, paste the contents of the `jupyterlab.yaml` file prepared earlier. > > 7. On the **Review** step, check the full VM configuration. To change a section quickly, click  next to the corresponding block. The wizard opens the relevant step with your current settings. > > 8. Click **Create**. > [tab] CLI > > ```bash > nebius compute instance create \ > --name tunnel-jupyter \ > --resources-platform cpu-d3 \ > --resources-preset 8vcpu-32gb \ > --boot-disk-attach-mode READ_WRITE \ > --boot-disk-managed-disk-name tunnel-jupyter-boot \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 50 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"subnet_id\": \"\"}]" \ > --service-account-id \ > --cloud-init-user-data "$(cat jupyterlab.yaml)" > ``` > > In the command, specify the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) and the ID of the `tunnel-agent-sa` service account. > [tab] Go SDK > > ```go > cloudInit, err := os.ReadFile("jupyterlab.yaml") > if err != nil { > return fmt.Errorf("read cloud init: %w", err) > } > resources := &compute.ResourcesSpec{ > Platform: "cpu-d3", > Size: &compute.ResourcesSpec_Preset{ > Preset: "8vcpu-32gb", > }, > } > bootDiskSpec := &compute.DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 50, > }, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > } > bootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "tunnel-jupyter-boot", > Spec: bootDiskSpec, > }, > }, > } > networkInterface := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: "", > IpAddress: &compute.IPAddress{}, > } > createVmService := sdk.Services().Compute().V1(). > Instance() > createVmOperation, err := createVmService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-jupyter", > }, > Spec: &compute.InstanceSpec{ > Resources: resources, > BootDisk: bootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > networkInterface, > }, > ServiceAccountId: "", > CloudInitUserData: string(cloudInit), > }, > }, > ) > if err != nil { > return fmt.Errorf("create instance: %w", err) > } > createVmOperation, err = createVmOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create instance: %w", err) > } > ``` > > In the code, set `SubnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) and `ServiceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `jupyterlab.yaml` file in the working directory. > [tab] Python SDK > > ```python > cloud_init = Path("jupyterlab.yaml").read_text() > boot_disk_spec = DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > size_gibibytes=50, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-driverless", > ), > ) > boot_disk = AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > managed_disk=ManagedDisk( > name="tunnel-jupyter-boot", > spec=boot_disk_spec, > ), > ) > network_interface = NetworkInterfaceSpec( > name="eth0", > subnet_id="", > ip_address=IPAddress(), > ) > create_vm_service = InstanceServiceClient(sdk) > create_vm_operation = await create_vm_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="tunnel-jupyter", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-d3", > preset="8vcpu-32gb", > ), > boot_disk=boot_disk, > network_interfaces=[network_interface], > service_account_id="", > cloud_init_user_data=cloud_init, > ), > ), > ) > await create_vm_operation.wait() > ``` > > In the code, set `subnet_id` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) and `service_account_id` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `jupyterlab.yaml` file in the working directory. > [tab] JavaScript SDK > > ```ts > const cloudInit = await readFile("jupyterlab.yaml", "utf8"); > const sourceImage = SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }); > const bootDiskSpec = DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 50, > }, > source: { > $case: "sourceImageFamily", > sourceImageFamily: sourceImage, > }, > }); > const managedDisk = ManagedDisk.create({ > name: "tunnel-jupyter-boot", > spec: bootDiskSpec, > }); > const bootDisk = AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk, > }, > }); > const networkInterface = NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: "", > ipAddress: IPAddress.create({}), > }); > const createVmService = new InstanceService(sdk); > const createVmOperation = await createVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-jupyter", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-d3", > size: { > $case: "preset", > preset: "8vcpu-32gb", > }, > }), > bootDisk: bootDisk, > networkInterfaces: [networkInterface], > serviceAccountId: "", > cloudInitUserData: cloudInit, > }), > }), > ).result; > await createVmOperation.wait(); > ``` > > In the code, set `subnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) and `serviceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `jupyterlab.yaml` file in the working directory. Wait for the VM to start running. ### Open JupyterLab 1. Get the JupyterLab token. To do so, connect to the VM and extract the token from the VM: ```bash ssh -o ProxyCommand="openssl s_client -quiet -verify_quiet -servername %h -connect %h:443" \ ubuntu@ssh-.tunnel.applications..nebius.cloud \ sudo cat /etc/jupyter/env ``` In the VM address, specify: * `tunnel_masked_ID`: Mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. Contains the last 15 characters of the tunnel ID. For example, for `applicationtunnel-e00abcdef123456789`, the masked ID of the tunnel is `abcdef123456789`. * `region`: [Region](https://docs.nebius.com/overview/regions.md) of the project where you created the resources. For more information about the tunnel URL, see [Supported traffic](https://docs.nebius.com/tunnels/overview.md#supported-traffic). The command returns the JupyterLab token after the message about the connection: ```text JUPYTER_TOKEN=c912db4*** ``` 2. Open JupyterLab in the browser by using the following URL: ```text https://jupyter-.tunnel.applications..nebius.cloud/lab?token= ``` In the URL, specify the masked ID of the tunnel, the region, and the token. The page can take about a minute to open. If you see the message `failed to connect to local service` instead, this means that JupyterLab hasn't started yet. Wait a few moments and try again. ## How to delete the created resources The created VM and its boot disk are chargeable. If you don't need them, [delete the VM](https://docs.nebius.com/compute/virtual-machines/delete.md), so Nebius AI Cloud doesn't charge for the resources. The boot disk is deleted automatically when you delete the VM. You can also delete free resources: * [Tunnel](https://docs.nebius.com/tunnels/delete.md) * [Service account](https://docs.nebius.com/iam/service-accounts/manage.md#deleting-a-service-account) * [Custom group](https://docs.nebius.com/iam/authorization/groups/delete-groups.md) *** *"Jupyter" and the Jupyter logos are trademarks or registered trademarks of LF Charities, used by Nebius B.V. with permission.* # Deploying an LLM on a virtual machine by using Nebius Tunnels Source: https://docs.nebius.com/tunnels/tutorials/llm.md You can deploy and run a large language model (LLM) on a GPU virtual machine (VM) and then chat with this model via a secure [tunnel](https://docs.nebius.com/tunnels/overview.md#how-tunnels-work) in Nebius Tunnels. The VM goes without a public IP address, but by using the tunnel, anyone can access the LLM from the internet and connect to the VM. Meanwhile, the VM stays isolated. To establish the tunnel, the VM configuration includes a tunnel agent. The agent runs on the VM automatically after the VM starts. When you send a message to the model, the tunnel routes the traffic to the agent. Thus, only the IP address of the tunnel is exposed to the internet. > [!NOTE] > > Use one VM per tunnel. Do not add several VMs to a single tunnel. ## Costs Nebius AI Cloud charges you for the following billing items: * [Compute virtual machine](https://docs.nebius.com/compute/resources/pricing.md#virtual-machines-gpus-vcpus-ram) * [Boot disk](https://docs.nebius.com/compute/resources/pricing.md#disks) attached to the VM Nebius Tunnels is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and provided free of charge. ## Steps ### Create a tunnel > [tab] Web console > > 1. In the [web console](https://console.nebius.com), select the project where you want to create the infrastructure. All resources must be located in the same project. > 2. Go to  **Networking** → **Tunnels**. > 3. Click  **Create tunnel**. > 4. On the page that opens, set the tunnel name to `my-tunnel`. > 5. Click **Create tunnel**. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > When configuring the CLI profile, set the project where you want to create the infrastructure. All resources must be located in the same project. > > All `nebius` commands by default use the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) from your CLI profile configuration. > > 2. Create a tunnel: > > ```bash > nebius tunnel create --title my-tunnel > ``` > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `gosdk.WithParentID`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```go > createTunnelService := sdk.Services().Tunnel().V1(). > Tunnel() > createTunnelOperation, err := createTunnelService.Create( > ctx, > &tunnel.CreateTunnelRequest{ > Spec: &tunnel.TunnelSpec{ > Title: "my-tunnel", > }, > }, > ) > if err != nil { > return fmt.Errorf("create tunnel: %w", err) > } > createTunnelOperation, err = createTunnelOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create tunnel: %w", err) > } > tunnelID := createTunnelOperation.ResourceID() > fmt.Println(tunnelID) > ``` > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parent_id`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```python > create_tunnel_service = TunnelServiceClient(sdk) > create_tunnel_operation = await create_tunnel_service.create( > CreateTunnelRequest( > spec=TunnelSpec( > title="my-tunnel", > ), > ), > ) > await create_tunnel_operation.wait() > tunnel_id = create_tunnel_operation.resource_id > print(tunnel_id) > ``` > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parentId`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```ts > const createTunnelService = new TunnelService(sdk); > const createTunnelOperation = await createTunnelService.create( > CreateTunnelRequest.create({ > metadata: ResourceMetadata.create({}), > spec: TunnelSpec.create({ > title: "my-tunnel", > }), > }), > ).result; > await createTunnelOperation.wait(); > const tunnelId = createTunnelOperation.resourceId(); > console.log(tunnelId); > ``` ### Configure access for the tunnel agent To authorize the VM in the tunnel, prepare a service account with the `applicationtunnel.agent` role. Later, you attach this service account to the VM. 1. Create the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Service account**. > 3. In the window that opens, set the name to `tunnel-agent-sa` and select the project. > 4. Click **Create and continue**. > [tab] CLI > > ```bash > nebius iam service-account create --name tunnel-agent-sa > ``` > [tab] Go SDK > > ```go > createSaService := sdk.Services().IAM().V1(). > ServiceAccount() > createSaOperation, err := createSaService.Create( > ctx, > &iam.CreateServiceAccountRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agent-sa", > }, > Spec: &iam.ServiceAccountSpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create service account: %w", err) > } > createSaOperation, err = createSaOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create service account: %w", err) > } > saID := createSaOperation.ResourceID() > fmt.Println(saID) > ``` > [tab] Python SDK > > ```python > create_sa_service = ServiceAccountServiceClient(sdk) > create_sa_operation = await create_sa_service.create( > CreateServiceAccountRequest( > metadata=ResourceMetadata( > name="tunnel-agent-sa", > ), > spec=ServiceAccountSpec(), > ), > ) > await create_sa_operation.wait() > sa_id = create_sa_operation.resource_id > print(sa_id) > ``` > [tab] JavaScript SDK > > ```ts > const createSaService = new ServiceAccountService(sdk); > const createSaOperation = await createSaService.create( > CreateServiceAccountRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agent-sa", > }), > spec: ServiceAccountSpec.create({}), > }), > ).result; > await createSaOperation.wait(); > const saId = createSaOperation.resourceId(); > console.log(saId); > ``` 2. Create a [custom group](https://docs.nebius.com/iam/authorization/groups/index.md#custom-groups) in Identity and Access Management to assign the role to the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Group**. > 3. In the window that opens, set the group name to `tunnel-agents`. In the **Scope** field, select the project where you create all the resources. > 4. Click **Create**. > [tab] CLI > > ```bash > nebius iam group create --name tunnel-agents > ``` > [tab] Go SDK > > ```go > createGroupService := sdk.Services().IAM().V1(). > Group() > createGroupOperation, err := createGroupService.Create( > ctx, > &iam.CreateGroupRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agents", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group: %w", err) > } > createGroupOperation, err = createGroupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group: %w", err) > } > groupID := createGroupOperation.ResourceID() > fmt.Println(groupID) > ``` > [tab] Python SDK > > ```python > create_group_service = GroupServiceClient(sdk) > create_group_operation = await create_group_service.create( > CreateGroupRequest( > metadata=ResourceMetadata( > name="tunnel-agents", > ), > ), > ) > await create_group_operation.wait() > group_id = create_group_operation.resource_id > print(group_id) > ``` > [tab] JavaScript SDK > > ```ts > const createGroupService = new GroupService(sdk); > const createGroupOperation = await createGroupService.create( > CreateGroupRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agents", > }), > }), > ).result; > await createGroupOperation.wait(); > const groupId = createGroupOperation.resourceId(); > console.log(groupId); > ``` 3. Attach the tunnel and grant the `applicationtunnel.agent` role to this group. You can't grant this role in the web console. > [tab] CLI > > 1. Get the group ID: > > ```bash > nebius iam group list > ``` > > The ID is specified in the `items.metadata.id` parameter in the output. > > 2. Get the tunnel ID: > > ```bash > nebius tunnel list > ``` > > 3. Create an access permit in the custom group: > > ```bash > nebius iam access-permit create \ > --parent-id \ > --resource-id \ > --role applicationtunnel.agent > ``` > [tab] Go SDK > > 1. Get the group ID: > > ```go > listGroupsService := sdk.Services().IAM().V1(). > Group() > listGroups, err := listGroupsService.List( > ctx, > &iam.ListGroupsRequest{}, > ) > if err != nil { > return fmt.Errorf("list groups: %w", err) > } > fmt.Println(listGroups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `Metadata.Id`. > > 2. Get the tunnel ID: > > ```go > listTunnelsService := sdk.Services().Tunnel().V1(). > Tunnel() > listTunnels, err := listTunnelsService.List( > ctx, > &tunnel.ListTunnelRequest{}, > ) > if err != nil { > return fmt.Errorf("list tunnels: %w", err) > } > fmt.Println(listTunnels) > ``` > > 3. Create an access permit in the custom group: > > ```go > accessPermitService := sdk.Services().IAM().V1(). > AccessPermit() > accessPermitOperation, err := accessPermitService.Create( > ctx, > &iam.CreateAccessPermitRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.AccessPermitSpec{ > ResourceId: "", > Role: "applicationtunnel.agent", > }, > }, > ) > if err != nil { > return fmt.Errorf("create access permit: %w", err) > } > accessPermitOperation, err = accessPermitOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create access permit: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `ResourceId` in `AccessPermitSpec` to the tunnel ID. > [tab] Python SDK > > 1. Get the group ID: > > ```python > list_groups_service = GroupServiceClient(sdk) > list_groups = await list_groups_service.list( > ListGroupsRequest(), > ) > print(list_groups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```python > list_tunnels_service = TunnelServiceClient(sdk) > list_tunnels = await list_tunnels_service.list( > ListTunnelRequest(), > ) > print(list_tunnels) > ``` > > 3. Create an access permit in the custom group: > > ```python > access_permit_service = AccessPermitServiceClient(sdk) > access_permit_operation = await access_permit_service.create( > CreateAccessPermitRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=AccessPermitSpec( > resource_id="", > role="applicationtunnel.agent", > ), > ), > ) > await access_permit_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `resource_id` in `AccessPermitSpec` to the tunnel ID. > [tab] JavaScript SDK > > 1. Get the group ID: > > ```ts > const listGroupsService = new GroupService(sdk); > const listGroups = await listGroupsService.list( > ListGroupsRequest.create({}), > ).result; > console.log(listGroups); > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```ts > const listTunnelsService = new TunnelService(sdk); > const listTunnels = await listTunnelsService.list( > ListTunnelRequest.create({}), > ).result; > console.log(listTunnels); > ``` > > 3. Create an access permit in the custom group: > > ```ts > const accessPermitService = new AccessPermitService(sdk); > const accessPermitOperation = await accessPermitService.create( > CreateAccessPermitRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: AccessPermitSpec.create({ > resourceId: "", > role: "applicationtunnel.agent", > }), > }), > ).result; > await accessPermitOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `resourceId` in `AccessPermitSpec` to the tunnel ID. 4. Add the service account to the group: > [tab] Web console > > 1. Go to  **Administration** → **IAM**. > 2. On the **Groups** tab, find and open the `tunnel-agents` group. > 3. Click  **Add members**. > 4. In the window that opens, add the `tunnel-agent-sa` service account. > 5. Once the account is added, close the window. > > Check the group page in general. Make sure that: > > * The `tunnel-agent-sa` service account is specified on the **Members** tab. > * The tunnel and the `applicationtunnel.agent` role are specified on the **Access permits** tab. > [tab] CLI > > ```bash > nebius iam group-membership create \ > --parent-id \ > --member-id > ``` > > To get the service account ID, run: > > ```bash > nebius iam service-account list > ``` > [tab] Go SDK > > ```go > membershipService := sdk.Services().IAM().V1(). > GroupMembership() > membershipOperation, err := membershipService.Create( > ctx, > &iam.CreateGroupMembershipRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.GroupMembershipSpec{ > MemberId: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group membership: %w", err) > } > membershipOperation, err = membershipOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group membership: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `MemberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```go > listServiceAccountsService := sdk.Services().IAM().V1(). > ServiceAccount() > listServiceAccounts, err := listServiceAccountsService.List( > ctx, > &iam.ListServiceAccountRequest{}, > ) > if err != nil { > return fmt.Errorf("list service accounts: %w", err) > } > fmt.Println(listServiceAccounts) > ``` > [tab] Python SDK > > ```python > membership_service = GroupMembershipServiceClient(sdk) > membership_operation = await membership_service.create( > CreateGroupMembershipRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=GroupMembershipSpec( > member_id="", > ), > ), > ) > await membership_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `member_id` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```python > list_service_accounts_service = ( > ServiceAccountServiceClient(sdk) > ) > list_service_accounts = await list_service_accounts_service.list( > ListServiceAccountRequest(), > ) > print(list_service_accounts) > ``` > [tab] JavaScript SDK > > ```ts > const membershipService = new GroupMembershipService(sdk); > const membershipOperation = await membershipService.create( > CreateGroupMembershipRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: GroupMembershipSpec.create({ > memberId: "", > }), > }), > ).result; > await membershipOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `memberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```ts > const listServiceAccountsService = > new ServiceAccountService(sdk); > const listServiceAccounts = await listServiceAccountsService.list( > ListServiceAccountRequest.create({}), > ).result; > console.log(listServiceAccounts); > ``` ### Create a virtual machine Prepare the VM configuration that includes the Qwen/Qwen3-8B model and the tunnel agent. Then, create the VM — the model and agent are deployed on the VM automatically. > [!WARNING] > > If you need to change the VM configuration later, delete the VM and create a new one. A tunnel should be associated with only one VM, and you can't change the cloud-init configuration of an existing VM. 1. [Generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#generating-a-key-pair). 2. Prepare the cloud-init configuration file. You'll attach it to the VM. In this file, specify two parameters: * `users.ssh_authorized_keys`: Public SSH key. * `write_files.content.tunnel_id`: ID of the tunnel. > [accordion] llm.yaml > > ```yaml > users: > - name: ubuntu > sudo: "ALL=(ALL) NOPASSWD:ALL" > shell: /bin/bash > ssh_authorized_keys: > - > > write_files: > - path: /etc/nebius-tunnel-agent/config.yaml > permissions: "0640" > content: | > tunnel_id: > > iam: > metadata: > enabled: true > > logging: > level: info > format: json > > services: > - name: llm > type: http > target: 127.0.0.1:8000 > - name: ssh > type: tcp > target: 127.0.0.1:22 > > - path: /etc/systemd/system/nebius-tunnel-agent.service > permissions: "0644" > content: | > [Unit] > Description=Nebius tunnel agent > Documentation=https://docs.nebius.com/tunnels > After=network-online.target > Wants=network-online.target > > [Service] > Type=simple > User=tunna > Group=tunna > ExecStart=/usr/local/bin/nebius-tunnel-agent --config /etc/nebius-tunnel-agent/config.yaml > Restart=always > RestartSec=5 > NoNewPrivileges=true > ProtectSystem=strict > ProtectHome=true > PrivateTmp=true > ReadOnlyPaths=/etc/nebius-tunnel-agent > > [Install] > WantedBy=multi-user.target > > - path: /usr/local/sbin/install-nebius-tunnel-agent > permissions: "0755" > content: | > #!/bin/bash > set -euo pipefail > > VERSION="${AGENT_VERSION:-latest}" > BASE="https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent" > CONF_DIR=/etc/nebius-tunnel-agent > > case "$(uname -m)" in > x86_64) PLATFORM=linux-x86_64 ;; > aarch64|arm64) PLATFORM=linux-aarch64 ;; > *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; > esac > ASSET="nebius-tunnel-agent-${PLATFORM}.tar.gz" > > TMP="$(mktemp -d)" > trap 'rm -rf "$TMP"' EXIT > > fetch() { > curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$2" "$1" > } > fetch "$BASE/$VERSION/$ASSET" "$TMP/$ASSET" > fetch "$BASE/$VERSION/checksums-sha256.txt" "$TMP/checksums-sha256.txt" > > (cd "$TMP" && sha256sum --ignore-missing -c checksums-sha256.txt) > > tar -xzf "$TMP/$ASSET" -C "$TMP" > install -m0755 "$TMP/nebius-tunnel-agent" /usr/local/bin/nebius-tunnel-agent > > getent group tunna >/dev/null || groupadd --system tunna > id -u tunna >/dev/null 2>&1 || useradd --system --gid tunna \ > --no-create-home --shell /usr/sbin/nologin tunna > chown -R tunna:tunna "$CONF_DIR" > chmod 0750 "$CONF_DIR" > chmod 0640 "$CONF_DIR/config.yaml" > > systemctl daemon-reload > systemctl enable nebius-tunnel-agent.service > systemctl restart nebius-tunnel-agent.service > > - path: /etc/systemd/system/vllm.service > permissions: "0644" > content: | > [Unit] > Description=vLLM (OpenAI-compatible API behind a Nebius tunnel) > After=network-online.target docker.service > Wants=network-online.target > Requires=docker.service > > [Service] > ExecStartPre=-/usr/bin/docker rm -f vllm > ExecStartPre=/usr/bin/docker pull vllm/vllm-openai:latest > ExecStart=/usr/bin/docker run --rm --name vllm \ > --gpus all \ > -p 127.0.0.1:8000:8000 \ > -v /opt/vllm/hf-cache:/root/.cache/huggingface \ > vllm/vllm-openai:latest \ > --model Qwen/Qwen3-8B \ > --served-model-name qwen3-8b \ > --max-model-len 8192 \ > --host 0.0.0.0 --port 8000 > ExecStop=/usr/bin/docker stop vllm > Restart=on-failure > RestartSec=10 > TimeoutStartSec=0 > > [Install] > WantedBy=multi-user.target > > runcmd: > # Agent first: the tunnel is up while the backend is still pulling images. > - [/usr/local/sbin/install-nebius-tunnel-agent] > - mkdir -p /opt/vllm/hf-cache > - systemctl enable --now vllm.service > ``` > > This configuration enables the following actions: > > * Add a username and a public SSH key to the VM. > > * Authenticate by using the service account attached to the VM. > > * Create two [Nebius Tunnels services](https://docs.nebius.com/tunnels/overview.md#supported-traffic): > > * `llm`: To address the model and chat with it. > * `ssh`: To connect to the VM by using SSH. > > * Deploy the tunnel agent on the VM. > > * Deploy a Docker image with the Qwen/Qwen3-8B model on the VM. 3. Create the VM: > [tab] Web console > > 1. In the sidebar, go to  **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. On the **Compute** step, configure computing resources: > > 1. In the **Platform** section, select: > > * With GPUs > * Regular > * NVIDIA® H100 NVLink > 2. In the **Settings** section, set: > > * **Preset**: 1 GPU - 16 CPUs - 200 GiB RAM. > * **Project**: Project where you create all resources for the tunnel. > * **VM name**: `tunnel-llm`. > > 4. On the **Storage** step: > > 1. Preserve the **Ubuntu 24.04 LTS for NVIDIA® GPUs (CUDA® 13)** disk image. > 2. Change the disk type to Network SSD IO M3. > 3. Change the disk size to 186 GiB. > > 5. On the **Network** step, check the network and subnet. Keep **None** in the **Public IP address** field. > > 6. On the **Configuration** step, configure the access, identity and VM startup settings: > > 1. In the **Service account** field, select the `tunnel-agent-sa` service account. > 2. Enable a custom cloud-init configuration file. > 3. In the field that appears, paste the contents of the `llm.yaml` file prepared earlier. > > 7. On the **Review** step, check the full VM configuration. To change a section quickly, click  next to the corresponding block. The wizard opens the relevant step with your current settings. > > 8. Click **Create VM**. > [tab] CLI > > ```bash > nebius compute instance create \ > --name tunnel-llm \ > --resources-platform gpu-h100-sxm \ > --resources-preset 1gpu-16vcpu-200gb \ > --boot-disk-attach-mode READ_WRITE \ > --boot-disk-managed-disk-name tunnel-llm-boot \ > --boot-disk-managed-disk-type network_ssd_io_m3 \ > --boot-disk-managed-disk-size-gibibytes 186 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-cuda13.0 \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"subnet_id\": \"\"}]" \ > --service-account-id \ > --cloud-init-user-data "$(cat llm.yaml)" > ``` > > In the command, specify the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) and the ID of the `tunnel-agent-sa` service account. > [tab] Go SDK > > ```go > cloudInit, err := os.ReadFile("llm.yaml") > if err != nil { > return fmt.Errorf("read cloud init: %w", err) > } > resources := &compute.ResourcesSpec{ > Platform: "gpu-h100-sxm", > Size: &compute.ResourcesSpec_Preset{ > Preset: "1gpu-16vcpu-200gb", > }, > } > bootDiskSpec := &compute.DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD_IO_M3, > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 186, > }, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-cuda13.0", > }, > }, > } > bootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "tunnel-llm-boot", > Spec: bootDiskSpec, > }, > }, > } > networkInterface := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: "", > IpAddress: &compute.IPAddress{}, > } > createVmService := sdk.Services().Compute().V1(). > Instance() > createVmOperation, err := createVmService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-llm", > }, > Spec: &compute.InstanceSpec{ > Resources: resources, > BootDisk: bootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > networkInterface, > }, > ServiceAccountId: "", > CloudInitUserData: string(cloudInit), > }, > }, > ) > if err != nil { > return fmt.Errorf("create instance: %w", err) > } > createVmOperation, err = createVmOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create instance: %w", err) > } > ``` > > In the code, set `SubnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) and `ServiceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `llm.yaml` file in the working directory. > [tab] Python SDK > > ```python > cloud_init = Path("llm.yaml").read_text() > boot_disk_spec = DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD_IO_M3, > size_gibibytes=186, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-cuda13.0", > ), > ) > boot_disk = AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > managed_disk=ManagedDisk( > name="tunnel-llm-boot", > spec=boot_disk_spec, > ), > ) > network_interface = NetworkInterfaceSpec( > name="eth0", > subnet_id="", > ip_address=IPAddress(), > ) > create_vm_service = InstanceServiceClient(sdk) > create_vm_operation = await create_vm_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="tunnel-llm", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="gpu-h100-sxm", > preset="1gpu-16vcpu-200gb", > ), > boot_disk=boot_disk, > network_interfaces=[network_interface], > service_account_id="", > cloud_init_user_data=cloud_init, > ), > ), > ) > await create_vm_operation.wait() > ``` > > In the code, set `subnet_id` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) and `service_account_id` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `llm.yaml` file in the working directory. > [tab] JavaScript SDK > > ```ts > const cloudInit = await readFile("llm.yaml", "utf8"); > const sourceImage = SourceImageFamily.create({ > imageFamily: "ubuntu24.04-cuda13.0", > }); > const bootDiskSpec = DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD_IO_M3, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 186, > }, > source: { > $case: "sourceImageFamily", > sourceImageFamily: sourceImage, > }, > }); > const managedDisk = ManagedDisk.create({ > name: "tunnel-llm-boot", > spec: bootDiskSpec, > }); > const bootDisk = AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk, > }, > }); > const networkInterface = NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: "", > ipAddress: IPAddress.create({}), > }); > const createVmService = new InstanceService(sdk); > const createVmOperation = await createVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-llm", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "gpu-h100-sxm", > size: { > $case: "preset", > preset: "1gpu-16vcpu-200gb", > }, > }), > bootDisk: bootDisk, > networkInterfaces: [networkInterface], > serviceAccountId: "", > cloudInitUserData: cloudInit, > }), > }), > ).result; > await createVmOperation.wait(); > ``` > > In the code, set `subnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) and `serviceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `llm.yaml` file in the working directory. Wait for the VM to start running. ### Check the result and chat with the LLM The first VM boot pulls the LLM Docker image and model weights. The model deployment takes 10-20 minutes. The tunnel agent becomes available before the LLM starts. 1. To check the status of the model deployment, connect to the VM through the `ssh` tunnel service: ```bash ssh -o ProxyCommand="openssl s_client -quiet -verify_quiet -servername %h -connect %h:443" \ ubuntu@ssh-.tunnel.applications..nebius.cloud ``` In the VM address, specify: * `tunnel_masked_ID`: Mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. Contains the last 15 characters of the tunnel ID. For example, for `applicationtunnel-e00abcdef123456789`, the masked ID of the tunnel is `abcdef123456789`. * `region`: [Region](https://docs.nebius.com/overview/regions.md) of the project where you created the resources. For more information about the tunnel URL, see [Supported traffic](https://docs.nebius.com/tunnels/overview.md#supported-traffic). 2. Check logs: ```bash journalctl -u vllm -f ``` When the logs contain `INFO: Application startup complete`, the model is ready to serve requests. 3. Disconnect from the VM. 4. Send a chat completion request from your local machine: ```bash curl https://llm-.tunnel.applications..nebius.cloud/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "qwen3-8b", "stream": false, "messages": [{"role": "user", "content": "Say hi"}] }' ``` The result is a JSON response with the model's answer in the `choices[0].message.content` parameter. If the response is `failed to connect to local service`, this means that the model hasn't started yet. Wait a few minutes and try again. ## How to delete the created resources The created VM and its boot disk are chargeable. If you don't need them, [delete the VM](https://docs.nebius.com/compute/virtual-machines/delete.md), so Nebius AI Cloud doesn't charge for the resources. The boot disk is deleted automatically when you delete the VM. You can also delete free resources: * [Tunnel](https://docs.nebius.com/tunnels/delete.md) * [Service account](https://docs.nebius.com/iam/service-accounts/manage.md#deleting-a-service-account) * [Custom group](https://docs.nebius.com/iam/authorization/groups/delete-groups.md) # Receiving webhooks in a private service by using Nebius Tunnels Source: https://docs.nebius.com/tunnels/tutorials/webhook.md Webhook providers such as GitHub, Stripe and Telegram send requests to publicly reachable HTTPS endpoints. A webhook handler running on a virtual machine (VM) without a public IP address cannot receive these requests directly. Nebius Tunnels provides a public HTTPS endpoint for the webhook handler. A tunnel agent running on the VM establishes an outbound connection to Nebius Tunnels. When a webhook provider sends a request to the public endpoint, Nebius Tunnels forwards it through this connection to the handler on the VM. The VM does not need an open inbound firewall port. The tunnel URL remains stable for the lifetime of the tunnel. You can configure this URL as the webhook endpoint in the external service and continue using the same URL for subsequent requests. When the VM starts, the tunnel agent starts automatically and connects to the tunnel. Requests sent to the public tunnel URL are forwarded through this connection to the service running on the VM. ## Limitations Before creating the infrastructure, consider the following: * Connect only one VM to each tunnel. Connecting multiple VMs to the same tunnel is not supported. * Nebius Tunnels forwards incoming requests but does not authenticate their senders. Configure your webhook handler to verify the signature provided by the webhook provider. ## Costs Nebius AI Cloud charges you for the following billing items: * [Compute virtual machine](https://docs.nebius.com/compute/resources/pricing.md#virtual-machines-gpus-vcpus-ram) * [Boot disk](https://docs.nebius.com/compute/resources/pricing.md#disks) attached to the VM Nebius Tunnels is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and provided free of charge. ## Steps ### Create a tunnel > [tab] Web console > > 1. In the [web console](https://console.nebius.com), select the project where you want to create the infrastructure. All resources must be located in the same project. > 2. Go to **Networking** → **Tunnels**. > 3. Click **Create tunnel**. > 4. On the page that opens, set the tunnel name to `my-tunnel`. > 5. Click **Create tunnel**. > [tab] CLI > > 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > When configuring the CLI profile, set the project where you want to create the infrastructure. All resources must be located in the same project. > > All `nebius` commands by default use the [project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-cli) from your CLI profile configuration. > > 2. Create a tunnel: > > ```bash > nebius tunnel create --title my-tunnel > ``` > [tab] Go SDK > > 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `gosdk.WithParentID`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```go > createTunnelService := sdk.Services().Tunnel().V1(). > Tunnel() > createTunnelOperation, err := createTunnelService.Create( > ctx, > &tunnel.CreateTunnelRequest{ > Spec: &tunnel.TunnelSpec{ > Title: "my-tunnel", > }, > }, > ) > if err != nil { > return fmt.Errorf("create tunnel: %w", err) > } > createTunnelOperation, err = createTunnelOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create tunnel: %w", err) > } > tunnelID := createTunnelOperation.ResourceID() > fmt.Println(tunnelID) > ``` > [tab] Python SDK > > 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parent_id`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```python > create_tunnel_service = TunnelServiceClient(sdk) > create_tunnel_operation = await create_tunnel_service.create( > CreateTunnelRequest( > spec=TunnelSpec( > title="my-tunnel", > ), > ), > ) > await create_tunnel_operation.wait() > tunnel_id = create_tunnel_operation.resource_id > print(tunnel_id) > ``` > [tab] JavaScript SDK > > 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > When initializing the SDK, set the project where you want to create the infrastructure in `parentId`. All resources must be located in the same project. > > 2. Create a tunnel: > > ```ts > const createTunnelService = new TunnelService(sdk); > const createTunnelOperation = await createTunnelService.create( > CreateTunnelRequest.create({ > metadata: ResourceMetadata.create({}), > spec: TunnelSpec.create({ > title: "my-tunnel", > }), > }), > ).result; > await createTunnelOperation.wait(); > const tunnelId = createTunnelOperation.resourceId(); > console.log(tunnelId); > ``` ### Configure access for the tunnel agent To authorize the VM in the tunnel, prepare a service account with the `applicationtunnel.agent` role. Later, you attach this service account to the VM. 1. Create the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Service account**. > 3. In the window that opens, set the name to `tunnel-agent-sa` and select the project. > 4. Click **Create and continue**. > [tab] CLI > > ```bash > nebius iam service-account create --name tunnel-agent-sa > ``` > [tab] Go SDK > > ```go > createSaService := sdk.Services().IAM().V1(). > ServiceAccount() > createSaOperation, err := createSaService.Create( > ctx, > &iam.CreateServiceAccountRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agent-sa", > }, > Spec: &iam.ServiceAccountSpec{}, > }, > ) > if err != nil { > return fmt.Errorf("create service account: %w", err) > } > createSaOperation, err = createSaOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create service account: %w", err) > } > saID := createSaOperation.ResourceID() > fmt.Println(saID) > ``` > [tab] Python SDK > > ```python > create_sa_service = ServiceAccountServiceClient(sdk) > create_sa_operation = await create_sa_service.create( > CreateServiceAccountRequest( > metadata=ResourceMetadata( > name="tunnel-agent-sa", > ), > spec=ServiceAccountSpec(), > ), > ) > await create_sa_operation.wait() > sa_id = create_sa_operation.resource_id > print(sa_id) > ``` > [tab] JavaScript SDK > > ```ts > const createSaService = new ServiceAccountService(sdk); > const createSaOperation = await createSaService.create( > CreateServiceAccountRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agent-sa", > }), > spec: ServiceAccountSpec.create({}), > }), > ).result; > await createSaOperation.wait(); > const saId = createSaOperation.resourceId(); > console.log(saId); > ``` 2. Create a [custom group](https://docs.nebius.com/iam/authorization/groups/index.md#custom-groups) in Identity and Access Management to assign the role to the service account: > [tab] Web console > > 1. In the sidebar, go to  **Administration** → **IAM**. > 2. Click **Create resource** → **Group**. > 3. In the window that opens, set the group name to `tunnel-agents`. In the **Scope** field, select the project where you create all the resources. > 4. Click **Create**. > [tab] CLI > > ```bash > nebius iam group create --name tunnel-agents > ``` > [tab] Go SDK > > ```go > createGroupService := sdk.Services().IAM().V1(). > Group() > createGroupOperation, err := createGroupService.Create( > ctx, > &iam.CreateGroupRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-agents", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group: %w", err) > } > createGroupOperation, err = createGroupOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group: %w", err) > } > groupID := createGroupOperation.ResourceID() > fmt.Println(groupID) > ``` > [tab] Python SDK > > ```python > create_group_service = GroupServiceClient(sdk) > create_group_operation = await create_group_service.create( > CreateGroupRequest( > metadata=ResourceMetadata( > name="tunnel-agents", > ), > ), > ) > await create_group_operation.wait() > group_id = create_group_operation.resource_id > print(group_id) > ``` > [tab] JavaScript SDK > > ```ts > const createGroupService = new GroupService(sdk); > const createGroupOperation = await createGroupService.create( > CreateGroupRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-agents", > }), > }), > ).result; > await createGroupOperation.wait(); > const groupId = createGroupOperation.resourceId(); > console.log(groupId); > ``` 3. Attach the tunnel and grant the `applicationtunnel.agent` role to this group. You can't grant this role in the web console. > [tab] CLI > > 1. Get the group ID: > > ```bash > nebius iam group list > ``` > > The ID is specified in the `items.metadata.id` parameter in the output. > > 2. Get the tunnel ID: > > ```bash > nebius tunnel list > ``` > > 3. Create an access permit in the custom group: > > ```bash > nebius iam access-permit create \ > --parent-id \ > --resource-id \ > --role applicationtunnel.agent > ``` > [tab] Go SDK > > 1. Get the group ID: > > ```go > listGroupsService := sdk.Services().IAM().V1(). > Group() > listGroups, err := listGroupsService.List( > ctx, > &iam.ListGroupsRequest{}, > ) > if err != nil { > return fmt.Errorf("list groups: %w", err) > } > fmt.Println(listGroups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `Metadata.Id`. > > 2. Get the tunnel ID: > > ```go > listTunnelsService := sdk.Services().Tunnel().V1(). > Tunnel() > listTunnels, err := listTunnelsService.List( > ctx, > &tunnel.ListTunnelRequest{}, > ) > if err != nil { > return fmt.Errorf("list tunnels: %w", err) > } > fmt.Println(listTunnels) > ``` > > 3. Create an access permit in the custom group: > > ```go > accessPermitService := sdk.Services().IAM().V1(). > AccessPermit() > accessPermitOperation, err := accessPermitService.Create( > ctx, > &iam.CreateAccessPermitRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.AccessPermitSpec{ > ResourceId: "", > Role: "applicationtunnel.agent", > }, > }, > ) > if err != nil { > return fmt.Errorf("create access permit: %w", err) > } > accessPermitOperation, err = accessPermitOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create access permit: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `ResourceId` in `AccessPermitSpec` to the tunnel ID. > [tab] Python SDK > > 1. Get the group ID: > > ```python > list_groups_service = GroupServiceClient(sdk) > list_groups = await list_groups_service.list( > ListGroupsRequest(), > ) > print(list_groups) > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```python > list_tunnels_service = TunnelServiceClient(sdk) > list_tunnels = await list_tunnels_service.list( > ListTunnelRequest(), > ) > print(list_tunnels) > ``` > > 3. Create an access permit in the custom group: > > ```python > access_permit_service = AccessPermitServiceClient(sdk) > access_permit_operation = await access_permit_service.create( > CreateAccessPermitRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=AccessPermitSpec( > resource_id="", > role="applicationtunnel.agent", > ), > ), > ) > await access_permit_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `resource_id` in `AccessPermitSpec` to the tunnel ID. > [tab] JavaScript SDK > > 1. Get the group ID: > > ```ts > const listGroupsService = new GroupService(sdk); > const listGroups = await listGroupsService.list( > ListGroupsRequest.create({}), > ).result; > console.log(listGroups); > ``` > > In the response, the ID of the `tunnel-agents` group is in `metadata.id`. > > 2. Get the tunnel ID: > > ```ts > const listTunnelsService = new TunnelService(sdk); > const listTunnels = await listTunnelsService.list( > ListTunnelRequest.create({}), > ).result; > console.log(listTunnels); > ``` > > 3. Create an access permit in the custom group: > > ```ts > const accessPermitService = new AccessPermitService(sdk); > const accessPermitOperation = await accessPermitService.create( > CreateAccessPermitRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: AccessPermitSpec.create({ > resourceId: "", > role: "applicationtunnel.agent", > }), > }), > ).result; > await accessPermitOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `resourceId` in `AccessPermitSpec` to the tunnel ID. 4. Add the service account to the group: > [tab] Web console > > 1. Go to  **Administration** → **IAM**. > 2. On the **Groups** tab, find and open the `tunnel-agents` group. > 3. Click  **Add members**. > 4. In the window that opens, add the `tunnel-agent-sa` service account. > 5. Once the account is added, close the window. > > Check the group page in general. Make sure that: > > * The `tunnel-agent-sa` service account is specified on the **Members** tab. > * The tunnel and the `applicationtunnel.agent` role are specified on the **Access permits** tab. > [tab] CLI > > ```bash > nebius iam group-membership create \ > --parent-id \ > --member-id > ``` > > To get the service account ID, run: > > ```bash > nebius iam service-account list > ``` > [tab] Go SDK > > ```go > membershipService := sdk.Services().IAM().V1(). > GroupMembership() > membershipOperation, err := membershipService.Create( > ctx, > &iam.CreateGroupMembershipRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > }, > Spec: &iam.GroupMembershipSpec{ > MemberId: "", > }, > }, > ) > if err != nil { > return fmt.Errorf("create group membership: %w", err) > } > membershipOperation, err = membershipOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create group membership: %w", err) > } > ``` > > In the code, set `ParentId` in `ResourceMetadata` to the group ID and `MemberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```go > listServiceAccountsService := sdk.Services().IAM().V1(). > ServiceAccount() > listServiceAccounts, err := listServiceAccountsService.List( > ctx, > &iam.ListServiceAccountRequest{}, > ) > if err != nil { > return fmt.Errorf("list service accounts: %w", err) > } > fmt.Println(listServiceAccounts) > ``` > [tab] Python SDK > > ```python > membership_service = GroupMembershipServiceClient(sdk) > membership_operation = await membership_service.create( > CreateGroupMembershipRequest( > metadata=ResourceMetadata( > parent_id="", > ), > spec=GroupMembershipSpec( > member_id="", > ), > ), > ) > await membership_operation.wait() > ``` > > In the code, set `parent_id` in `ResourceMetadata` to the group ID and `member_id` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```python > list_service_accounts_service = ( > ServiceAccountServiceClient(sdk) > ) > list_service_accounts = await list_service_accounts_service.list( > ListServiceAccountRequest(), > ) > print(list_service_accounts) > ``` > [tab] JavaScript SDK > > ```ts > const membershipService = new GroupMembershipService(sdk); > const membershipOperation = await membershipService.create( > CreateGroupMembershipRequest.create({ > metadata: ResourceMetadata.create({ > parentId: "", > }), > spec: GroupMembershipSpec.create({ > memberId: "", > }), > }), > ).result; > await membershipOperation.wait(); > ``` > > In the code, set `parentId` in `ResourceMetadata` to the group ID and `memberId` in `GroupMembershipSpec` to the ID of the `tunnel-agent-sa` service account. > > To get the service account ID, list the service accounts: > > ```ts > const listServiceAccountsService = > new ServiceAccountService(sdk); > const listServiceAccounts = await listServiceAccountsService.list( > ListServiceAccountRequest.create({}), > ).result; > console.log(listServiceAccounts); > ``` ### Create a virtual machine Create a VM without a public IP address and use a cloud-init configuration to install and start the tunnel agent and a sample webhook handler. Attach the service account you configured earlier so that the tunnel agent can connect to the tunnel. > [!WARNING] > > If you need to change the VM configuration later, update `webhook.yaml`, delete the VM, and create a new one. A tunnel should be associated with only one VM, and you can't change the cloud-init configuration of an existing VM. 1. [Generate an SSH key pair](https://docs.nebius.com/compute/virtual-machines/ssh-keys.md#generating-a-key-pair). 2. Prepare the cloud-init configuration file. You'll attach it to the VM. In this file, specify two parameters: * `users.ssh_authorized_keys`: Public SSH key. * `write_files.content.tunnel_id`: ID of the tunnel. > [accordion] webhook.yaml > > ```yaml > #cloud-config > users: > - name: ubuntu > sudo: "ALL=(ALL) NOPASSWD:ALL" > shell: /bin/bash > ssh_authorized_keys: > - > > # Driverless images don't include Docker, so install it during VM initialization. > package_update: true > packages: > - docker.io > > write_files: > - path: /etc/nebius-tunnel-agent/config.yaml > permissions: "0640" > content: | > tunnel_id: > > iam: > metadata: > enabled: true > > logging: > level: info > format: json > > services: > - name: hook > type: http > target: 127.0.0.1:8080 > - name: ssh > type: tcp > target: 127.0.0.1:22 > > - path: /etc/systemd/system/nebius-tunnel-agent.service > permissions: "0644" > content: | > [Unit] > Description=Nebius tunnel agent > Documentation=https://docs.nebius.com/tunnels > After=network-online.target > Wants=network-online.target > > [Service] > Type=simple > User=tunna > Group=tunna > ExecStart=/usr/local/bin/nebius-tunnel-agent --config /etc/nebius-tunnel-agent/config.yaml > Restart=always > RestartSec=5 > NoNewPrivileges=true > ProtectSystem=strict > ProtectHome=true > PrivateTmp=true > ReadOnlyPaths=/etc/nebius-tunnel-agent > > [Install] > WantedBy=multi-user.target > > - path: /usr/local/sbin/install-nebius-tunnel-agent > permissions: "0755" > content: | > #!/bin/bash > set -euo pipefail > > VERSION="${AGENT_VERSION:-latest}" > BASE="https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent" > CONF_DIR=/etc/nebius-tunnel-agent > > case "$(uname -m)" in > x86_64) PLATFORM=linux-x86_64 ;; > aarch64|arm64) PLATFORM=linux-aarch64 ;; > *) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;; > esac > ASSET="nebius-tunnel-agent-${PLATFORM}.tar.gz" > > TMP="$(mktemp -d)" > trap 'rm -rf "$TMP"' EXIT > > fetch() { > curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$2" "$1" > } > fetch "$BASE/$VERSION/$ASSET" "$TMP/$ASSET" > fetch "$BASE/$VERSION/checksums-sha256.txt" "$TMP/checksums-sha256.txt" > > (cd "$TMP" && sha256sum --ignore-missing -c checksums-sha256.txt) > > tar -xzf "$TMP/$ASSET" -C "$TMP" > install -m0755 "$TMP/nebius-tunnel-agent" /usr/local/bin/nebius-tunnel-agent > > getent group tunna >/dev/null || groupadd --system tunna > id -u tunna >/dev/null 2>&1 || useradd --system --gid tunna \ > --no-create-home --shell /usr/sbin/nologin tunna > chown -R tunna:tunna "$CONF_DIR" > chmod 0750 "$CONF_DIR" > chmod 0640 "$CONF_DIR/config.yaml" > > systemctl daemon-reload > systemctl enable nebius-tunnel-agent.service > systemctl restart nebius-tunnel-agent.service > > - path: /etc/systemd/system/webhook-sink.service > permissions: "0644" > content: | > [Unit] > Description=go-httpbin webhook sink (behind a Nebius tunnel) > After=network-online.target docker.service > Wants=network-online.target > Requires=docker.service > > [Service] > ExecStartPre=-/usr/bin/docker rm -f webhook-sink > ExecStartPre=/usr/bin/docker pull ghcr.io/mccutchen/go-httpbin:2.22 > ExecStart=/usr/bin/docker run --rm --name webhook-sink \ > -p 127.0.0.1:8080:8080 \ > ghcr.io/mccutchen/go-httpbin:2.22 > ExecStop=/usr/bin/docker stop webhook-sink > Restart=on-failure > RestartSec=10 > TimeoutStartSec=0 > > [Install] > WantedBy=multi-user.target > > runcmd: > # Agent first: the tunnel is up while the backend is still pulling images. > - [/usr/local/sbin/install-nebius-tunnel-agent] > - systemctl enable --now webhook-sink.service > ``` > > This configuration enables the following actions: > > * Add a username and a public SSH key to the VM. > > * Install Docker on the VM. > > * Authenticate by using the service account attached to the VM. > > * Create two [Nebius Tunnels services](https://docs.nebius.com/tunnels/overview.md#supported-traffic): > > * `hook`: To receive incoming webhook requests on port 8080. > * `ssh`: To connect to the VM by using SSH. > > * Deploy the tunnel agent on the VM. > > * Deploy `go-httpbin` as a placeholder webhook receiver. Replace it with your own service and point `target` at its port. 3. Create the VM: > [tab] Web console > > 1. In the sidebar, go to **Compute** → **Virtual machines**. > > 2. Click **Create resource** → **Virtual machine**. > > The creation flow is a step-by-step wizard. The sidebar shows your progress through the configuration sections. To move between sections, click **Back** and **Next**. > > 3. On the **Compute** step, configure computing resources: > > 1. In the **Platform** section, select: > > * Without GPUs > * Regular > * Non-GPU AMD Epyc Genoa > 2. In the **Settings** section, set: > > * **Preset**: 2 CPUs - 8 GiB RAM. > * **Project**: Project where you create all resources for the tunnel. > * **VM name**: `tunnel-hook`. > > 4. On the **Storage** step, preserve the **Ubuntu 24.04 LTS** disk image and the SSD disk type, but change the disk size to 20 GiB. > > 5. On the **Network** step, check the network and subnet. Keep **None** in the **Public IP address** field. > > 6. On the **Configuration** step, configure the access, identity and VM startup settings: > > 1. In the **Service account** field, select the `tunnel-agent-sa` service account. > 2. Enable a custom cloud-init configuration file. > 3. In the field that appears, paste the contents of the `webhook.yaml` file prepared earlier. > > 7. On the **Review** step, check the full VM configuration. To change a section quickly, click  next to the corresponding block. The wizard opens the relevant step with your current settings. > > 8. Click **Create VM**. > [tab] CLI > > ```bash > nebius compute instance create \ > --name tunnel-hook \ > --resources-platform cpu-e2 \ > --resources-preset 2vcpu-8gb \ > --boot-disk-attach-mode READ_WRITE \ > --boot-disk-managed-disk-name tunnel-hook-boot \ > --boot-disk-managed-disk-type network_ssd \ > --boot-disk-managed-disk-size-gibibytes 20 \ > --boot-disk-managed-disk-source-image-family-image-family ubuntu24.04-driverless \ > --network-interfaces "[{\"name\": \"eth0\", \"ip_address\": {}, \"subnet_id\": \"\"}]" \ > --service-account-id \ > --cloud-init-user-data "$(cat webhook.yaml)" > ``` > > In the command, specify the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli) and the ID of the `tunnel-agent-sa` service account. > [tab] Go SDK > > ```go > webhookCloudInit, err := os.ReadFile("webhook.yaml") > if err != nil { > return fmt.Errorf("read cloud init: %w", err) > } > webhookResources := &compute.ResourcesSpec{ > Platform: "cpu-e2", > Size: &compute.ResourcesSpec_Preset{ > Preset: "2vcpu-8gb", > }, > } > webhookBootDiskSpec := &compute.DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > Size: &compute.DiskSpec_SizeGibibytes{ > SizeGibibytes: 20, > }, > Source: &compute.DiskSpec_SourceImageFamily{ > SourceImageFamily: &compute.SourceImageFamily{ > ImageFamily: "ubuntu24.04-driverless", > }, > }, > } > webhookBootDisk := &compute.AttachedDiskSpec{ > AttachMode: compute.AttachedDiskSpec_READ_WRITE, > Type: &compute.AttachedDiskSpec_ManagedDisk{ > ManagedDisk: &compute.ManagedDisk{ > Name: "tunnel-hook-boot", > Spec: webhookBootDiskSpec, > }, > }, > } > webhookNetworkInterface := &compute.NetworkInterfaceSpec{ > Name: "eth0", > SubnetId: "", > IpAddress: &compute.IPAddress{}, > } > createWebhookVmService := sdk.Services().Compute().V1(). > Instance() > createWebhookVmOperation, err := createWebhookVmService.Create( > ctx, > &compute.CreateInstanceRequest{ > Metadata: &common.ResourceMetadata{ > Name: "tunnel-hook", > }, > Spec: &compute.InstanceSpec{ > Resources: webhookResources, > BootDisk: webhookBootDisk, > NetworkInterfaces: []*compute.NetworkInterfaceSpec{ > webhookNetworkInterface, > }, > ServiceAccountId: "", > CloudInitUserData: string(webhookCloudInit), > }, > }, > ) > if err != nil { > return fmt.Errorf("create instance: %w", err) > } > createWebhookVmOperation, err = createWebhookVmOperation.Wait(ctx) > if err != nil { > return fmt.Errorf("wait for create instance: %w", err) > } > ``` > > In the code, set `SubnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk) and `ServiceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `webhook.yaml` file in the working directory. > [tab] Python SDK > > ```python > webhook_cloud_init = Path("webhook.yaml").read_text() > webhook_boot_disk_spec = DiskSpec( > type=DiskSpec.DiskType.NETWORK_SSD, > size_gibibytes=20, > source_image_family=SourceImageFamily( > image_family="ubuntu24.04-driverless", > ), > ) > webhook_boot_disk = AttachedDiskSpec( > attach_mode=AttachedDiskSpec.AttachMode.READ_WRITE, > managed_disk=ManagedDisk( > name="tunnel-hook-boot", > spec=webhook_boot_disk_spec, > ), > ) > webhook_network_interface = NetworkInterfaceSpec( > name="eth0", > subnet_id="", > ip_address=IPAddress(), > ) > create_webhook_vm_service = InstanceServiceClient(sdk) > create_webhook_vm_operation = await create_webhook_vm_service.create( > CreateInstanceRequest( > metadata=ResourceMetadata( > name="tunnel-hook", > ), > spec=InstanceSpec( > resources=ResourcesSpec( > platform="cpu-e2", > preset="2vcpu-8gb", > ), > boot_disk=webhook_boot_disk, > network_interfaces=[webhook_network_interface], > service_account_id="", > cloud_init_user_data=webhook_cloud_init, > ), > ), > ) > await create_webhook_vm_operation.wait() > ``` > > In the code, set `subnet_id` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk) and `service_account_id` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `webhook.yaml` file in the working directory. > [tab] JavaScript SDK > > ```ts > const webhookCloudInit = > await readFile("webhook.yaml", "utf8"); > const webhookSourceImage = SourceImageFamily.create({ > imageFamily: "ubuntu24.04-driverless", > }); > const webhookBootDiskSpec = DiskSpec.create({ > type: DiskSpec_DiskType.NETWORK_SSD, > size: { > $case: "sizeGibibytes", > sizeGibibytes: 20, > }, > source: { > $case: "sourceImageFamily", > sourceImageFamily: webhookSourceImage, > }, > }); > const webhookManagedDisk = ManagedDisk.create({ > name: "tunnel-hook-boot", > spec: webhookBootDiskSpec, > }); > const webhookBootDisk = AttachedDiskSpec.create({ > attachMode: AttachedDiskSpec_AttachMode.READ_WRITE, > type: { > $case: "managedDisk", > managedDisk: webhookManagedDisk, > }, > }); > const webhookNetworkInterface = NetworkInterfaceSpec.create({ > name: "eth0", > subnetId: "", > ipAddress: IPAddress.create({}), > }); > const createWebhookVmService = new InstanceService(sdk); > const createWebhookVmOperation = > await createWebhookVmService.create( > CreateInstanceRequest.create({ > metadata: ResourceMetadata.create({ > name: "tunnel-hook", > }), > spec: InstanceSpec.create({ > resources: ResourcesSpec.create({ > platform: "cpu-e2", > size: { > $case: "preset", > preset: "2vcpu-8gb", > }, > }), > bootDisk: webhookBootDisk, > networkInterfaces: [webhookNetworkInterface], > serviceAccountId: "", > cloudInitUserData: webhookCloudInit, > }), > }), > ).result; > await createWebhookVmOperation.wait(); > ``` > > In the code, set `subnetId` in `NetworkInterfaceSpec` to the [subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk) and `serviceAccountId` in `InstanceSpec` to the ID of the `tunnel-agent-sa` service account. The code reads the cloud-init configuration from the `webhook.yaml` file in the working directory. Wait for the VM to start running. ### Check the result The tunnel agent starts as soon as the VM boots. The `webhook-sink` service starts shortly after Docker pulls the `go-httpbin` image. To check that the webhook endpoint is working, send a test request from your local machine: ```bash curl -X POST \ https://hook-.tunnel.applications..nebius.cloud/anything \ -H "Content-Type: application/json" \ -d '{"ping": 1}' ``` In the URL, specify: * `tunnel_masked_ID`: Mask of the tunnel ID without the `applicationtunnel-` prefix and regional routing code. Contains the last 15 characters of the tunnel ID. For example, for `applicationtunnel-e00abcdef123456789`, the masked ID of the tunnel is `abcdef123456789`. * `region`: [Region](https://docs.nebius.com/overview/regions.md) of the project where you created the resources. For more information about the tunnel URL, see [Supported traffic](https://docs.nebius.com/tunnels/overview.md#supported-traffic). The expected response is a JSON object that echoes back the request details: ```json { "method": "POST", "url": "https://hook-.tunnel.applications..nebius.cloud/anything", "data": "{\"ping\": 1}", ... } ``` If the response is `failed to connect to local service`, the `webhook-sink` service hasn't started yet. Wait a few moments and try again. If it still fails, see [Troubleshooting](https://docs.nebius.com/tunnels/tutorials/webhook.md#troubleshooting). Once the endpoint is working, paste the tunnel URL — `https://hook-.tunnel.applications..nebius.cloud` — into the webhook settings of your provider (GitHub, Stripe, Telegram, etc.). The tunnel URL is stable for the tunnel's lifetime, so you only need to do this once. To replace `go-httpbin` with your own webhook handler, update `webhook.yaml`, delete the VM, and create it again. Configure your handler to listen on port 8080, or change the tunnel agent's `target` to match your handler's port. ## Troubleshooting If the test request fails, or the tunnel returns `failed to connect to local service`, connect to the VM and check the tunnel agent and the webhook handler. The VM has no public IP address. Connect through the `ssh` service of the tunnel. ### Connect to the VM Connect to the VM as described in [Connecting to a virtual machine without a public IP address](https://docs.nebius.com/tunnels/tutorials/connect-vm.md#connect-to-the-virtual-machine). If you still can't open the session, use the [serial console](https://docs.nebius.com/compute/virtual-machines/serial-console.md) and run the checks below from there. ### Check the tunnel agent On the VM, check the agent service and its logs: ```bash sudo systemctl status nebius-tunnel-agent.service sudo journalctl -u nebius-tunnel-agent.service ``` Add `-f` to follow new log lines, for example `sudo journalctl -u nebius-tunnel-agent.service -f`. When the agent has registered with the tunnel, the logs include the public endpoint of each service. If the agent doesn't register, check for these common causes: * **The VM has no service account attached.** `systemctl status` still shows `active (running)`, but the agent retries indefinitely, showing `IMDS token request failed: 404 Not Found` followed by `connection closed before registering`. You can't attach a service account to an existing VM. Delete the VM and create a new one with the `tunnel-agent-sa` service account attached. * **The tunnel agent isn't authorized to connect to the tunnel.** Verify that the `tunnel-agent-sa` service account belongs to the `tunnel-agents` group and that the group includes the `applicationtunnel.agent` role for this tunnel. Check the steps in [Configure access for the tunnel agent](https://docs.nebius.com/tunnels/tutorials/webhook.md#configure-access-for-the-tunnel-agent). Check that `tunnel_id` in the agent configuration is the ID of the tunnel you created: ```bash sudo grep tunnel_id /etc/nebius-tunnel-agent/config.yaml ``` The value looks like `applicationtunnel-e00abcdef123456789`. If it is still the `` placeholder, or it points at a different tunnel, delete the VM and create it again with the correct tunnel ID in `webhook.yaml`. ### Check the webhook handler The `hook` service forwards requests to `webhook-sink` on port 8080. Check that service and its logs: ```bash sudo systemctl status webhook-sink.service sudo journalctl -u webhook-sink.service ``` `webhook-sink` runs `go-httpbin` in Docker. If the unit is active and requests still fail, check the container: ```bash sudo docker ps -a --filter name=webhook-sink sudo docker logs webhook-sink ``` The first command should return a container named `webhook-sink`. Its status should begin with `Up`, and the port mapping should be `127.0.0.1:8080->8080/tcp`. This means that the container is running and its port `8080` is available through the VM's loopback interface. The output of the second command should contain the following message: ```text go-httpbin listening on http://0.0.0.0:8080 ``` ### Check cloud-init Use this check if either `systemctl status` command reports that the `nebius-tunnel-agent.service` or `webhook-sink.service` unit could not be found. This means that cloud-init might not have completed successfully. Check the cloud-init output: ```bash sudo tail -n 200 /var/log/cloud-init-output.log ``` The log records the installation of the tunnel agent and the startup of `webhook-sink.service`. Check it for errors related to downloading or installing the tunnel agent, installing Docker, or starting the webhook handler. After resolving the error, delete the VM and create it again with the corrected `webhook.yaml` file because cloud-init runs only when the VM is created. ## How to delete the created resources The created VM and its boot disk are chargeable. If you don't need them, [delete the VM](https://docs.nebius.com/compute/virtual-machines/delete.md), so Nebius AI Cloud doesn't charge for the resources. The boot disk is deleted automatically when you delete the VM. You can also delete free resources: * [Tunnel](https://docs.nebius.com/tunnels/delete.md) * [Service account](https://docs.nebius.com/iam/service-accounts/manage.md#deleting-a-service-account) * [Custom group](https://docs.nebius.com/iam/authorization/groups/delete-groups.md) # Nebius Tunnels limits and constraints Source: https://docs.nebius.com/tunnels/resources/quotas-limits.md Nebius Tunnels enforces platform-wide limits on traffic and client connections. These limits protect shared infrastructure and can't be changed in the web console. Limits apply at three nested levels: region, project, and tunnel. Each level is a shared pool of capacity: all tunnels in a [region](https://docs.nebius.com/overview/regions.md) share the region limit, all tunnels in a project share the project limit, and all clients of a tunnel share the tunnel limit. A tunnel never gets more than its own limit, but it can get less when other tunnels in its project or region are busy. When aggregate usage reaches a limit, responses may take longer until usage drops below the limit. ### Traffic Inbound and outbound traffic share the same limit. | Level | Limit, inbound and outbound traffic | | - | - | | Region | 8 Gbps | | Project | 600 Mbps | | Tunnel | 120 Mbps | ### Client connections *Client connections* are new connections from internet users to a tunnel's public URLs. The limits apply to the number of new connections per second. | Level | Limit, connections per second | | - | - | | Region | 6000 | | Project | 1500 | | Tunnel | 300 | ## Constraints Certain Nebius Tunnels settings have technical constraints that can't be changed directly. | Constraint name | Value | | - | - | | Agent connection protocol | HTTP/2 over TLS | | Supported service types | HTTP and TCP | # Nebius Tunnels pricing Source: https://docs.nebius.com/tunnels/resources/pricing.md Nebius Tunnels is [in preview](https://docs.nebius.com/overview/services.md#service-and-application-stages) and provided free of charge. If you run the tunnel agent on a Compute virtual machine (VM), Nebius AI Cloud charges you for the [Compute resources](https://docs.nebius.com/compute/resources/pricing.md) used by the VM. # Nebius Tunnels Agent changelog Source: https://docs.nebius.com/tunnels/resources/tunnels-agent-changelog.md Nebius Tunnels Agent runs next to your application and connects to a regional Nebius edge endpoint over an outbound TLS connection. It proxies inbound traffic from public tunnel URLs to local HTTP or TCP services, so you can expose a service without opening inbound firewall ports. For more details, see [How to connect to a tunnel](https://docs.nebius.com/tunnels/connect.md). **v1.2.0** 2026-09-21 You can now configure how the tunnel agent connects to your local services. The agent also spends less CPU on every request it forwards. ### Added * Optional top-level `local_service` section that configures how the tunnel agent connects to your services: ```yaml local_service: max_idle_conns: 400 max_idle_conns_per_host: 200 idle_conn_timeout: 120s dial_timeout: 5s ``` * `max_idle_conns`: Maximum number of idle connections across all target addresses. Default: `200`. * `max_idle_conns_per_host`: Maximum number of idle connections per target address. Services with the same `target` value in the `services` section share the same pool. Default: `100`. * `idle_conn_timeout`: How long an idle connection stays in the pool. Default: `90s`. * `dial_timeout`: Timeout for opening a connection to a service. Default: `10s`. Every parameter is optional. To set the default values for them, omit the parameters or set them to `0`. Negative values are invalid, and the agent doesn't start with them. The pool parameters apply to the services that the tunnel serves over HTTP/1.1. Services served over HTTP/2, such as gRPC, multiplex requests over a single connection and don't use the pool. The `dial_timeout` parameter applies to services of every type, including `type: tcp`. ### Changed * The agent keeps up to 100 idle connections per target address instead of 10, and 200 across all addresses instead of 100. Under concurrent load, it reuses these connections instead of opening a new one for every request. These limits apply to connections kept for reuse: the number of connections that the agent opens during peak moments depends on the number of concurrent requests and isn't limited by these parameters. * The agent uses less CPU per forwarded request. * Debug logs no longer contain request paths and target URLs, and error messages no longer contain the URL of a local service. #### Artifacts * **Binaries**: Linux (x86\_64, aarch64), macOS (arm64, x86\_64) and Windows (arm64, x86\_64) with a [checksums-sha256.txt](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/checksums-sha256.txt), covering every archive: * [nebius-tunnel-agent-linux-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/nebius-tunnel-agent-linux-x86_64.tar.gz) * [nebius-tunnel-agent-linux-aarch64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/nebius-tunnel-agent-linux-aarch64.tar.gz) * [nebius-tunnel-agent-darwin-arm64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/nebius-tunnel-agent-darwin-arm64.tar.gz) * [nebius-tunnel-agent-darwin-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/nebius-tunnel-agent-darwin-x86_64.tar.gz) * [nebius-tunnel-agent-windows-arm64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/nebius-tunnel-agent-windows-arm64.tar.gz) * [nebius-tunnel-agent-windows-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.2.0/nebius-tunnel-agent-windows-x86_64.tar.gz) * **Container image**: `cr.eu-north1.nebius.cloud/marketplace/docker/nebius-tunnel-agent:1.2.0` (linux/amd64, linux/arm64). * **Helm chart**: `oci://cr.eu-north1.nebius.cloud/marketplace/chart/nebius-tunnel-agent:1.2.0`. **v1.1.0** 2026-09-09 TCP services can now use [Application-Layer Protocol Negotiation](https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation) (ALPN) on the public TLS endpoint. This lets PostgreSQL clients of version 17 or later connect through a tunnel with `sslnegotiation=direct`. ### Added * Optional `alpn` parameter for services with `type: tcp`. The agent sends a list of protocols to the Nebius edge endpoint during registration, and the endpoint negotiates a protocol with the client: ```yaml services: - name: postgres target: localhost:5432 type: tcp alpn: [postgresql] ``` * Validation of the `alpn` parameter at the tunnel agent startup. The parameter can include up to 8 unique IDs, each 1 to 255 printable ASCII characters long and without spaces. Leading and trailing spaces are trimmed. HTTP services don't use `alpn`. To serve an HTTP service over HTTP/2, set `protocol: h2` instead. Configurations created earlier keep working: a TCP service with an omitted or empty `alpn` parameter behaves as before. The endpoint selects a protocol that the client offers, the service declares, and the endpoint allows. The list of allowed protocols includes `postgresql`. If the client doesn't offer any matching protocol, the endpoint completes a TLS handshake without ALPN. Clients that require it, such as PostgreSQL clients with `sslnegotiation=direct`, can't connect. #### Artifacts * **Binaries**: Linux (x86\_64, aarch64), macOS (arm64, x86\_64) and Windows (arm64, x86\_64) with a [checksums-sha256.txt](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/checksums-sha256.txt), covering every archive: * [nebius-tunnel-agent-linux-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/nebius-tunnel-agent-linux-x86_64.tar.gz) * [nebius-tunnel-agent-linux-aarch64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/nebius-tunnel-agent-linux-aarch64.tar.gz) * [nebius-tunnel-agent-darwin-arm64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/nebius-tunnel-agent-darwin-arm64.tar.gz) * [nebius-tunnel-agent-darwin-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/nebius-tunnel-agent-darwin-x86_64.tar.gz) * [nebius-tunnel-agent-windows-arm64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/nebius-tunnel-agent-windows-arm64.tar.gz) * [nebius-tunnel-agent-windows-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.1.0/nebius-tunnel-agent-windows-x86_64.tar.gz) * **Container image**: `cr.eu-north1.nebius.cloud/marketplace/docker/nebius-tunnel-agent:1.1.0` (linux/amd64, linux/arm64). * **Helm chart**: `oci://cr.eu-north1.nebius.cloud/marketplace/chart/nebius-tunnel-agent:1.1.0`. **v1.0.0** 2026-06-19 First public release of the Nebius Tunnels agent, a client-side tunnel that connects to Edge and proxies inbound traffic to local services. ### Added * Tunnel agent that connects to Edge and proxies traffic to a local service. * Release binaries for Linux (x86\_64, aarch64), macOS (arm64, x86\_64) and Windows (arm64, x86\_64). * Multi-arch container image (linux/amd64, linux/arm64). * Helm chart for running the agent in Kubernetes. #### Artifacts * **Binaries**: also mirrored under `.../latest/`, with a `checksums-sha256.txt`, covering every archive: * [nebius-tunnel-agent-linux-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.0.0/nebius-tunnel-agent-linux-x86_64.tar.gz) * [nebius-tunnel-agent-linux-aarch64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.0.0/nebius-tunnel-agent-linux-aarch64.tar.gz) * [nebius-tunnel-agent-darwin-arm64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.0.0/nebius-tunnel-agent-darwin-arm64.tar.gz) * [nebius-tunnel-agent-darwin-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.0.0/nebius-tunnel-agent-darwin-x86_64.tar.gz) * [nebius-tunnel-agent-windows-arm64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.0.0/nebius-tunnel-agent-windows-arm64.tar.gz) * [nebius-tunnel-agent-windows-x86\_64.tar.gz](https://storage.eu-north1.nebius.cloud/products/releases/nebius-tunnel-agent/1.0.0/nebius-tunnel-agent-windows-x86_64.tar.gz) * **Container image**: `cr.eu-north1.nebius.cloud/marketplace/docker/nebius-tunnel-agent:1.0.0`, also tagged `:latest`. * **Helm chart**: `oci://cr.eu-north1.nebius.cloud/marketplace/chart/nebius-tunnel-agent:1.0.0`, also tagged `:latest` (pull or install without `--version` to get the latest). ## AI services ### AI services in Nebius AI Cloud # AI services in Nebius AI Cloud Source: https://docs.nebius.com/ai-services/index.md Nebius AI Cloud offers AI services for containerized inference and training, experiment tracking, integrations with third-party software and orchestration with external tools. Different services can help you achieve different goals: * Use [Serverless AI](https://docs.nebius.com/serverless/overview.md) to run containerized AI workloads either as endpoints that return results immediately, or as background jobs that run in the background and stop when the task is complete. * Use [Managed Service for MLflow](https://docs.nebius.com/mlflow.md) to manage machine learning experiments by tracking runs, organizing models into versions, comparing metrics, and deploying customized models. * Use [Applications in Nebius AI Cloud](https://docs.nebius.com/applications.md) to work with third-party software and services that help streamline AI and ML workflows. * Use [third-party integrations](https://docs.nebius.com/3p-integrations.md) to run and orchestrate AI workloads in the Nebius AI Cloud infrastructure. > [card] [Getting started with endpoints in Serverless AI](https://docs.nebius.com/serverless/quickstart/endpoints.md) > > Deploy an interactive endpoint that listens for requests and returns results immediately > [card] [Getting started with jobs in Serverless AI](https://docs.nebius.com/serverless/quickstart/jobs.md) > > Run a non-interactive workload in the background and stop it automatically after completion > [card] [Getting started with MLflow](https://docs.nebius.com/mlflow/quickstart.md) > > Create your first MLflow cluster and run an experiment in it > [card] [Deploying applications](https://docs.nebius.com/applications/deploy.md) > > Browse the marketplace and choose an application to deploy > [card] [Running AI workloads on Managed Service for SkyPilot](https://docs.nebius.com/3p-integrations/skypilot.md) > > Run, manage, and scale AI workloads on VMs and Managed Kubernetes® clusters by using Managed SkyPilot > [card] [Third-party integrations: Run:ai](https://docs.nebius.com/3p-integrations/run-ai.md) > > Optimize your GPU resources for ML/AI workloads by using Run:ai and Managed Service for Kubernetes ## Tutorials and examples Follow our Serverless AI tutorials for step-by-step instructions on setting up specific AI workloads, or explore tutorials that combine multiple Nebius AI Cloud services to build complete solutions. > [card] [Deploying a large language model and chatting with it](https://docs.nebius.com/serverless/tutorials/deploy-model.md) > > Create your first Serverless AI endpoint with an open-source large language model and send a chat request > [card] [Fine-tuning a large language model](https://docs.nebius.com/serverless/tutorials/fine-tuning.md) > > Fine-tune a large language model by using a Serverless AI job with Axolotl > [card] [Speech synthesis](https://docs.nebius.com/serverless/tutorials/tts.md) > > Convert text to speech by creating a model, running a fine-tuning job and deploying an endpoint > [card] [Building solutions with AI services](https://docs.nebius.com/tutorials.md) > > Explore tutorials that show you how to combine Nebius AI Cloud services to build complete solutions > [card] [Serverless cookbook](https://github.com/nebius/serverless-ai-cookbook) > > Explore runnable examples of Serverless AI workloads on GitHub ### Serverless AI # Serverless AI Source: https://docs.nebius.com/serverless/index.md Serverless AI is a Nebius AI Cloud service for running containerized AI workloads as interactive Devlabs for coding, jobs that are executed to completion, or endpoints that serve the users. By deploying your workloads in Serverless AI, you can focus on them without worrying about the infrastructure: the service handles resource provisioning and lifecycle, and usage-based, per-second billing. The service is available in all Nebius AI Cloud [regions](https://docs.nebius.com/overview/regions.md) except for `eu-north2`. > [card] [About Serverless AI](https://docs.nebius.com/serverless/overview.md) > > Read about how Serverless AI works and how to choose between Devlabs, endpoints, and jobs > [card] [Getting started with Devlabs](https://docs.nebius.com/serverless/quickstart/devlabs.md) > > Deploy JupyterLab on your first Devlab and connect to it > [card] [Getting started with jobs](https://docs.nebius.com/serverless/quickstart/jobs.md) > > Create your first job that runs nvidia-smi and prints information about GPUs in use > [card] [Getting started with endpoints](https://docs.nebius.com/serverless/quickstart/endpoints.md) > > Launch a simple endpoint and send authenticated requests to it > [card] [Deploying an LLM](https://docs.nebius.com/serverless/tutorials/deploy-model.md) > > Deploy a large language model on an endpoint and chat with it > [card] [Fine-tuning an LLM](https://docs.nebius.com/serverless/tutorials/fine-tuning.md) > > Run a job that fine-tunes a large language model by using Axolotl > [card] [Monitoring](https://docs.nebius.com/serverless/monitoring.md) > > Track resource utilization to schedule quota increases and to quickly identify anomalies # About Serverless AI Source: https://docs.nebius.com/serverless/overview.md Serverless AI is a Nebius AI Cloud service for running containerized AI workloads without creating or managing virtual machines (VMs) or clusters. It supports the full AI/ML development workflow: build prototypes and run experiments in interactive Devlab environments, run training, fine-tuning and data processing workloads as jobs, and serve models and applications through endpoints. Provide a container image or select a template, and Serverless AI provisions the compute and storage resources required for each workload. Devlabs, endpoints, and jobs run on Compute virtual machines, with usage-based, per-second billing. The underlying VMs are managed by Serverless AI. You can connect to them via SSH, but they aren't shown as Compute resources and can't be managed or modified directly like other Compute VMs. ## Devlabs, endpoints, and jobs Serverless AI supports the end-to-end AI/ML workflow through three deployment types. Choose the deployment type that best fits what you want to do: * **Experiment and prototype**: Write code, explore models and data in a browser-based IDE or notebook → **Devlab**. * **Run a task to completion**: Train or fine-tune a model, preprocess data, run batch inference or evaluation → **Job**. * **Serve requests**: Host a model or application at a URL for real-time inference → **Endpoint**. Rather than providing three separate paths, these deployment types are designed for three stages that most projects move through. You can prototype in a Devlab, submit the working code as a job and then serve the result as an endpoint. Starting with one doesn't prevent you from using the others. The following table compares the three deployment types: | | **Devlab** | **Job** | **Endpoint** | | - | - | - | - | | **Use cases** | Coding and prototyping in a browser-based IDE or notebook | Preprocessing data, training and fine-tuning models, running batch inference, evaluating models, running scientific simulations | Serving and A/B-testing models, running real-time inference | | **Workflow** | Interactive development and prototyping; long-lived session that you start and stop | Non-interactive, terminates upon task completion or timeout | Interactive, responds to requests until you terminate it | | **Stop/start** | Yes | No | Yes | | **Public URL for requests** | Yes (web UI and declared ports) | No | Yes | | **Storage** | Data under the workspace path on the container disk persists across stop and restart | Data on the container disk is removed when the job finishes or is deleted | Data on the container disk is removed when you stop or delete the endpoint | | **Typical lifetime** | Minutes to days | Minutes to days | Hours to days | | **Guides** | [Getting started with Devlabs](https://docs.nebius.com/serverless/quickstart/devlabs.md) | [Getting started with jobs](https://docs.nebius.com/serverless/quickstart/jobs.md) | [Getting started with endpoints](https://docs.nebius.com/serverless/quickstart/endpoints.md) | ## Observability and debugging Each Serverless AI deployment (a Devlab, an endpoint, or a job) has a [status](https://docs.nebius.com/serverless/lifecycle.md) that indicates the current stage in the lifecycle. You can view its status and logs on the resource page under **Devlabs**, **Jobs**, or **Endpoints** in the web console. Deployments also report GPU and vCPU utilization metrics on the **Metrics** tab of this page. To investigate errors or unexpected outcomes, see [Debugging failed deployments](https://docs.nebius.com/serverless/jobs/failure.md). For metric definitions and details, see [Monitoring deployments](https://docs.nebius.com/serverless/monitoring.md). ## Pricing and quotas Serverless AI follows Compute billing and quota rules. Billing depends on whether the deployment is running or stopped: * While a Devlab, job or endpoint is running, you are billed for its computing resources and storage. * While a Devlab is stopped, you are billed for the entire container disk, but not for computing resources. * While an endpoint is stopped, you are not billed for computing resources or storage. Mounted [Object Storage buckets](https://docs.nebius.com/object-storage/overview.md#buckets) and [shared filesystems](https://docs.nebius.com/compute/storage/types.md#shared-filesystems) are billed separately, including when the deployment is stopped. For more details, see [Pricing and quotas](https://docs.nebius.com/serverless/pricing-quotas.md). *"Jupyter" and the Jupyter logos are trademarks or registered trademarks of LF Charities, used by Nebius B.V. with permission.* # Getting started with Serverless AI Devlabs: Deploy JupyterLab® Source: https://docs.nebius.com/serverless/quickstart/devlabs.md Serverless AI Devlabs provide an interactive environment for coding and prototyping, without the need to manage infrastructure. This quickstart shows how to create a Devlab from the JupyterLab® template and open it in your browser. ## Prerequisites > [tab] Web console > > * Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: Make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: Make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas-web-console). > [tab] CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > > ```bash > cat ~/.nebius/config.yaml > ``` > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: Make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: Make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: Make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: Make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: Make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: Make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: Make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: Make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). ## Steps ### Create a Devlab > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Devlabs**. > 2. Click  **Create Devlab**, choose **Template**, and select **JupyterLab**. > 3. Review the prefilled Devlab settings. The console generates the Jupyter token automatically. Copy and save the token securely. > 4. Click **Create Devlab**. > [tab] CLI > > 1. Create a random Jupyter token of exactly 16 alphanumeric characters. For example: > > ```bash > export JUPYTER_TOKEN=$(openssl rand -hex 8) > ``` > > 2. Create a Devlab from the JupyterLab template: > > ```bash > nebius ai devlab create \ > --name my-jupyter \ > --template jupyter \ > --input jupyter_token=$JUPYTER_TOKEN > ``` > > The command uses the following parameters: > > * `--name`: Devlab name. > * `--template`: Template to use. In this quickstart, use `jupyter` for the JupyterLab template. > * `--input jupyter_token=`: Jupyter token that you provide. The token must consist of 16 alphanumeric characters. > > `--platform`, `--preset` and `--disk-size` are optional. If you omit them, the CLI selects the default GPU platform, the smallest suitable preset and a 250 GiB disk. > [tab] Go SDK > > 1. Generate a random Jupyter token of exactly 16 alphanumeric characters: > > ```go > tokenBytes := make([]byte, 8) > if _, err := rand.Read(tokenBytes); err != nil { > return fmt.Errorf("generate Jupyter token: %w", err) > } > jupyterToken = hex.EncodeToString(tokenBytes) > ``` > > Save the value of `jupyterToken` securely. You need the token to sign in to JupyterLab. > > 2. Create a Devlab from the JupyterLab template: > > ```go > createSpec := &ai.DevlabSpec{ > Template: &ai.DevlabSpec_Template{ > Id: "vmapptemplate-g00devlab-jupyter", > InputFieldValues: map[string]*structpb.Value{ > "jupyter_token": structpb.NewStringValue( > "", > ), > }, > }, > Platform: "", > Preset: "", > Disk: &ai.DevlabSpec_DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > SizeBytes: 268435456000, > }, > Workspace: &ai.DevlabSpec_Workspace{}, > } > createService := sdk.Services().Ai().V1().Devlab() > createOperation, err := createService.Create( > ctx, > &ai.CreateDevlabRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "my-jupyter", > }, > Spec: createSpec, > }, > ) > if err != nil { > return fmt.Errorf("create devlab: %w", err) > } > if _, err = createOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for devlab creation: %w", err) > } > ``` > > In the request, set: > > * `Metadata.ParentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#go-sdk-3). > * `Spec.Template.InputFieldValues["jupyter_token"]`: Token that you generated in the previous step. > * `Spec.Platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). Choose a platform supported by the JupyterLab template. > * `Spec.Preset`: Number of GPUs, vCPUs, and RAM allocated to the Devlab. Choose a preset available on the selected platform. > * `Spec.Disk.SizeBytes`: Disk size in bytes. The sample uses `268435456000` (250 GiB). > [tab] Python SDK > > 1. Generate a random Jupyter token of exactly 16 alphanumeric characters: > > ```python > jupyter_token = secrets.token_hex(8) > ``` > > Save the value of `jupyter_token` securely. You need the token to sign in to JupyterLab. > > 2. Create a Devlab from the JupyterLab template: > > ```python > create_spec = DevlabSpec( > template=DevlabSpec__Template( > id="vmapptemplate-g00devlab-jupyter", > input_field_values={ > "jupyter_token": Value( > string_value="", > ), > }, > ), > platform="", > preset="", > disk=DevlabSpec__DiskSpec( > type=DiskSpec__DiskType.NETWORK_SSD, > size_bytes=268435456000, > ), > workspace=DevlabSpec__Workspace(), > ) > create_service = DevlabServiceClient(sdk) > create_operation = await create_service.create( > CreateDevlabRequest( > metadata=ResourceMetadata( > parent_id="", > name="my-jupyter", > ), > spec=create_spec, > ), > ) > await create_operation.wait() > ``` > > In the request, set: > > * `metadata.parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#python-sdk-3). > * `spec.template.input_field_values["jupyter_token"]`: Token that you generated in the previous step. > * `spec.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). Choose a platform supported by the JupyterLab template. > * `spec.preset`: Number of GPUs, vCPUs, and RAM allocated to the Devlab. Choose a preset available on the selected platform. > * `spec.disk.size_bytes`: Disk size in bytes. The sample uses `268435456000` (250 GiB). > [tab] JavaScript SDK > > 1. Generate a random Jupyter token of exactly 16 alphanumeric characters: > > ```ts > jupyterToken = randomBytes(8).toString("hex"); > ``` > > Save the value of `jupyterToken` securely. You need the token to sign in to JupyterLab. > > 2. Create a Devlab from the JupyterLab template: > > ```ts > const createSpec = DevlabSpec.create({ > template: { > id: "vmapptemplate-g00devlab-jupyter", > inputFieldValues: { > jupyter_token: "", > }, > }, > platform: "", > preset: "", > disk: { > type: DiskSpec_DiskType.NETWORK_SSD, > sizeBytes: 268435456000, > }, > workspace: {}, > }); > const createService = new DevlabService(sdk); > const createOperation = await createService.create( > CreateDevlabRequest.create({ > metadata: { > parentId: "", > name: "my-jupyter", > }, > spec: createSpec, > }), > ).result; > await createOperation.wait(); > ``` > > In the request, set: > > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#javascript-sdk-3). > * `spec.template.inputFieldValues.jupyter_token`: Token that you generated in the previous step. > * `spec.platform`: [VM platform](https://docs.nebius.com/compute/virtual-machines/types.md). Choose a platform supported by the JupyterLab template. > * `spec.preset`: Number of GPUs, vCPUs, and RAM allocated to the Devlab. Choose a preset available on the selected platform. > * `spec.disk.sizeBytes`: Disk size in bytes. The sample uses `268435456000` (250 GiB). Wait for the Devlab to start running. ### Open JupyterLab When the Devlab is running, open its managed HTTPS URL in a browser. A public IP address isn't required. > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Devlabs**. > 2. Open the page of the required Devlab. > 3. Wait until the Devlab is running. Then, in the **Network** section, copy the public Devlab address from the **Public Devlabs** field. > 4. In a browser, open the URL and enter the Jupyter token in the JupyterLab password field. Use the token that the console generated when you created the Devlab. > [tab] CLI > > 1. List Devlabs and find the Devlab that you created (`my-jupyter`): > > ```bash > nebius ai devlab list > ``` > > 2. Save the Devlab ID to an environment variable: > > ```bash > export DEVLAB_ID=$(nebius ai devlab get-by-name \ > --name my-jupyter \ > --format jsonpath='{.metadata.id}') > ``` > > 3. Get the Devlab details and copy the HTTPS URL from the output: > > ```bash > nebius ai devlab get "$DEVLAB_ID" > ``` > > 4. In a browser, open the HTTPS URL and enter the Jupyter token in the JupyterLab password field. Use the `$JUPYTER_TOKEN` value that you set at create time. > [tab] Go SDK > > 1. List Devlabs and find the Devlab that you created (`my-jupyter`): > > ```go > listDevlabService := sdk.Services().Ai().V1().Devlab() > listDevlabsRequest := &ai.ListDevlabsRequest{ > ParentId: "", > } > for { > devlabs, err := listDevlabService.List( > ctx, listDevlabsRequest, > ) > if err != nil { > return fmt.Errorf("list devlabs: %w", err) > } > fmt.Println(devlabs) > if devlabs.GetNextPageToken() == "" { > break > } > listDevlabsRequest.PageToken = devlabs.GetNextPageToken() > } > ``` > > In `ai.ListDevlabsRequest`, set `ParentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#go-sdk-3). In the response, copy the `Metadata.Id` of `my-jupyter`. > > 2. Get the Devlab details: > > ```go > getDevlabService := sdk.Services().Ai().V1().Devlab() > devlab, err := getDevlabService.Get( > ctx, > &ai.GetDevlabRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("get devlab: %w", err) > } > fmt.Println(devlab) > ``` > > In `ai.GetDevlabRequest`, set `Id` to the Devlab ID that you copied. Copy the HTTPS URL from `Status.PublicEndpoints` in the response. > > 3. In a browser, open the HTTPS URL and enter the token saved in `jupyterToken` in the JupyterLab password field. > [tab] Python SDK > > 1. List Devlabs and find the Devlab that you created (`my-jupyter`): > > ```python > list_devlab_service = DevlabServiceClient(sdk) > list_devlabs_request = ListDevlabsRequest( > parent_id="", > ) > while True: > devlabs = await list_devlab_service.list( > list_devlabs_request, > ) > print(devlabs) > if not devlabs.next_page_token: > break > list_devlabs_request.page_token = devlabs.next_page_token > ``` > > In `ListDevlabsRequest`, set `parent_id` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#python-sdk-3). In the response, copy the `metadata.id` of `my-jupyter`. > > 2. Get the Devlab details: > > ```python > get_devlab_service = DevlabServiceClient(sdk) > devlab = await get_devlab_service.get( > GetDevlabRequest(id=""), > ) > print(devlab) > ``` > > In `GetDevlabRequest`, set `id` to the Devlab ID that you copied. Copy the HTTPS URL from `status.public_endpoints` in the response. > > 3. In a browser, open the HTTPS URL and enter the token saved in `jupyter_token` in the JupyterLab password field. > [tab] JavaScript SDK > > 1. List Devlabs and find the Devlab that you created (`my-jupyter`): > > ```ts > const listDevlabService = new DevlabService(sdk); > const listDevlabsRequest = ListDevlabsRequest.create({ > parentId: "", > }); > while (true) { > const devlabs = await listDevlabService.list( > listDevlabsRequest, > ); > console.log(devlabs); > if (!devlabs.nextPageToken) { > break; > } > listDevlabsRequest.pageToken = devlabs.nextPageToken; > } > ``` > > In `ListDevlabsRequest`, set `parentId` to the [project ID](https://docs.nebius.com/iam/manage-projects.md#javascript-sdk-3). In the response, copy the `metadata.id` of `my-jupyter`. > > 2. Get the Devlab details: > > ```ts > const getDevlabService = new DevlabService(sdk); > const devlab = await getDevlabService.get( > GetDevlabRequest.create({ id: "" }), > ); > console.log(devlab); > ``` > > In `GetDevlabRequest`, set `id` to the Devlab ID that you copied. Copy the HTTPS URL from `status.publicEndpoints` in the response. > > 3. In a browser, open the HTTPS URL and enter the token saved in `jupyterToken` in the JupyterLab password field. ### View logs > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Devlabs**. > 2. In the Devlab list, next to the Devlab, click **View logs**. Alternatively, click  → **View logs**. > [tab] CLI > > View Devlab logs: > > ```bash > nebius ai devlab logs "$DEVLAB_ID" --follow > ``` ## Expected results * The JupyterLab Devlab reaches the **Running** status. * You can open JupyterLab from the managed HTTPS URL and sign in with the Jupyter token in the password field. * You can view Devlab logs. ## Delete the Devlab If you no longer need the Devlab, delete it. Once you delete the Devlab, you will not be charged for its computing resources or container disk. > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Devlabs**. > 2. In the Devlab list, find the Devlab and click  → **Delete**. > 3. Confirm the Devlab deletion. > [tab] CLI > > ```bash > nebius ai devlab delete "$DEVLAB_ID" > ``` > [tab] Go SDK > > ```go > deleteDevlabService := sdk.Services().Ai().V1().Devlab() > deleteDevlabOperation, err := deleteDevlabService.Delete( > ctx, > &ai.DeleteDevlabRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("delete devlab: %w", err) > } > if _, err = deleteDevlabOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for devlab delete: %w", err) > } > ``` > > In `ai.DeleteDevlabRequest`, set `Id` to the Devlab ID that you copied when you opened JupyterLab. The sample waits for deletion to complete. > [tab] Python SDK > > ```python > delete_devlab_service = DevlabServiceClient(sdk) > delete_devlab_operation = await delete_devlab_service.delete( > DeleteDevlabRequest(id=""), > ) > await delete_devlab_operation.wait() > ``` > > In `DeleteDevlabRequest`, set `id` to the Devlab ID that you copied when you opened JupyterLab. The sample waits for deletion to complete. > [tab] JavaScript SDK > > ```ts > const deleteDevlabService = new DevlabService(sdk); > const deleteDevlabOperation = await deleteDevlabService.delete( > DeleteDevlabRequest.create({ id: "" }), > ).result; > await deleteDevlabOperation.wait(); > ``` > > In `DeleteDevlabRequest`, set `id` to the Devlab ID that you copied when you opened JupyterLab. The sample waits for deletion to complete. ## See also * [Managing Devlabs in Serverless AI](https://docs.nebius.com/serverless/devlabs/manage.md) * [About Serverless AI](https://docs.nebius.com/serverless/overview.md) *"Jupyter" and the Jupyter logos are trademarks or registered trademarks of LF Charities, used by Nebius B.V. with permission.* # Getting started with Serverless AI jobs: Run nvidia-smi within a job Source: https://docs.nebius.com/serverless/quickstart/jobs.md You can use Serverless AI jobs to work with AI models and perform such operations as fine-tuning, scientific simulations, data processing, or batch inference. To get started with jobs, use the example below. It demonstrates how to run `nvidia-smi` in a Serverless AI job. As a result, you receive information about the GPUs of the virtual machine (VM) in which the job is running. In the web console, the **nvidia-smi** quick-start configuration runs the same kind of workload with settings already filled in. ## Prerequisites > [tab] Web console > > * Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the **Number of virtual machines** (VMs) quota under **Compute**: it should have at least one VM available. If necessary, [increase the quota](https://docs.nebius.com/overview/quotas.md#change-quotas-web-console). > [tab] CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > > ```bash > cat ~/.nebius/config.yaml > ``` > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the **Number of virtual machines** (VMs) quota under **Compute**: it should have at least one VM available. If necessary, [increase the quota](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the **Number of virtual machines** (VMs) quota under **Compute**: it should have at least one VM available. If necessary, [increase the quota](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the **Number of virtual machines** (VMs) quota under **Compute**: it should have at least one VM available. If necessary, [increase the quota](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the **Number of virtual machines** (VMs) quota under **Compute**: it should have at least one VM available. If necessary, [increase the quota](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] REST API > > * Get an access token to [authenticate to the REST API](https://docs.nebius.com/rest-api/authentication.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the **Number of virtual machines** (VMs) quota under **Compute**: it should have at least one VM available. If necessary, [increase the quota](https://docs.nebius.com/overview/quotas.md#change-quotas). ## Steps ### Run a Serverless AI job > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Jobs**. > 2. Select the **nvidia-smi** quick start card. > The quick start configuration uses a verified container image and prefilled job settings. > 3. Click **Create job**. > [tab] CLI > > Use `nebius ai create` to create a job step by step in the terminal. The command prompts you to enter values to pass as parameters, shows the resulting configuration and then creates the job. > > 1. Run the following command: > > ```bash > nebius ai job create \ > --name my-job \ > --image nvidia/cuda:13.1.1-runtime-ubuntu24.04 \ > --container-command bash \ > --args "-c nvidia-smi" \ > --platform gpu-l40s-a \ > --preset 1gpu-8vcpu-32gb \ > --timeout 1h \ > --subnet-id > ``` > > Alternatively, you can run `nebius ai create` and specify each value step by step with CLI prompts. The command pre-fills the following values: > > * `--name`: Job name. > * `--image`: Container image to run. In the given example, the [nvidia/cuda:13.1.1-runtime-ubuntu24.04](https://hub.docker.com/layers/nvidia/cuda/13.1.1-runtime-ubuntu24.04/images/sha256-7ced05425d3bdea47c018551ee001f28081dd409efe1283872cd968ad3c1e957) image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs. > * `--container-command`: Terminal shell for commands to run. > * `--args`: Arguments for `docker run` to pass to the entrypoint command. The specified arguments require the container to run `nvidia-smi`. > * `--platform`: VM platform for the job. Every job uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `--preset`: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `--timeout`: Duration after which the job is canceled if it has not completed. > * `--subnet-id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli). > 2. When the CLI prompts you to select a project, region or subnet, select from the values that are available. > 3. Review the resulting configuration, then confirm creation. > [tab] Go SDK > > Run the following code: > > ```go > createJobService := sdk.Services().Ai().V1().Job() > createJobOperation, err := createJobService.Create( > ctx, > &ai.CreateJobRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "my-job", > }, > Spec: &ai.JobSpec{ > Image: "nvidia/cuda:13.1.1-runtime-ubuntu24.04", > ContainerCommand: "bash", > Args: "-c nvidia-smi", > Timeout: durationpb.New(time.Hour), > Platform: "gpu-l40s-a", > Preset: "1gpu-8vcpu-32gb", > SubnetId: "", > ShmSizeBytes: 17179869184, > Disk: &ai.JobSpec_DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > SizeBytes: 268435456000, > }, > }, > }, > ) > if err != nil { > return fmt.Errorf("create job: %w", err) > } > if _, err = createJobOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for job creation: %w", err) > } > ``` > > In the code, set the following parameters: > > * `Metadata.ParentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). > * `Metadata.Name`: Job name. > * `Spec.Image`: Container image to run. In the given example, the [nvidia/cuda:13.1.1-runtime-ubuntu24.04](https://hub.docker.com/layers/nvidia/cuda/13.1.1-runtime-ubuntu24.04/images/sha256-7ced05425d3bdea47c018551ee001f28081dd409efe1283872cd968ad3c1e957) image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs. > * `Spec.ContainerCommand`: Terminal shell for commands to run. > * `Spec.Args`: Arguments for `docker run` to pass to the entrypoint command. The specified arguments require the container to run `nvidia-smi`. > * `Spec.Timeout`: Duration after which the job is canceled if it has not completed, as a Go duration such as `durationpb.New(time.Hour)`. > * `Spec.Platform`: VM platform for the job. Every job uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `Spec.Preset`: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `Spec.SubnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk). > * `Spec.Disk.Type`: Disk type for the underlying VM. > * `Spec.Disk.SizeBytes`: Disk size in bytes. The example sets 250 GiB. > > After `Wait` completes, `createJobOperation.ResourceID()` returns the created job's ID. Save this value because you need it in later steps. > [tab] Python SDK > > Run the following code: > > ```python > create_job_service = JobServiceClient(sdk) > create_job_operation = await create_job_service.create( > CreateJobRequest( > metadata=ResourceMetadata( > parent_id="", > name="my-job", > ), > spec=JobSpec( > image=( > "nvidia/cuda:13.1.1-runtime-ubuntu24.04" > ), > container_command="bash", > args="-c nvidia-smi", > timeout=timedelta(hours=1), > platform="gpu-l40s-a", > preset="1gpu-8vcpu-32gb", > subnet_id="", > shm_size_bytes=17179869184, > disk=JobSpec__DiskSpec( > type=DiskSpec__DiskType.NETWORK_SSD, > size_bytes=268435456000, > ), > ), > ), > ) > await create_job_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). > * `metadata.name`: Job name. > * `spec.image`: Container image to run. In the given example, the [nvidia/cuda:13.1.1-runtime-ubuntu24.04](https://hub.docker.com/layers/nvidia/cuda/13.1.1-runtime-ubuntu24.04/images/sha256-7ced05425d3bdea47c018551ee001f28081dd409efe1283872cd968ad3c1e957) image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs. > * `spec.container_command`: Terminal shell for commands to run. > * `spec.args`: Arguments for `docker run` to pass to the entrypoint command. The specified arguments require the container to run `nvidia-smi`. > * `spec.timeout`: Duration after which the job is canceled if it has not completed, as a Python `timedelta` such as `timedelta(hours=1)`. > * `spec.platform`: VM platform for the job. Every job uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.preset`: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `spec.subnet_id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk). > * `spec.disk.type`: Disk type for the underlying VM. > * `spec.disk.size_bytes`: Disk size in bytes. The example sets 250 GiB. > > After `await create_job_operation.wait()` completes, `create_job_operation.resource_id` returns the created job's ID. Save this value because you need it in later steps. > [tab] JavaScript SDK > > Run the following code: > > ```ts > dayjs.extend(duration); > const jobTimeout = dayjs.duration(1, "hour"); > const createJobService = new JobService(sdk); > const createJobOperation = await createJobService.create( > CreateJobRequest.create({ > metadata: { > parentId: "", > name: "my-job", > }, > spec: { > image: "nvidia/cuda:13.1.1-runtime-ubuntu24.04", > containerCommand: "bash", > args: "-c nvidia-smi", > timeout: jobTimeout, > platform: "gpu-l40s-a", > preset: "1gpu-8vcpu-32gb", > subnetId: "", > shmSizeBytes: 17179869184n, > disk: { > type: DiskSpec_DiskType.NETWORK_SSD, > sizeBytes: 268435456000n, > }, > }, > }), > ).result; > await createJobOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). > * `metadata.name`: Job name. > * `spec.image`: Container image to run. In the given example, the [nvidia/cuda:13.1.1-runtime-ubuntu24.04](https://hub.docker.com/layers/nvidia/cuda/13.1.1-runtime-ubuntu24.04/images/sha256-7ced05425d3bdea47c018551ee001f28081dd409efe1283872cd968ad3c1e957) image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs. > * `spec.containerCommand`: Terminal shell for commands to run. > * `spec.args`: Arguments for `docker run` to pass to the entrypoint command. The specified arguments require the container to run `nvidia-smi`. > * `spec.timeout`: Duration after which the job is canceled if it has not completed, as a `dayjs.Duration` such as `dayjs.duration(1, "hour")`. > * `spec.platform`: VM platform for the job. Every job uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.preset`: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `spec.subnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk). > * `spec.disk.type`: Disk type for the underlying VM. > * `spec.disk.sizeBytes`: Disk size in bytes, as a `bigint`. The example sets 250 GiB. > > After `await createJobOperation.wait()` completes, `createJobOperation.resourceId()` returns the created job's ID. Save this value because you need it in later steps. > [tab] REST API > > Send the following request: > > ```bash > curl --request POST \ > --url 'https://api.nebius.cloud/ai/v1/jobs' \ > --header "Authorization: Bearer " \ > --header 'Content-Type: application/json' \ > --data '{ > "metadata": { > "parentId": "", > "name": "my-job" > }, > "spec": { > "image": "nvidia/cuda:13.1.1-runtime-ubuntu24.04", > "containerCommand": "bash", > "args": "-c nvidia-smi", > "platform": "gpu-l40s-a", > "preset": "1gpu-8vcpu-32gb", > "timeout": "3600s", > "subnetId": "", > "disk": { > "type": "NETWORK_SSD", > "sizeBytes": 268435456000 > } > } > }' > > ``` > > In the `Authorization` header, replace `` with the access token that you got in the prerequisites. > > The request includes the following parameters: > > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id). > * `metadata.name`: Job name. > * `spec.image`: Container image to run. In the given example, the [nvidia/cuda:13.1.1-runtime-ubuntu24.04](https://hub.docker.com/layers/nvidia/cuda/13.1.1-runtime-ubuntu24.04/images/sha256-7ced05425d3bdea47c018551ee001f28081dd409efe1283872cd968ad3c1e957) image is used. It contains the Ubuntu 24.04 operating system as well as drivers and other components for GPUs. > * `spec.containerCommand`: Terminal shell for commands to run. > * `spec.args`: Arguments for `docker run` to pass to the entrypoint command. The specified arguments require the container to run `nvidia-smi`. > * `spec.platform`: VM platform for the job. Every job uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.preset`: Number of GPUs, vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `spec.timeout`: Duration after which the job is canceled if it has not completed. > * `spec.subnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). > * `spec.disk.type`: Disk type for the underlying VM. > * `spec.disk.sizeBytes`: Disk size in bytes. The specified value is 250 GiB. > > The response returns the job ID in the `resourceId` parameter. Save this value because you need it in later steps. The job takes several minutes to complete. While the job is running, you can check its status and logs. ### Check the job status and results > [!NOTE] > > Checking job logs is available only in the web console and CLI. > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Jobs**. > 2. Next to the job, click **View logs**. Alternatively, select the job that you want to view the logs for and switch to the **Logs** tab. > [tab] CLI > > 1. Save the job ID to an environment variable: > ```bash > export JOB_ID=$(nebius ai job get-by-name --name my-job \ > --format jsonpath='{.metadata.id}') > ``` > 2. View information about the job: > ```bash > nebius ai job get $JOB_ID > ``` > The command output contains such data as the job status, start and finish times. > 3. If the output doesn't indicate that the job has started, wait a few seconds. Next, run the previous command again and check that the job is running now. > 4. When the job has started, check its logs: > ```bash > nebius ai job logs $JOB_ID > ``` > The logs contain information about the GPUs that `nvidia-smi` provides (in other words, the output of the `nvidia-smi` command). > > You can run `nebius ai job get $JOB_ID` and `nebius ai job logs $JOB_ID` multiple times to determine whether the job is complete, and the full output of `nvidia-smi` is returned in logs. > [tab] Go SDK > > Get the job and check the `status.state` value in the printed result: > > ```go > getJobService := sdk.Services().Ai().V1().Job() > job, err := getJobService.Get( > ctx, > &ai.GetJobRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("get job: %w", err) > } > fmt.Println(job) > ``` > > In `ai.GetJobRequest`, set `Id` to the job ID that you saved when you created the job. > > If the state doesn't indicate that the job has started, wait a few seconds and run the code again. You can repeat the request until the job reaches the `COMPLETED` state. > [tab] Python SDK > > Get the job and check the `status.state` value in the response: > > ```python > get_job_service = JobServiceClient(sdk) > job = await get_job_service.get( > GetJobRequest(id=""), > ) > print(job) > ``` > > In `GetJobRequest`, set `id` to the job ID that you saved when you created the job. > > If the state doesn't indicate that the job has started, wait a few seconds and run the code again. You can repeat the request until the job reaches the `COMPLETED` state. > [tab] JavaScript SDK > > Get the job and check the `status?.state` value in the response: > > ```ts > const getJobService = new JobService(sdk); > const job = await getJobService.get( > GetJobRequest.create({ id: "" }), > ); > console.log(job); > ``` > > In `GetJobRequest`, set `id` to the job ID that you saved when you created the job. > > If the state doesn't indicate that the job has started, wait a few seconds and run the code again. You can repeat the request until the job reaches the `COMPLETED` state. > [tab] REST API > > Get the job and check the `status.state` parameter in the response: > > ```bash > curl --request GET \ > --url "https://api.nebius.cloud/ai/v1/jobs/" \ > --header "Authorization: Bearer " > ``` > > In the request, specify: > > * Your access token in the `Authorization` header. > * In the request path, the job ID returned in the `resourceId` parameter when you created the job. > > If the state doesn't indicate that the job has started, wait a few seconds and send the request again. You can repeat the request until the job reaches the `COMPLETED` state. ### (Optional) Delete the job When the job is complete, Serverless AI automatically releases all allocated computing resources and the container disk of the job. When you delete a completed job, you remove it from the list of Serverless AI jobs. If you delete a running job, all the resources are released as well. > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Jobs**. > 2. Find the job and then click  → **Delete**. > 3. In the window that opens, confirm deleting the job. > [tab] CLI > > To delete the job, run the following command: > > ```bash > nebius ai job delete $JOB_ID > ``` > [tab] Go SDK > > To delete the job, run the following code: > > ```go > deleteJobService := sdk.Services().Ai().V1().Job() > deleteJobOperation, err := deleteJobService.Delete( > ctx, > &ai.DeleteJobRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("delete job: %w", err) > } > if _, err = deleteJobOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for job deletion: %w", err) > } > ``` > > In `ai.DeleteJobRequest`, set `Id` to the job ID that you saved when you created the job. > [tab] Python SDK > > To delete the job, run the following code: > > ```python > delete_job_service = JobServiceClient(sdk) > delete_job_operation = await delete_job_service.delete( > DeleteJobRequest(id=""), > ) > await delete_job_operation.wait() > ``` > > In `DeleteJobRequest`, set `id` to the job ID that you saved when you created the job. > [tab] JavaScript SDK > > To delete the job, run the following code: > > ```ts > const deleteJobService = new JobService(sdk); > const deleteJobOperation = await deleteJobService.delete( > DeleteJobRequest.create({ id: "" }), > ).result; > await deleteJobOperation.wait(); > ``` > > In `DeleteJobRequest`, set `id` to the job ID that you saved when you created the job. > [tab] REST API > > To delete the job, send the following request: > > ```bash > curl --request DELETE \ > --url "https://api.nebius.cloud/ai/v1/jobs/" \ > --header "Authorization: Bearer " > ``` > > In the request, specify: > > * Your access token in the `Authorization` header. > * In the request path, the job ID returned in the `resourceId` parameter when you created the job. # Getting started with Serverless AI endpoints: Deploy an nginx server with authentication Source: https://docs.nebius.com/serverless/quickstart/endpoints.md Serverless AI lets you deploy and manage endpoints without handling infrastructure yourself. This quickstart shows how to validate basic endpoint functionality with minimal setup. In the web console, the **nginx** quick-start configuration deploys a ready-made example with preconfigured settings. ## Prerequisites > [tab] Web console > > * Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas-web-console). > [tab] CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > > ```bash > cat ~/.nebius/config.yaml > ``` > > * Install [jq](https://jqlang.org/) to parse JSON output: > > ```bash Ubuntu > sudo apt-get install jq > ``` > > ```bash macOS > brew install jq > ``` > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). > [tab] REST API > > * Get an access token to [authenticate to the REST API](https://docs.nebius.com/rest-api/authentication.md). > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas: > > * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available. > * **Allocations** under **Virtual Networks**: make sure that at least one allocation is available. > > If necessary, [increase the quotas](https://docs.nebius.com/overview/quotas.md#change-quotas). ## Steps ### Create an endpoint > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Endpoints**. > 2. Select the **nginx** quick start card. > The quick start configuration autofills the container image, entrypoint command, and default settings. > 3. Click **Create endpoint**. > > Wait for the endpoint to start running. > [tab] CLI > > Use `nebius ai create` to create a endpoint step by step in the terminal. The command prompts you to enter values to pass as parameters, shows the resulting configuration and then creates the endpoint. > > 1. Create a token for authorization and save it to an environment variable: > > ```bash > export AUTH_TOKEN=$(openssl rand -hex 32) > ``` > > Use this token in the `--token` parameter when you create the endpoint. You will also need it later to test access to the endpoint. > > 2. Run the following command: > > ```bash > nebius ai endpoint create \ > --name qs-endpoint-nginx \ > --image nginx:alpine \ > --platform cpu-d3 \ > --preset 4vcpu-16gb \ > --public \ > --container-port 80 \ > --auth token \ > --token "$AUTH_TOKEN" \ > --subnet-id > ``` > > Alternatively, you can run `nebius ai create` and specify each value step by step with CLI prompts. The command pre-fills the following values: > > * `--name`: Endpoint name. > * `--image`: Container image to run. In the given example, the `nginx:alpine` image is used. > * `--platform`: VM platform for the endpoint. Every endpoint uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `--preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `--container-port`: Port on which the application listens in the container. Each HTTP port is available through the managed HTTPS URL of the endpoint. > * `--auth`: Authentication method for the endpoint. > * `--token`: Token used for endpoint authentication. > * `--public` (optional): Assigns a public IP address to the endpoint. Not required to reach the endpoint from the internet, because each HTTP port is available through the endpoint's managed HTTPS URL. > * `--subnet-id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-cli). > > 3. When the CLI prompts you to select a project, region or subnet, select from the values that are available. > > 4. Review the resulting configuration, then confirm creation. > > Wait for the endpoint to start running. > [tab] Go SDK > > 1. Generate a token for endpoint authentication and store it in an `authToken` variable, for example, with `crypto/rand`: > > ```go > tokenBytes := make([]byte, 32) > if _, err := rand.Read(tokenBytes); err != nil { > return fmt.Errorf("generate endpoint token: %w", err) > } > authToken := hex.EncodeToString(tokenBytes) > ``` > > Use this token in `Spec.AuthToken` when you create the endpoint. You will also need it later to test access to the endpoint. > > 2. Create an endpoint: > > ```go > createEndpointService := sdk.Services().Ai().V1().Endpoint() > createEndpointOperation, err := createEndpointService.Create( > ctx, > &ai.CreateEndpointRequest{ > Metadata: &common.ResourceMetadata{ > ParentId: "", > Name: "qs-endpoint-nginx", > }, > Spec: &ai.EndpointSpec{ > Image: "nginx:alpine", > Platform: "cpu-d3", > Preset: "4vcpu-16gb", > Ports: []*ai.EndpointSpec_Port{ > { > ContainerPort: 80, > Protocol: ai.EndpointSpec_Port_HTTP, > }, > }, > AuthToken: authToken, > PublicIp: true, > SubnetId: "", > Disk: &ai.EndpointSpec_DiskSpec{ > Type: compute.DiskSpec_NETWORK_SSD, > SizeBytes: 268435456000, > }, > }, > }, > ) > if err != nil { > return fmt.Errorf("create endpoint: %w", err) > } > if _, err = createEndpointOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for endpoint creation: %w", err) > } > ``` > > In the code, set the following parameters: > > * `Metadata.ParentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-go-sdk). > * `Metadata.Name`: Endpoint name. > * `Spec.Image`: Container image to run. In the given example, the `nginx:alpine` image is used. > * `Spec.Platform`: VM platform for the endpoint. Every endpoint uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `Spec.Preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `Spec.Ports[].ContainerPort`: Port on which the application listens in the container. Each HTTP port is available through the endpoint's managed HTTPS URL. > * `Spec.Ports[].Protocol`: Protocol used by the exposed port. > * `Spec.AuthToken`: Token used for endpoint authentication, generated in the previous step. > * `Spec.PublicIp` (optional): Whether to assign a public IP address to the endpoint. Not required to reach the endpoint from the internet, because each HTTP port is available through the endpoint's managed HTTPS URL. > * `Spec.SubnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-go-sdk). > * `Spec.Disk.Type`: Disk type for the underlying VM. > * `Spec.Disk.SizeBytes`: Disk size in bytes. The example sets 250 GiB. > > After `Wait` completes, `createEndpointOperation.ResourceID()` returns the created endpoint's ID. Save this value because you need it in later steps. > > Wait for the endpoint to start running. > [tab] Python SDK > > 1. Generate a token for endpoint authentication and store it in an `auth_token` variable, for example, with `secrets`: > > ```python > import secrets > > auth_token = secrets.token_hex(32) > ``` > > Use this token in `spec.auth_token` when you create the endpoint. You will also need it later to test access to the endpoint. > > 2. Create an endpoint: > > ```python > create_endpoint_service = EndpointServiceClient(sdk) > create_endpoint_operation = await create_endpoint_service.create( > CreateEndpointRequest( > metadata=ResourceMetadata( > parent_id="", > name="qs-endpoint-nginx", > ), > spec=EndpointSpec( > image="nginx:alpine", > platform="cpu-d3", > preset="4vcpu-16gb", > ports=[ > EndpointSpec__Port( > container_port=80, > protocol=( > EndpointSpec__Port__Protocol.HTTP > ), > ), > ], > auth_token=auth_token, > public_ip=True, > subnet_id="", > disk=EndpointSpec__DiskSpec( > type=DiskSpec__DiskType.NETWORK_SSD, > size_bytes=268435456000, > ), > ), > ), > ) > await create_endpoint_operation.wait() > ``` > > In the code, set the following parameters: > > * `metadata.parent_id`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-python-sdk). > * `metadata.name`: Endpoint name. > * `spec.image`: Container image to run. In the given example, the `nginx:alpine` image is used. > * `spec.platform`: VM platform for the endpoint. Every endpoint uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `spec.ports[].container_port`: Port on which the application listens in the container. Each HTTP port is available through the endpoint's managed HTTPS URL. > * `spec.ports[].protocol`: Protocol used by the exposed port. > * `spec.auth_token`: Token used for endpoint authentication, generated in the previous step. > * `spec.public_ip` (optional): Whether to assign a public IP address to the endpoint. Not required to reach the endpoint from the internet, because each HTTP port is available through the endpoint's managed HTTPS URL. > * `spec.subnet_id`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-python-sdk). > * `spec.disk.type`: Disk type for the underlying VM. > * `spec.disk.size_bytes`: Disk size in bytes. The example sets 250 GiB. > > After `await create_endpoint_operation.wait()` completes, `create_endpoint_operation.resource_id` returns the created endpoint's ID. Save this value because you need it in later steps. > > Wait for the endpoint to start running. > [tab] JavaScript SDK > > 1. Generate a token for endpoint authentication and store it in an `authToken` variable, for example, with `node:crypto`: > > ```ts > import { randomBytes } from "node:crypto"; > > const authToken = randomBytes(32).toString("hex"); > ``` > > Use this token in `spec.authToken` when you create the endpoint. You will also need it later to test access to the endpoint. > > 2. Create an endpoint: > > ```ts > const createEndpointService = new EndpointService(sdk); > const createEndpointOperation = await createEndpointService.create( > CreateEndpointRequest.create({ > metadata: { > parentId: "", > name: "qs-endpoint-nginx", > }, > spec: { > image: "nginx:alpine", > platform: "cpu-d3", > preset: "4vcpu-16gb", > ports: [{ > containerPort: 80, > protocol: EndpointSpec_Port_Protocol.HTTP, > }], > authToken, > publicIp: true, > subnetId: "", > disk: { > type: DiskSpec_DiskType.NETWORK_SSD, > sizeBytes: 268435456000n, > }, > }, > }), > ).result; > await createEndpointOperation.wait(); > ``` > > In the code, set the following parameters: > > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id-javascript-sdk). > * `metadata.name`: Endpoint name. > * `spec.image`: Container image to run. In the given example, the `nginx:alpine` image is used. > * `spec.platform`: VM platform for the endpoint. Every endpoint uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `spec.ports[].containerPort`: Port on which the application listens in the container. Each HTTP port is available through the endpoint's managed HTTPS URL. > * `spec.ports[].protocol`: Protocol used by the exposed port. > * `spec.authToken`: Token used for endpoint authentication, generated in the previous step. > * `spec.publicIp` (optional): Whether to assign a public IP address to the endpoint. Not required to reach the endpoint from the internet, because each HTTP port is available through the endpoint's managed HTTPS URL. > * `spec.subnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id-javascript-sdk). > * `spec.disk.type`: Disk type for the underlying VM. > * `spec.disk.sizeBytes`: Disk size in bytes, as a `bigint`. The example sets 250 GiB. > > After `await createEndpointOperation.wait()` completes, `createEndpointOperation.resourceId()` returns the created endpoint's ID. Save this value because you need it in later steps. > > Wait for the endpoint to start running. > [tab] REST API > > 1. Create a token for endpoint authentication: > > ```bash > openssl rand -hex 32 > ``` > > Save the token: it is different from the access token that authorizes REST API requests, and you need it to create and test the endpoint. > > 2. Send the following request. Specify the endpoint authentication token from the previous step in `spec.authToken`: > > ```bash > curl --request POST \ > --url 'https://api.nebius.cloud/ai/v1/endpoints' \ > --header "Authorization: Bearer " \ > --header 'Content-Type: application/json' \ > --data '{ > "metadata": { > "parentId": "", > "name": "qs-endpoint-nginx" > }, > "spec": { > "image": "nginx:alpine", > "platform": "cpu-d3", > "preset": "4vcpu-16gb", > "ports": [ > { > "containerPort": 80, > "protocol": "HTTP" > } > ], > "authToken": "", > "publicIp": true, > "subnetId": "", > "disk": { > "type": "NETWORK_SSD", > "sizeBytes": "268435456000" > } > } > }' > > ``` > > In the `Authorization` header, replace `` with the access token that you got in the prerequisites. > > The request includes the following parameters: > > * `metadata.parentId`: [Project ID](https://docs.nebius.com/iam/manage-projects.md#how-to-get-a-project-id). > * `metadata.name`: Endpoint name. > * `spec.image`: Container image to run. > * `spec.platform`: VM platform for the endpoint. Every endpoint uses [Compute platforms and presets](https://docs.nebius.com/compute/virtual-machines/types.md). > * `spec.preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform. > * `spec.ports[].containerPort`: Port on which the application listens in the container. > * `spec.ports[].protocol`: Protocol used by the exposed port. An HTTP port is available through the endpoint's managed HTTPS URL. > * `spec.authToken`: Token used for endpoint authentication. > * `spec.publicIp` (optional): Whether to assign a public IP address to the endpoint. A public IP address isn't required to reach the endpoint through its managed HTTPS URL. > * `spec.subnetId`: [Subnet ID](https://docs.nebius.com/vpc/networking/resources.md#how-to-get-a-subnet-id). > * `spec.disk.type`: Disk type for the underlying VM. > * `spec.disk.sizeBytes`: Disk size in bytes. The specified value is 250 GiB. > > The response returns the endpoint ID in the `resourceId` parameter. Save this value because you need it in later steps. > > Wait for the endpoint to start running. ### Test the endpoint > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Endpoints**. > 2. Click the endpoint name to open its details. Wait until the endpoint is running. Then copy its managed HTTPS URL (`https://...`) from the **Public endpoints** field. > 3. In a terminal, send a request to the endpoint: > > ```bash > curl -v > ``` > > In the command, specify the managed HTTPS URL that you copied earlier. > > The response should have HTTP status `200 OK`. The body is the default nginx welcome page, which confirms that the endpoint is serving traffic over the managed HTTPS URL. > [tab] CLI > > 1. Save the endpoint ID to an environment variable: > > ```bash > export ENDPOINT_ID=$(nebius ai endpoint get-by-name \ > --name qs-endpoint-nginx --format jsonpath='{.metadata.id}') > ``` > > 2. Get the endpoint's managed HTTPS URL from the **Public endpoints** field: > > ```bash > export ENDPOINT_URL=$(nebius ai endpoint get "$ENDPOINT_ID" --format json \ > | jq -r '.status.public_endpoints[] | select(startswith("https://"))' | head -1) > ``` > > 3. Test the endpoint with authentication: > > ```bash > curl -v "$ENDPOINT_URL" -H "Authorization: Bearer $AUTH_TOKEN" > ``` > > 4. Test the endpoint without a token: > > ```bash > curl -v "$ENDPOINT_URL" > ``` > > The test should fail with the error `401 Unauthorized` or `403 Forbidden`. > [tab] Go SDK > > 1. Get the endpoint's managed HTTPS URL: > > ```go > getEndpointService := sdk.Services().Ai().V1().Endpoint() > endpoint, err := getEndpointService.Get( > ctx, > &ai.GetEndpointRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("get endpoint: %w", err) > } > for _, address := range endpoint.GetStatus().GetPublicEndpoints() { > if strings.HasPrefix(address, "https://") { > fmt.Println(address) > break > } > } > ``` > > In `ai.GetEndpointRequest`, set `Id` to the endpoint ID that you saved when you created the endpoint. > > If the code prints no URL, the endpoint isn't running yet. Wait a few seconds and run the code again. > > 2. Test the endpoint with authentication: > > ```bash > curl -v \ > --header 'Authorization: Bearer ' > ``` > > Replace `` with the URL that the code printed and `` with the `authToken` value. > > 3. Test the endpoint without a token: > > ```bash > curl -v > ``` > > The test should fail with the error `401 Unauthorized` or `403 Forbidden`. > [tab] Python SDK > > 1. Get the endpoint's managed HTTPS URL: > > ```python > get_endpoint_service = EndpointServiceClient(sdk) > endpoint = await get_endpoint_service.get( > GetEndpointRequest(id=""), > ) > endpoint_url = next( > ( > address > for address in endpoint.status.public_endpoints > if address.startswith("https://") > ), > None, > ) > if endpoint_url is not None: > print(endpoint_url) > ``` > > In `GetEndpointRequest`, set `id` to the endpoint ID that you saved when you created the endpoint. > > If the code prints no URL, the endpoint isn't running yet. Wait a few seconds and run the code again. > > 2. Test the endpoint with authentication: > > ```bash > curl -v \ > --header 'Authorization: Bearer ' > ``` > > Replace `` with the URL that the code printed and `` with the `auth_token` value. > > 3. Test the endpoint without a token: > > ```bash > curl -v > ``` > > The test should fail with the error `401 Unauthorized` or `403 Forbidden`. > [tab] JavaScript SDK > > 1. Get the endpoint's managed HTTPS URL: > > ```ts > const getEndpointService = new EndpointService(sdk); > const endpoint = await getEndpointService.get( > GetEndpointRequest.create({ id: "" }), > ); > const endpointUrl = endpoint.status?.publicEndpoints.find( > (address) => address.startsWith("https://"), > ); > if (endpointUrl !== undefined) { > console.log(endpointUrl); > } > ``` > > In `GetEndpointRequest`, set `id` to the endpoint ID that you saved when you created the endpoint. > > If the code prints no URL, the endpoint isn't running yet. Wait a few seconds and run the code again. > > 2. Test the endpoint with authentication: > > ```bash > curl -v \ > --header 'Authorization: Bearer ' > ``` > > Replace `` with the URL that the code printed and `` with the `authToken` value. > > 3. Test the endpoint without a token: > > ```bash > curl -v > ``` > > The test should fail with the error `401 Unauthorized` or `403 Forbidden`. > [tab] REST API > > 1. Get the endpoint: > > ```bash > curl --request GET \ > --url "https://api.nebius.cloud/ai/v1/endpoints/" \ > --header "Authorization: Bearer " > ``` > > In the request, specify: > > * Your access token in the `Authorization` header. > * In the request path, the endpoint ID returned in the `resourceId` parameter when you created the endpoint. > > Check the `status.state` parameter in the response. If the state isn't `RUNNING`, wait a few seconds and send the request again. > > 2. Copy a managed HTTPS URL (`https://...`) from the `status.publicEndpoints` parameter in the response. > > 3. Test the endpoint with authentication: > > ```bash > curl -v \ > --header 'Authorization: Bearer ' > ``` > > 4. Test the endpoint without a token: > > ```bash > curl -v > ``` > > The test should fail with the error `401 Unauthorized` or `403 Forbidden`. ### View logs > [!NOTE] > > Viewing endpoint logs is available only in the web console and CLI. > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Endpoints**. > 2. In the endpoint list, next to the endpoint, click **View logs**. Alternatively, click  → **View logs**. > [tab] CLI > > View endpoint logs: > > ```bash > nebius ai endpoint logs $ENDPOINT_ID > ``` ### Delete the endpoint If you no longer need the endpoint, delete it. Once you delete the endpoint, you will not be charged for it. > [tab] Web console > > 1. In the sidebar, go to  **Serverless AI** → **Endpoints**. > 2. In the endpoint list, find the endpoint and click  → **Delete**. > 3. Confirm the endpoint deletion. > [tab] CLI > > ```bash > nebius ai endpoint delete $ENDPOINT_ID > ``` > [tab] Go SDK > > Run the following code: > > ```go > deleteEndpointService := sdk.Services().Ai().V1().Endpoint() > deleteEndpointOperation, err := deleteEndpointService.Delete( > ctx, > &ai.DeleteEndpointRequest{Id: ""}, > ) > if err != nil { > return fmt.Errorf("delete endpoint: %w", err) > } > if _, err = deleteEndpointOperation.Wait(ctx); err != nil { > return fmt.Errorf("wait for endpoint deletion: %w", err) > } > ``` > > In `ai.DeleteEndpointRequest`, set `Id` to the endpoint ID that you saved when you created the endpoint. > [tab] Python SDK > > Run the following code: > > ```python > delete_endpoint_service = EndpointServiceClient(sdk) > delete_endpoint_operation = await delete_endpoint_service.delete( > DeleteEndpointRequest(id=""), > ) > await delete_endpoint_operation.wait() > ``` > > In `DeleteEndpointRequest`, set `id` to the endpoint ID that you saved when you created the endpoint. > [tab] JavaScript SDK > > Run the following code: > > ```ts > const deleteEndpointService = new EndpointService(sdk); > const deleteEndpointOperation = await deleteEndpointService.delete( > DeleteEndpointRequest.create({ id: "" }), > ).result; > await deleteEndpointOperation.wait(); > ``` > > In `DeleteEndpointRequest`, set `id` to the endpoint ID that you saved when you created the endpoint. > [tab] REST API > > Send the following request: > > ```bash > curl --request DELETE \ > --url "https://api.nebius.cloud/ai/v1/endpoints/" \ > --header "Authorization: Bearer " > ``` > > In the request, specify: > > * Your access token in the `Authorization` header. > * In the request path, the endpoint ID returned in the `resourceId` parameter when you created the endpoint. ## Expected results * The endpoint is reachable over its managed HTTPS URL. * A request without a token in the web console returns `200 OK`. * A request without a token in the CLI, SDKs or REST API returns `401 Unauthorized` or `403 Forbidden`. * An endpoint can be deleted successfully. ## See also * [Deploying a large language model and chatting with it by using Serverless AI endpoints](https://docs.nebius.com/serverless/tutorials/deploy-model.md) # Managing Devlabs in Serverless AI Source: https://docs.nebius.com/serverless/devlabs/manage.md *Serverless AI Devlabs* run container images as interactive development environments. They are suitable for coding, prototyping and debugging in the browser, including template-based setups such as code-server, JupyterLab® or ComfyUI. Each Devlab runs on a Compute virtual machine (VM) managed by Serverless AI. ## Prerequisites > [tab] Web console > > Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > To open Devlabs and check logs, you need at least the `viewer` role. > [tab] CLI > > * [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI. > > Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration: > > ```bash > cat ~/.nebius/config.yaml > ``` > > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > To open Devlabs and check logs, you or the service account that you use needs at least the `viewer` role. > [tab] Go SDK > > * [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > To open Devlabs and check logs, you or the service account that you use needs at least the `viewer` role. > [tab] Python SDK > > * [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > To open Devlabs and check logs, you or the service account that you use needs at least the `viewer` role. > [tab] JavaScript SDK > > * [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md). > * Make sure that you or the service account that you use is in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console. > > To open Devlabs and check logs, you or the service account that you use needs at least the `viewer` role. ## How to create a Devlab To create an interactive development environment, create a Devlab: > [tab] Web console > > > [!TIP] > > > > If you want to create a Devlab based on an existing one, find the Devlab on the **Serverless AI** → **Devlabs** page and click → **Clone**. On the creation page that opens, review the prefilled settings, modify them if needed, and click **Create Devlab**. > > 1. In the sidebar, go to  **Serverless AI** → **Devlabs**. > > 2. Click  **Create Devlab**. > > 3. Specify the Devlab name. > > 4. Configure **Devlab settings**: > > 1. Select **Custom** to provide your own container image, or **Template** to start from a template. > > 2. If you selected **Custom**, in **Image path**, set the path to the container image. > > 3. If you use a private registry, click  **Add registry** and provide the details for your registry. > > 4. In **Ports**, set the container ports for the Devlab. For each port, select **HTTP** or **TCP**. You can add multiple ports. The primary web UI port gets the Devlab's managed HTTPS URL; other ports are shown in the Devlab status but aren't publicly routed. > > 5. (Optional) In **Entrypoint command**, specify the entrypoint command for the container. > > If you need to pass container arguments, specify them in this field as well. > > 6. (Optional) In **Environment variables**, specify environment variables in key-value pairs. > > 7. (Optional) In **Secret environment variables**, click  **Create secret** to store a sensitive value in [SecretStash](https://docs.nebius.com/mysterybox/overview.md) and inject it as an environment variable. In the window that opens, specify the **Key** (environment variable name) and **Value** (secret data), then click **Create**. > > 8. (Optional) Enable **Bearer token authentication** if you want to protect the Devlab web UI with a token. > > 1. Under **Token**, click  **Create**. > 2. In the **Create secret with token** window, specify the secret **Name** and, optionally, a **Description**. > 3. In **Token**, enter a token or click **Generate**. Copy and save the token securely before proceeding. The token is saved as the first value in a [SecretStash](https://docs.nebius.com/mysterybox/overview.md) secret. > 4. Click **Create secret**. > > If token authentication is disabled, anyone with the Devlab URL can access the service. > > 5. (Optional) In **Platform**, select **With GPUs** or **Without GPUs**, then select the [platform](https://docs.nebius.com/compute/virtual-machines/types.md). > > 6. (Optional) In **Settings**, select the [preset](https://docs.nebius.com/compute/virtual-machines/types.md). The preset must match the selected platform. > > 7. (Optional) Configure **Storage** settings: > > * Under **Container disk size**, specify at least 50 GiB for GPU workloads or 20 GiB for CPU-only workloads. If the container image requires a bigger disk size, set at least the minimum required value for the image. Otherwise, the workloads won't be able to launch. For more information, see how [disk performance depends on disk size](https://docs.nebius.com/compute/storage/types.md#disk-performance). > > Data under the workspace path on this disk persists across stop and restart. The workspace is a path on the container disk (`/workspace` by default, or the path declared by the template). Its size is limited only by the disk size. While the Devlab is stopped, the entire container disk continues to be billed. > > * Under **Mounted volumes**, click **Attach volume** to attach a bucket or a filesystem. You can create a bucket or filesystem, or use an existing one. To create a new bucket, see [Bucket parameters](https://docs.nebius.com/object-storage/buckets/manage.md#bucket-parameters-web-console). To create a new filesystem, see [Volume parameters](https://docs.nebius.com/compute/storage/manage.md#volume-parameters). > > 8. (Optional) In **Files**, upload files or create text files to inject into the container. The maximum file size is 64 KB. > > 9. Configure the **Network** section: > > * Select a network and a subnet, or create a new subnet. > * Select the IP address type: **Auto dynamic IP** or **Private IP**. > > A public IP address isn't required to open the Devlab web UI over the managed HTTPS URL. If you add an SSH key, make sure that network access allows SSH so you can connect to the VM. > > 10. Click **Create Devlab**. > [tab] CLI > > 1. If you want to create a Devlab from a template, list the available templates and choose one: > > ```bash > nebius ai devlab template list > ``` > > 2. Create the Devlab. Use either a template or a container image: > > * From a template: > > ```bash > nebius ai devlab create \ > --name \ > --template