Skip to main content


4.9 Ensure That Compute Instances Do Not Have Public IP Addresses (Automated)

Profile Applicability

• Level 2


Do not configure compute instances to have external IP addresses.


To reduce your attack surface, Compute instances should not have public IP addresses. Instead, instances should be configured behind load balancers, to minimize the instance's exposure to the internet.


Removing the external IP address from your Compute instance may cause some applications to stop working.


From Console:

  1. Go to the VM instances page by visiting:

  2. For every VM, ensure that there is no External IP configured.

From Command Line:

gcloud compute instances list --format=json
  1. The output should not contain an accessConfigs section under networkInterfaces. Note that the natIP value is present only for instances that are running or for instances that are stopped but have a static IP address. For instances that are stopped and are configured to have an ephemeral public IP address, the natIP field will not be present. Example output:
- accessConfigs:
- kind: compute#accessConfig
name: External NAT
networkTier: STANDARD

Exception: Instances created by GKE should be excluded because some of them have external IP addresses and cannot be changed by editing the instance settings. Instances created by GKE should be excluded. These instances have names that start with "gke-" and are labeled "goog-gke-node".


From Console:

  1. Go to the VM instances page by visiting:

  2. Click the instance name to go the the Instance detail page.

  3. Click Edit.

  4. For each Network interface, set External IP to None.

  5. Click Done and then click Save.

From Command Line:

  1. Describe the instance properties:
gcloud compute instances describe <instance_name> --zone=<zone>
  1. Identify the access config name that contains the external IP address. This access config appears in the following format:
- accessConfigs:
- kind: compute#accessConfig
name: External Network Address Translation
  1. Delete the access config.
gcloud compute instances delete-access-config <instance_name> --zone=<zone> --access-config-name <access_config_name>

In the preceding example, the access_config_name is External Network Address Translation. The name of your access config might be different.

Prevention: To prevent configuration of VMs with public IP addresses, you can configure the Define allowed external IPs for VM instances Organization Policy. Learn more at:


Additional Information

You can connect to Linux VMs that do not have public IP addresses by using Identity-Aware Proxy for TCP forwarding. Learn more at

For Windows VMs, see