Google Cloud Platform: assigning a static IP address to a VM instance

Google Cloud Platform external IP address console menu item

An external IP address is assigned to every Google Cloud Platform virtual machine (VM) instance that you create.

This IP address can be used in your DNS settings so that users can access the instance via a domain name. The problem, however, is that the IP address resets whenever the VM instance is restarted. This means that every time you restart your VM instance, you will need to update your various configurations (e.g. DNS, load balancing) to reference the new IP address.

You can bypass this issue by reserving and assigning a static IP address for an instance. An added bonus is that this is free! However, you will be charged USD$0.01/hour for unused IP addresses – i.e. reserved static IP addresses that are not attached to an instance or forwarding rule.



Regional vs Global IP addresses

Regional IP addresses can be used by:

  • VM instances
  • Network load balancers

Global IP addresses are used for global load balancers.


How to reserve and assign a static IP address to a Google Cloud Platform VM instance

Navigate to the Google Cloud Platform Console page for your project.

Using the left-hand menu, navigate to Networking > VPC network > External IP addresses
Google Cloud Platform external IP address console menu item


Click on + Reserve Static Address
Google Cloud Platform external IP address add static address


Edit the settings:

  • Name: a name to describe this IP reservation (e.g. “webserver-primary-ip”)
  • IP version: IPv4 or IPv6 depending on your needs
  • Type: Regional if you want to use it for accessing a VM instance
  • Region: Select the same region as where your VM instance lives
  • *Attached to: Select the instance you wish to attach the static IP address to
  • Click on Reserve to save your settings

Google Cloud Platform external IP address add static address settings


You will be taken back to the External IP addresses list page. Here you can see the new IP address that has been assigned to your instance.
Google Cloud Platform external IP address list

This IP address can now be used in your DNS settings.



Did you find this helpful and think it would be beneficial for someone else? Share now!

12 thoughts on “Google Cloud Platform: assigning a static IP address to a VM instance

  1. Pingback: Setting up Google Cloud DNS for a GoDaddy domain -

  2. SooWhan Lee Reply

    I reserved static address and released it by mistake. And I tried to reserve it again but external IP address appears same as original address. And it is not working properly. Can you please give me an advice?

    • Vinoaj Vijeyakumaar Post authorReply

      Hi SooWhan,

      What do you mean by it’s not working properly? Were you able to follow the steps in my post? At what point did you encounter any issues?


  3. hashir Reply

    hello i follow all the steps but still i am facing issue when i am type my domain name and press enter its take me to my external ip

    • admin Reply

      Hi Hashir – if you follow the instructions, then that is what should happen: typing in your domain name will take you to the external IP of your instance. What behaviour are you seeking?

  4. Saurav Reply

    I have one public ip for my VM already to access it do I need to create once again.
    If I will create it again can I access my VM with the external ip which I created.

    my prob:
    when I do nslookup my ip address is showing but I don’t want to show my ip address

    Plz help me in this.

    • admin Reply

      Yes, you can access the VM with the new IP. If your server is meant to be publicly accessible, then there is no way to hide it’s IP address from nslookup calls.

  5. adonis stathakis Reply

    Hello Vinoaj,
    excellent post, do you think that you can use the same method to reserve a static ip address for a storage bucket? i have been trying to connect a static website to my domain in godaddy and it seems impossible.

  6. Laura Reply

    thank you for this great post!

    I just assigned a static IP address to a LoadBalancer service and it works perfectly fine, but my other LoadBalancer(s) also “want” to have a static IP address now (I get the error “Error creating load balancer (will retry): failed to ensure load balancer for service default/example: failed to ensure a static IP for load balancer: Error 403: Quota ‘STATIC_ADDRESSES’ exceeded. Limit: 1.0 in region us-central1., quotaExceeded”, as I am limited to only 1 static IP address due to a Trial account), but I’d be fine with the other LoadBalancer having an ephemeral IP address.

    Do you know if it is possible to force other LoadBalancer services having an ephemeral IP address?

    Thank you in advance!

  7. Pingback: Pulling The Plug, Part 12: The End – Glyffe News

Leave a Reply

Your email address will not be published. Required fields are marked *