4

VM instance details report the external IP is ephemeral. Dictionary says this means "lasting for a very short time".

Does anyone know how short? Static enough to aim DNS to this? If not very short, how does one get a less temporary IP address for a gcloud compute engine instance?

D Saini
  • 87
  • 5
grabbag
  • 163
  • 2
  • 6

1 Answers1

6

The IP address remains attached to the VM until you stop it. If you reboot the VM, you will get a new ephemeral IP address.

From the documentation:

Ephemeral external IP addresses are available to VM instances and forwarding rules. Ephemeral external IP addresses remain attached to a VM instance only until the VM is stopped and restarted or the instance is terminated. If an instance is stopped, any ephemeral external IP addresses assigned to the instance are released back into the general Compute Engine pool and become available for use by other projects. When a stopped instance is started again, a new ephemeral external IP address is assigned to the instance.

If you need an IP address to last longer than that, you need to reserve a static external IP address and attach it to that VM. It will remain attached to that VM until explicitly detached, or the VM is deleted.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • Thank you for the answer and especially the link to the document. – grabbag Jan 19 '18 at 20:42
  • 2
    A couple of relevant details which are not mentioned in this answer: If you change the amount of RAM or number of CPUs in your VM, it will reboot and get a new IP if it was ephemeral. You can change the IP address attached to your VM from ephemeral to static while the VM is running. – kasperd Jan 19 '18 at 23:02