Choosing an existing internal IP address for an instance at the time of its creation.

0 votes
I already have an IP address, How can I assign it to an instance at the time of its creation?
Nov 11 in GCP by anonymous
• 4,330 points
24 views

1 answer to this question.

0 votes

You can choose a specific internal IP address to assign to an instance when you create it. 

The IP address must be a valid IP address of the subnet of the instance, and the IP address must not already be in use. The IP address remains attached to the instance until you delete the instance, which releases the IP address back into the pool. If you stop and restart the instance, the instance retains the same internal IP address.

In gcloud, run:

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

where:

  • [INSTANCE_NAME] is the name of the instance you want to create.

  • [IP_ADDRESS] is the IP address you want to assign.

If you are using a custom subnet mode network, you must also specify the subnet using the --subnet [SUBNET] parameter.

answered Nov 11 by Sirajul
• 40,980 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Creating a SQL Server instance using Google Compute engine.

Google Compute Engine provides public images preconfigured with ...READ MORE

answered Sep 23 in GCP by Sirajul
• 40,980 points
60 views
0 votes
1 answer

How do i install gcloud compute?

The gcloud compute command-line tool enables you to easily ...READ MORE

answered Sep 23 in GCP by Sirajul
• 40,980 points
74 views