2
votes

I want to upgrade the hardware configs of my currently running VM. So I took a snapshot and created new VM with the Snapshot. But it is created with new internal-ip address. I have configured other VMs which points to this, using internal IP-address. Is there a way to assign the same IP-address also when I create a VM using snapshot?

3

3 Answers

3
votes

It's not possible to select the internal IP address.

However, you can create a route to map the IP address you want to your instance.

You can see all necessary steps in the documentation.

Please, take into account that you can only enable IP forwarding (--can-ip-forward) at instance creation time.

Once you have followed all the steps, instances in the same network should be able to communicate to your instance using the internal IP you have chosen.

0
votes

It is not possible to assign a specific internal IP address to a VM when you create it.

gcloud compute instances create [INSTANCE_NAME] --private-network-ip [IP_ADDRESS]

See details here https://cloud.google.com/compute/docs/configure-instance-ip-addresses#assigninternalip

0
votes

As of recently (beta), you can also reserve a static IP address just like you can with external IP:s, such as:

gcloud beta compute addresses create example-address-1 \
    --region us-central1 --subnet subnet-1 --addresses 10.128.0.12

Or promote an existing internal to static:

gcloud beta compute addresses create example-address-1 example-address-2 \
    --addresses 10.128.4.90,10.128.0.232 \
    --region us-central1 \
    --subnet subnet-1