Detaching a public IP address from a virtual machine
If you previously attached a public IP address to a VM's network interface, you can detach it.
Note
If the IP address you are unlinking was assigned automatically (a dynamic IP address), you will not be able to link it to a cloud resource again. To save the IP address for future use, make it static.
- In the management console
, select the folder the VM belongs to. - Select Compute Cloud.
- Select the VM.
- In the window that opens, under Network, click
in the top-right corner of the relevant network interface section and select Disassociate public IP address. - In the window that opens, click Delete.
If you do not have the Yandex Cloud 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 detach a public IP address from a VM, run the following CLI command:
yc compute instance remove-one-to-one-nat
--id=<VM_ID>
--network-interface-index=<VM_network_interface_number>
Where:
--id
: VM ID. You can get a list of available VM IDs in a folder using theyc compute instance list
CLI command.--network-interface-index
: VM network interface number. The default value is0
. To get a list of VM network interfaces and their numbers, run the following command:yc compute instance get <VM_ID>
.
For more information about the yc compute instance remove-one-to-one-nat
command, see the CLI reference.
Use the removeOneToOneNat REST API method for the Instance resource or the InstanceService/RemoveOneToOneNat gRPC API call.