Question

Difficulty: MediumManaging Networking Resources

An operations team needs to update the network configuration for a custom subnet named `prod-analytics-subnet` located in region `us-east1` within the Virtual Private Cloud (VPC) network `corp-vpc`. The requirements are:

1. Enable VPC Flow Logs on `prod-analytics-subnet` with an aggregation interval set to 5 seconds (`INTERVAL_5_SEC`).
2. Update the existing Cloud NAT service named `nat-config-east` on Cloud Router `nat-router-east` so that `prod-analytics-subnet` is included to provide outbound internet access for private virtual machines using automatically allocated external IP addresses.

Which TWO `gcloud` CLI commands must the team run to satisfy these operational requirements?

  1. `gcloud compute networks subnets update prod-analytics-subnet --region=us-east1 --enable-flow-logs --logging-aggregation-interval=INTERVAL_5_SEC`Answer
  2. B
    `gcloud compute networks subnets expand-ip-range prod-analytics-subnet --region=us-east1 --enable-flow-logs --logging-aggregation-interval=INTERVAL_5_SEC`
  3. `gcloud compute routers nats update nat-config-east --router=nat-router-east --region=us-east1 --auto-allocate-nat-external-ips --add-subnetworks=prod-analytics-subnet`Answer
  4. D
    `gcloud compute firewall-rules create allow-nat-egress --network=corp-vpc --direction=INGRESS --priority=1000 --action=ALLOW --rules=tcp:80,443`

Answer

The two correct commands are `gcloud compute networks subnets update prod-analytics-subnet --region=us-east1 --enable-flow-logs --logging-aggregation-interval=INTERVAL_5_SEC` and `gcloud compute routers nats update nat-config-east --router=nat-router-east --region=us-east1 --auto-allocate-nat-external-ips --add-subnetworks=prod-analytics-subnet`.
To manage Google Cloud networking resources effectively, enabling or modifying VPC Flow Logs on an existing subnet requires running `gcloud compute networks subnets update` with the `--enable-flow-logs` flag and setting `--logging-aggregation-interval=INTERVAL_5_SEC`. To attach a subnet to an existing Cloud NAT configuration without replacing current settings, `gcloud compute routers nats update` must be used with the `--add-subnetworks` flag along with required parameters such as `--router` and `--region`.

Step-by-Step Solution

1
Identify the proper gcloud command to modify subnet settings for logging.
Use `gcloud compute networks subnets update` with `--enable-flow-logs` and `--logging-aggregation-interval=INTERVAL_5_SEC`.
VPC Flow Logs properties on existing subnets are altered using the subnet update command group.
2
Identify the proper gcloud command to add a subnet to an existing Cloud NAT gateway.
Use `gcloud compute routers nats update` targeting the NAT gateway, specifying `--router`, `--region`, `--auto-allocate-nat-external-ips`, and `--add-subnetworks=prod-analytics-subnet`.
Cloud NAT operates on top of Cloud Routers, so adding subnet mapping requires modifying the NAT configuration on the associated Cloud Router.

Key Concept

Managing VPC Subnet Settings and Cloud NAT Resources
Estimated Time:1m 30s
Rate this question