[Yandex Cloud documentation](../../../index.md) > [Yandex Compute Cloud](../../index.md) > [Step-by-step guides](../index.md) > Managing a VM > Unassigning a public IP address from a VM

# Unassigning a public IP address from a VM

If you have previously assigned a public IP address to a VM [network interface](../../concepts/network.md), you can unassign it.

{% note info %}

When unassigning an IP address that was assigned automatically (a dynamic IP address), you will not be able to assign it to a cloud resource again. It will be deleted. To save the dynamic IP address for future use, [make it static](../../../vpc/operations/set-static-ip.md).

A static IP address remains reserved in [VPC](../../../vpc/index.md) and can be used to access cloud resources later.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder this VM belongs to.
  1. Navigate to **Compute Cloud**.
  1. Select the VM.
  1. In the window that opens, under **Network**, click ![image](../../../_assets/console-icons/ellipsis.svg) in the top-right corner of the relevant network interface section and select **Disassociate public IP address**.
  1. In the window that opens, click **Delete**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To unassign a public IP address from a VM, run the following CLI command:

  ```bash
  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 the folder using the `yc compute instance list` [CLI command](../../../cli/cli-ref/compute/cli-ref/instance/list.md).
  * `--network-interface-index`: VM network interface number. The default value is `0`. To get a list of VM network interfaces and their numbers, run `yc compute instance get <VM_ID>`.

  For more information about the `yc compute instance remove-one-to-one-nat` command, see the [CLI reference](../../../cli/cli-ref/compute/cli-ref/instance/remove-one-to-one-nat.md).

- API {#api}

  Use the [removeOneToOneNat](../../api-ref/Instance/removeOneToOneNat.md) REST API method for the [Instance](../../api-ref/Instance/index.md) resource or the [InstanceService/RemoveOneToOneNat](../../api-ref/grpc/Instance/removeOneToOneNat.md) gRPC API call.

{% endlist %}