Ensure Persistent Private IP Address Assignment in GCP

Prevent Automatic Reassignment of Private IP Address

Question

One instance in your VPC is configured to run with a private IP address only.

You want to ensure that even if this instance is deleted, its current private IP address will not be automatically assigned to a different instance.

In the GCP Console, what should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

The correct answer is C. Change the instance's current internal IP address to static.

Explanation:

In Google Cloud Platform (GCP), instances running in a Virtual Private Cloud (VPC) network can have either a static or dynamic internal IP address. A dynamic internal IP address is assigned automatically by GCP, and if the instance is deleted, the IP address may be reassigned to a different instance in the future.

To ensure that the private IP address of an instance is not automatically assigned to a different instance even if it's deleted, you need to change its current internal IP address to static. This ensures that the IP address is reserved for the instance, and will not be automatically reassigned to another instance.

Option A, assigning a public IP address to the instance, is not relevant to this scenario as it does not affect the assignment of internal IP addresses.

Option B, assigning a new reserved internal IP address to the instance, is not necessary if the goal is to prevent the current private IP address from being automatically assigned to a different instance. This option would only be relevant if the current IP address was not suitable for some reason.

Option D, adding custom metadata to the instance with key internal-address and value reserved, is not a valid option to reserve an IP address for an instance. Custom metadata is used to store arbitrary data in key-value pairs and is not related to IP address assignment.

Therefore, the correct option is C, changing the instance's current internal IP address to static.