Skip to content

Attach a VPC to a VM

View as Markdown

Attach a VPC to a CPU TIR Virtual Machine (VM) to give it a private address in a network of your own, so it can talk to your other machines in that VPC privately. The VM keeps its public address as well. A VM holds one VPC at a time, and you can switch it to another VPC or detach it later.

Until you attach a VPC of your own, a CPU VM sits on the project’s default private network.

On the Create VM form, choose the VPC in the VPC field under Network & Security. Choose an active VPC with a free IP for each VM you launch. See Create a VM for the rest of the form.

Attach or switch the VPC of a VM that exists

Section titled “Attach or switch the VPC of a VM that exists”

Attaching or switching a VPC restarts the VM, so save your work and stop long jobs first.

  1. In Manage VMs, select the VM’s name, then go to Network & Security > Network.
  2. In the VPC section, pick a VPC in Select VPC, then pick one of its subnets in Select subnet.
  3. Select Update.
  4. In Attach VPC, or Switch VPC when the VM already has one, select Continue. Switch VPC detaches the current VPC and attaches the new one.

The VM restarts to pick up the VPC: a second network interface next to the public one, with its address from the VPC.

When the VM is Running again, Private IP under Connection Details on its Overview tab is the VM’s address inside the VPC. Use it to reach the VM from your other machines in the same VPC, including over SSH. See Connect to a VM over SSH.

Detaching the VPC restarts the VM, and the VM loses its address in that VPC.

  1. On the Network side tab, select Detach beside the VPC.
  2. In Detach VPC, select Detach.

The VM restarts and is back on the project’s default private network.

Use a VPC IP on a GPU VM or a private cluster VM

Section titled “Use a VPC IP on a GPU VM or a private cluster VM”

A VM on a GPU plan or on a private cluster joins a VPC through a VPC IP. On its Network side tab, pick an address in Select VPC IP, or reserve one with Reserve New VPC IP, then select Attach. You can attach a VPC IP while the VM is Stopped as well as while it runs. To detach it, select Detach VPC beside the VPC and confirm in Detach VPC. The VM then loses its connection to that VPC.

To give the VM a public address that stays the same, see Attach a reserved IP to a VM. For help with a message, see Troubleshooting TIR Virtual Machines.