Manage public IPs

This guide shows you how to create Public IPs, attach them to virtual machines, and manage them using the evroc CLI.

For information about Public IPs and how they work, see Public IPs.

Prerequisites

  • Access to an evroc organization and project
  • evroc CLI installed and configured

Create a Public IP

Create a Public IP resource that you can attach to a virtual machine:

evroc networking publicip create mypublicip

See Create a Public IP in the API reference.

Attach a Public IP to a VM

Attach a Public IP when creating a VM:

evroc compute virtualmachine create myvm \
  --zone=a \
  --running=true \
  --vm-virtual-resources-ref=general.s \
  --disk=mybootdisk \
  --boot-from=true \
  --public-ip=mypublicip

Attach a Public IP to an existing VM:

evroc compute virtualmachine update myvm --public-ip=mypublicip

Change the Public IP on a VM

To replace a VM's Public IP with a different one, the VM must be stopped. You must first stop the VM, detach the current Public IP, attach the new one, and then start the VM again. You can't directly update from one Public IP to another.

  1. Stop the VM:

    evroc compute virtualmachine update myvm --running=false
    
  2. Detach the current Public IP:

    evroc compute virtualmachine update myvm --public-ip=""
    
  3. Attach the new Public IP:

    evroc compute virtualmachine update myvm --public-ip=mynewpublicip
    
  4. Start the VM:

    evroc compute virtualmachine update myvm --running=true
    

Detach a Public IP from a VM

Remove a Public IP from a VM to disable inbound internet connectivity:

evroc compute virtualmachine update myvm --public-ip=""

List Public IPs

List all Public IPs in your project:

evroc networking publicip list

Use evroc networking publicip get <name> for detailed information about a specific Public IP, including which VM it's attached to.

See List Public IPs in the API reference.

Delete a Public IP

Delete Public IPs you no longer need. A Public IP must not be attached to any virtual machine before you can delete it.

evroc networking publicip delete mypublicip

See Delete a Public IP in the API reference.

Next steps