You should probably use a static public IP address if you’re hosting web services on a cloud server, such as GCP’s Compute Engine, as the dynamic one provided by default is subject to change whenever the server is restarted.
What Is a Static IP Address?
Any server that is launched on a virtual cloud platform, such as AWS or Google Cloud Platform, is given two IP addresses: a private one for internal communication and a public one that, so long as the firewall is open, enables anyone on the internet to access the server’s services.
Your server’s IP address might change if it is restarted since VPS providers like GCP let you start and stop cloud servers whenever you want and the dynamic address you were using might have been assigned to someone else. This is a problem if you need to configure another service utilizing this IP address, such as your DNS.
Static IP addresses, which never change, are the answer. These can be created, attached to your servers, and will take the place of the dynamically generated public address. This address is ensured to remain the same even if the server is restarted.
Reserving a static IP address is one of the initial steps after establishing a website project on the Google Cloud Platform. When a user of the Google Cloud Platform runs into a technical issue, it’s usually because they forgot to reserve a static IP address for their website.
You will discover how to quickly reserve a static IP address for your website on the Google Cloud Platform in this article.
Reserve an Existing IP Address in Google Cloud Platform
From the Google Cloud Platform Console, click Compute Engine > VM Instances:
Click on the settings dropdown for the instance you want to assign the address to, and select “View Network Details”:
This will open up the network configuration for this GCP project, where you will be able to select “IP Addresses” from the sidebar, and provision a new static one with “Reserve External Static Address”:
Click on “Reserve” against the External IP row and that will bring the popup screen to provide the name.
Once done, you will find the confirmation page where the new name and type of the IP address will be shown.
If you do not need Static IP, it is highly recommended to relink the IP from any resource/virtual machine and release the same.
Select the Static IP Address row and Click on Change. This will bring the new popup window. Here in the Attach To dropdown, select None. This way you are delinking this static IP from the existing Virtual Machine.
Once done, select the Static IP row and click on “Release Static Address”. That way you are releasing the static IP address that is not being used.
In my next blog post, I will explain what is Static IP and how you can configure that in Google Cloud Platform.