If you’re hosting web services on a cloud server, such as GCP’s Compute Engine, you probably want to use a static public IP address, as the default dynamic one is subject to change whenever the server is restarted.
What Is a Static IP Address?
Whenever you launch a server on any virtual cloud provider like AWS or Google Cloud Platform, it’s assigned two IP addresses—a private address for communicating internally, and a public address that allows anyone on the web to access services running on the machine, provided the firewall is open.
However, because VPS providers like GCP allow you to launch and terminate cloud servers at will, your server’s IP address may change if it is restarted, as the dynamic address you were using may have been given to someone else. If you need to configure another service using this IP address like your DNS, this is a problem.
The solution is static IP addresses, which will never change. You can provision these and attach them to your servers, and they will replace the dynamically assigned public address. If you restart the server, this address is guaranteed not to change.
Static IP addresses in GCP are currently free, but starting on June 30th, 2020, they will cost $3 per month. This is certainly worth it though if you’re planning on using the same server long-term. If you’re planning for high availability, and are launching two or more servers behind a load balancer, then external IP addresses are free.
You also must attach them to a running instance, or you’ll be charged a small fee for leaving them unattached—$7.50 a month per IP, so make sure you’re actually using them.
Provisioning an Address in GCP
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 “External IP Addresses” from the sidebar, and provision a new static one with “Reserve Static Address”:
Give it a name, and leave the defaults of Premium Network Service Tier and IPv4.
The next option is between regional and global addresses. If you’re provisioning this address for a global load balancer, you must use the global option. But for an individual instance, select the region it is hosted in, and then select the instance under the “Attached to” dropdown.
Click “Reserve” at the bottom, and within a minute or so you should see your instance moved over to the new static IP address.
- › “Atari Was Very, Very Hard” Nolan Bushnell on Atari, 50 Years Later
- › The 10 Best Netflix Original Movies in 2022
- › T-Mobile Is Selling Your App Activity: Here’s How to Opt Out
- › A World Without Wires: 25 Years of Wi-Fi
- › What’s New in Windows 11’s 22H2 Update: Top 10 New Features
- › NZXT Signal 4K30 Capture Card Review: Lossless High-Quality Footage