01 Run projects list command (Windows/macOS/Linux) with custom output filters to list the ID of each project available in your Google Cloud Platform (GCP) account:
gcloud projects list
--format="value(projectId)"
02 The command output should return the requested GCP project identifiers (IDs):
cc-project5-123123
cc-ai-project-123123
03 Run compute networks list command (Windows/macOS/Linux) with custom output filters to list the name of each VPC network created for the selected GCP project:
gcloud compute networks list
--project=cc-project5-123123
--format="value(name)"
04 The command output should return the requested VPC network names:
cc-project5-network
cc-custom-vpc-network
05 Run compute networks subnets list command (Windows/macOS/Linux) with custom output filters to describe the identifier (i.e., full ID) of each subnet created for the specified VPC network:
gcloud compute networks subnets list
--network=cc-project5-network
--format="default(selfLink,privateIpGoogleAccess)"
06 The command output should return the requested subnet names. A private VPC subnet has the privateIpGoogleAccess attribute set to true, as shown in the example below:
---
privateIpGoogleAccess: true
selfLink: https://www.googleapis.com/compute/v1/projects/cc-project5-123123/regions/us-central1/subnetworks/cc-project5-subnet-001
---
privateIpGoogleAccess: true
selfLink: https://www.googleapis.com/compute/v1/projects/cc-project5-123123/regions/us-central1/subnetworks/cc-project5-subnet-002
---
privateIpGoogleAccess: false
selfLink: https://www.googleapis.com/compute/v1/projects/cc-project5-123123/regions/us-central1/subnetworks/cc-project5-subnet-003
07 Run compute routers list command (Windows/macOS/Linux) to describe the name of the Compute Engine router created for the specified VPC network. Cloud NAT uses Compute Engine routers to group NAT configuration information:
gcloud compute routers list
--project=cc-project5-123123
--filter="network:(cc-project5-network)"
--format="value(name)"
08 The command output should return the name of the requested Compute Engine router:
09 Run compute routers nats list command (Windows/macOS/Linux) to describe the Cloud NAT gateways deployed for the specified Compute Engine router, in the selected VPC network:
gcloud compute routers nats list
--region=us-central1
--router=cc-project5-router
--format="default(name,subnetworks)"
10 The command output should return the name and the associated VPC subnet of each NAT gateway deployed for your router:
---
name: cc-cloud-ai-nat-gateway
subnetworks:
- name: https://www.googleapis.com/compute/v1/projects/cc-project5-123123/regions/us-central1/subnetworks/cc-cloud-ai-subnet
sourceIpRangesToNat:
- ALL_IP_RANGES
---
name: cc-backend-nat-gateway
subnetworks:
- name: https://www.googleapis.com/compute/v1/projects/cc-project5-123123/regions/us-central1/subnetworks/cc-backend-subnet
sourceIpRangesToNat:
- ALL_IP_RANGES
A comparison of the subnet IDs provided in steps 6 and 10 will indicate whether Cloud NAT is enabled for your private VPC subnets. If no NAT gateway is associated with a private subnet listed in step 6, Cloud NAT is not enabled for that VPC subnet.
11 Repeat steps no. 5 - 10 for each VPC network created for the selected GCP project.
12 Repeat steps no. 3 – 11 for each GCP project available in your Google Cloud account.