Ensure that Compute Engine instance templates are not configured to assign a static, public IP address to virtual machine (VM) instances launched using the templates in order to receive an ephemeral IP address assigned automatically by Google Cloud.
When you create an instance template, you can choose whether or not to assign a static, external IP address to your VM instances. Choosing not to assign a static IP address for an instance template in Google Cloud offers several advantages, including increased IP address availability, flexibility, cost savings, and dynamic routing capabilities. Therefore, it is advisable not to assign public IP addresses to the new instances and instead allow them to receive ephemeral internal IP addresses assigned by the network. This approach ensures optimal resource utilization and adaptability in your Google Cloud environment.
Audit
To determine if your instance templates are configured to assign a public IP address for VM instances, perform the following operations:
Checking the type of the external IP configured for an instance template via Google Cloud CLI (gcloud CLI) is not supported.Remediation / Resolution
To ensure that your Compute Engine instance templates are not configured to assign a static, public IP address to VM instances, you must re-create your instance templates with the appropriate network configuration. To deploy a new instance template, perform the following operations:
References
- Google Cloud Platform (GCP) Documentation
- Instance templates
- Create instance templates
- IP addresses
- Reserve a static external IP address
- GCP Command Line Interface (CLI) Documentation
- gcloud projects list
- gcloud compute instance-templates create