A Cloud Operations engineer is managing networking resources in a Google Cloud project. An existing Cloud NAT gateway named `prod-nat` is deployed on Cloud Router `prod-router` in region `us-central1` to provide internet access for selected subnets within the `prod-vpc` network. The Cloud NAT gateway is currently configured with manual subnet mapping (`--nat-custom-subnet-option=LIST_OF_SUBNETWORKS`). A new subnet named `analytics-subnet` has been created in `us-central1`. The engineer needs to update `prod-nat` to enable Outbound NAT for the primary IP range of `analytics-subnet` while preserving the NAT configuration for all existing subnets. Which `gcloud` command should the engineer execute to achieve this?
- Execute `gcloud compute routers nats update prod-nat --router=prod-router --region=us-central1 --add-subnetworks=analytics-subnet`Answer
- BExecute `gcloud compute routers nats update prod-nat --router=prod-router --region=us-central1 --nat-custom-subnet-option=analytics-subnet`
- CExecute `gcloud compute nats update prod-nat --router=prod-router --region=us-central1 --subnetworks=analytics-subnet`
- DExecute `gcloud compute networks subnets update analytics-subnet --region=us-central1 --enable-cloud-nat=prod-nat`
Answer
The correct action is to execute `gcloud compute routers nats update prod-nat --router=prod-router --region=us-central1 --add-subnetworks=analytics-subnet`.
Updating an existing Cloud NAT configuration to include an additional subnet while keeping existing mappings intact requires using `gcloud compute routers nats update` with the `--add-subnetworks` flag. This correctly appends the primary IP range of the specified subnet to the Cloud NAT configuration.
Step-by-Step Solution
Key Concept
Cloud NAT Subnet Mapping Management
Estimated Time:2m 0s