Binding a public IP to a virtual machine
If you created a virtual machine without a public IP address, you can assign it an address selected automatically.
-
In the management console
, select the folder the VM belongs to. -
Select Compute Cloud.
-
Select the VM.
-
Under Network interface, in the top-right corner, click
-
In the window that opens:
-
Select the Public address checkbox.
-
Click Add.
-
If you don't have the Nebius AI command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To attach a public IP address to a VM, run the following CLI command:
ncp compute instance add-one-to-one-nat \
--id=<instance_ID> \
--network-interface-index=<instance_network_interface_index>
Where:
id
: VM ID. You can get a list of instance IDs in a folder using the CLI commandncp compute instance list
.network-interface-index
: VM's network interface index. By default:0
.
Usage example:
ncp compute instance add-one-to-one-nat \
--id=fhmsbag62tafcus1a12c \
--network-interface-index=0
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.eu-north1.internal
scheduling_policy:
preemptible: true
network_settings:
type: STANDARD
placement_policy: {}
For more information about the ncp compute instance add-one-to-one-nat
command, see the CLI reference.