I have dynamic external IP on a GCP VM. I need it to be different. However I tried to restart VM it is always the same. I appreciate that Google is trying to do good for their customers and it is cool to have quasi-static IP for free.. But I need to change it!
Is there simple way to do so ? (I mean without re-creating VM, some CLI command for example?)
EDIT since not even clearing networking settings in the VM properties helps I feel I need to add this picture to demonstrate that the IP is indeed emphemeral:
After some tinkering I found that if you change your external IP to "standard" tier from "premium" you get different IP.
None of the Edd's methods worked with premium tier
The first and easy way to do it is stop and restart your VM.
"Ephemeral external IP addresses remain attached to a VM instance only until the VM is stopped and restarted or the instance is terminated. If an instance is stopped, any ephemeral external IP addresses that were assigned to the instance are released back into the general Compute Engine pool and become available for use by other projects. When a stopped instance is started again, a new ephemeral external IP address is assigned to the instance."
The second way is deleting the current IP assigned and assign a new one into the VM configuration by doing this:
You can now validate the new External IP assigned in the VM instances Dashboard.
Third option, depending on your needs, you can reserve a static external IP address, which assigns the address to your project indefinitely until you explicitly release it.