Nebius Israel
Contact usConsole
  • GPU
  • Docs
© 2023 Nebius Israel Ltd
Compute Cloud
  • Container Solution
  • Access management
  • Pricing policy
  1. Step-by-step guides
  2. Managing VMs
  3. Attaching a public IP address to a VM

Binding a public IP to a virtual machine

If you created a virtual machine without a public IP, you can bind it to an IP you reserved in Virtual Private Cloud or to one automatically selected by Compute Cloud from among available IPs.

Management console
CLI
  1. In the management console, select the folder the VM belongs to.
  2. Select Compute Cloud.
  3. Select the VM.
  4. Under Network interface, in the top-right corner, click and select Add public IP address.
  5. In the window that opens:
    • In the Public address field, select Auto to get an IP automatically or List to choose a reserved one from the list.
    • If you selected List in the Public address field, select the address that you would like to bind to your VM.
    • Click Add.

If you don't have the Nebius Israel command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To attach a public IP address to a VM, run the following CLI command:

yc compute instance add-one-to-one-nat
  --id=<instance_ID>
  --network-interface-index=<instance_network_interface_index>
  --nat-address=<IP address>

Where:

  • id: VM ID. You can get a list of instance IDs in a folder using the CLI command yc compute instance list.
  • network-interface-index: VM's network interface index. By default: 0.
  • nat-address: Public IP address to assign to the VM. You can get a list of reserved public IP addresses in a folder using the CLI command yc vpc address list. By default, a public IP address is assigned automatically.

Usage example:

yc compute instance add-one-to-one-nat
  --id=fhmsbag62tafcus1a12c
  --network-interface-index=0
  --nat-address=51.250.9.203

Result:

id: fhmsbag62tafcus1a12c
folder_id: b1gv87ssvu497lpgjh5o
created_at: "2022-05-06T10:41:56Z"
name: steel-machine
...
network_interfaces:
- index: "0"
  mac_address: d0:0d:1c:5a:a0:61
  subnet_id: e9bn57jvjnbujnmk3mba
  primary_v4_address:
    address: 10.128.0.23
    one_to_one_nat:
      address: 51.250.9.203
      ip_version: IPV4
  security_group_ids:
  - enpcuhcljhb0jq9s3sb7
fqdn: steel-machine.il1.internal
scheduling_policy:
  preemptible: true
network_settings:
  type: STANDARD
placement_policy: {}

For more information about the yc compute instance add-one-to-one-nat command, see the CLI reference.

© 2023 Nebius Israel Ltd