How to Setup an static ip address to a Google Compute Engine Instance
By default Google Compute Engine instances are created with ephimeral IP address. What if you want to set to them an static IP that doesnt change?
For instance, the most common scenario would be to link to that IP a catchy
I found a solution in 2 steps:
Delete the current possible ephimeral ip configuration:
Where <instance>
is the name of the instance you want to update, and External NAT is the name of the configuration, which probably has that value because of its the default one. And you can check it running this:
And add the static one
If you want to bind an static address, probably to bind it to a DNS address, execute something like this
Remember to always append the --zone
to any gcloud command to avoid any ambiguity. You can get the address
from the valid addresses configuration you have in your project, which you can be gotten like this:
Dont use the NAME
but the ADDRESS
. You should pick an address in the same zone of your instance. When the address be attached you will see that in the STATUS
field of the last query it will say IN USE.
Et voila!
Leave a Comment