# How to Assign or Remove a Public IP Address Machines are Linux and Windows virtual machines with persistent storage, GPU options, and free unlimited bandwidth. They’re designed for high-performance computing (HPC) workloads. For a machine to be accessible over the internet, it needs a [public IP address](https://docs.digitalocean.com/products/paperspace/machines/details/features/index.html.md#ip-address). You can assign either a static or dynamic public IP address: - A machine with a **static public IP address** has the same IP address every time it powers on. Static public IP addresses remain in your Paperspace account until you delete them. We recommend static addresses when you need a consistent address to access your machine. - A machine with a **dynamic public IP address** has a different IP address each time it powers on. Dynamic public IP addresses are assigned automatically when a machine powers on and deleted when it powers off. We recommend dynamic addresses when you only need temporary access to your machine. A machine with no public IP address is not accessible over the internet, which is suitable for some use cases and avoids unnecessary charges. However, SSH-only machines must have a public IP address in order to use them. You can manage a public IP address using the [Paperspace console](https://console.paperspace.com), [Paperspace API](https://docs.digitalocean.com/reference/paperspace/api-reference/index.html.md), or [Paperspace CLI](https://docs.digitalocean.com/reference/paperspace/pspace/index.html.md). ## Assign a Static Public IP Address ### Using the Paperspace Console To assign a static IP address, go to the [Paperspace console](https://console.paperspace.com), in the top-right corner, click the drop-down menu, select **CORE**, then click the **Machines** tab. In the **Machines** section, select the machine you want to assign a static IP address to. On the machine’s overview page, in the top-right corner, click the **Settings** tab. In the **Settings** page, under the **Public IP** section, click **Static**, then click **SAVE** to open the **Make public IP static** window. On the **Make public IP static** window, click **ASSIGN IP** if you want to create a static public IP address. If you create a static IP address, you are charged for that IP address until you delete it. Afterwards, your machine is automatically assigned a static public IP address, which is shown in the **Settings** page, under the **Public IP** section. ### Using the Paperspace API Before assigning a static public IP address using the Paperspace API, you first need to [claim an IP address and attach it to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-reference/index.html.md#operation/publicIps-claim). Afterwards, copy the public IP address you’ve claimed for later use. To assign a static public IP address, provide the following values: - `ip` (string): The static public IP address you want to assign to your machine. - `machineId` (string): The ID of the machine you want to assign a static public IP address to. ## How to Assign a Static Public IP Address Using the Paperspace API 1. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use. 2. Send a PUT request to `https://api.paperspace.com/v1/public-ips/{ip}`. ```bash curl -X PUT \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAPERSPACE_API_KEY" \ -d '{ "ip": "203.0.113.0", "machineId": "psm9u09bwu5i" }' \ "https://api.paperspace.com/v1/public-ips/203.0.113.0" ``` ### Using the Paperspace CLI Before assigning a static public IP address using the Paperspace CLI, you first need to [claim a public IP address and attach it to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/pspace/commands/public-ip/index.html.md#pspace-public-ip-claim). Afterwards, copy the public IP address you’ve claimed for later use. To assign a static public IP address, provide the following values: - `ip` (string): The static public IP address you want to assign to your machine. - `machine-id` (string): The ID of the machine you want to assign a static public IP address to. ## How to Assign a Static Public IP Address Using the Paperspace CLI 1. [Install `pspace`](https://docs.digitalocean.com/reference/paperspace/pspace/install/index.html.md), the Paperspace command-line tool. 2. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use with `pspace`. 3. Use the API key to grant `pspace` access to your Paperspace account. ```bash pspace login --api-key your-api-key ``` 4. Finally, run `pspace public-ip assign -F [flags]`. ```bash pspace public-ip assign 203.0.113.0 -F --machine-id psm9u09bwu5i ``` ## Assign a Dynamic Public IP Address **Note**: You cannot use the Paperspace API or CLI to assign a dynamic IP address to existing machines. You can only [specify the type of IP address](https://docs.digitalocean.com/products/paperspace/machines/details/features/index.html.md#ip-address) when you first [create your machine](https://docs.digitalocean.com/products/paperspace/machines/how-to/create/index.html.md). If you want to assign a dynamic IP address to existing machines, you can assign them via the Paperspace console. To assign a dynamic IP address, go to the [Paperspace console](https://console.paperspace.com), in the top-right corner, click the drop-down menu, select **CORE**, then click the **Machines** tab. In the **Machines** section, select the machine you want to assign a dynamic IP address to. On the machine’s overview page, in the top-right corner, click the **Settings** tab. In the **Settings** page, under the **Public IP** section, click **Dynamic**, then click **SAVE** to open the **Make public IP dynamic** window. On the **Make public IP dynamic** window, click **ASSIGN IP** if you want to create a dynamic public IP address. If you create a dynamic public IP address, you’re only charged when you’re using your machine. Afterwards, your machine is automatically assigned a dynamic public IP address, which is shown in the **Settings** page, under the **Public IP** section. ## Remove Public IP Address ### Using the Paperspace Console To remove an IP address, go to the [Paperspace console](https://console.paperspace.com), in the top-right corner, click the drop-down menu, select **CORE**, then click the **Machines** tab. In the **Machines** section, select the machine you want to remove a IP address for. On the machine’s overview page, in the top-right corner, click the **Settings** tab. In the **Settings** page, under the **Public IP** section, click **None**, then click **SAVE** to open the **Remove public IP** window. On the **Remove public IP** window, click **REMOVE IP** if you want to remove the IP address assigned to your machine. If you remove the public IP address associated with your machine, then your machine isn’t reachable over the internet. ### Using the Paperspace API When removing a public IP address using the Paperspace API, you need to provide the public IP address to remove. ## How to Remove a Public IP Address Using the Paperspace API 1. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use. 2. Send a DELETE request to `https://api.paperspace.com/v1/public-ips/{ip}`. ```bash curl -X DELETE \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAPERSPACE_API_KEY" \ -d '{ "ip": "203.0.113.0" }' \ "https://api.paperspace.com/v1/public-ips/203.0.113.0" ``` ### Using the Paperspace CLI When removing a static public IP address using the Paperspace CLI, you need to provide the public IP address to remove. ## How to Remove a Public IP Address Using the Paperspace CLI 1. [Install `pspace`](https://docs.digitalocean.com/reference/paperspace/pspace/install/index.html.md), the Paperspace command-line tool. 2. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use with `pspace`. 3. Use the API key to grant `pspace` access to your Paperspace account. ```bash pspace login --api-key your-api-key ``` 4. Finally, run `pspace public-ip release `. ```bash pspace public-ip release 203.0.113.0 ```