In this blog post, I will show you how to set up a static public IP address on a Google Cloud Platform (GCP) Compute Engine VM instance.
In Google Cloud Platform, virtual machines are called VM instances, and by default, they receive a dynamic public IP address.
That is OK if you don’t host any websites or applications that are using DNS to point to the VM and the applications running inside.
In many cases, this is not ideal, and we need a static IP address that stays the same after reboot.
Set Static IP Address
To set a static public IP address on your VM, open the GCP console and click on VM instances.
Click on VM extended menu and click on:
View network details.
From the VPC Network console, click on:
External IP addresses
From the external IP addresses page, locate your VM and set the IP type to Static from Ephemeral as shown below.
Give the IP address a name that will be easy to know to which VM it belongs and click on reserve.
The static IP will be set the next time the VM is rebooted.