A Cloud Operations engineer is managing Virtual Private Cloud (VPC) networking resources in Google Cloud. The engineer needs to route all outbound traffic destined for a third-party vendor's network range through an existing custom gateway Virtual Machine instance named `gateway-instance-1` located in zone `us-east1-b`. The target VPC network is named `enterprise-vpc`. Which `gcloud` command should the engineer execute to correctly configure this routing resource?
- gcloud compute routes create vendor-route --network=enterprise-vpc --destination-range=198.51.100.0/24 --next-hop-instance=gateway-instance-1 --next-hop-instance-zone=us-east1-bAnswer
- Bgcloud compute routes create vendor-route --vpc=enterprise-vpc --destination-cidr=198.51.100.0/24 --next-hop-vm=gateway-instance-1 --region=us-east1
- Cgcloud compute firewall-rules create vendor-route --network=enterprise-vpc --direction=EGRESS --action=ALLOW --destination-ranges=198.51.100.0/24 --priority=1
- Dgcloud compute networks subnets update enterprise-vpc --add-secondary-ranges=vendor-route=198.51.100.0/24 --next-hop-instance=gateway-instance-1
Answer
Execute the command `gcloud compute routes create vendor-route --network=enterprise-vpc --destination-range=198.51.100.0/24 --next-hop-instance=gateway-instance-1 --next-hop-instance-zone=us-east1-b` to create a custom static route in the VPC network targeting the gateway instance.
Creating a static route via `gcloud compute routes create` with `--destination-range`, `--network`, `--next-hop-instance`, and `--next-hop-instance-zone` correctly directs packets targeting to the specified VM instance in the target VPC network.
Step-by-Step Solution
Key Concept
Managing Custom VPC Routes with gcloud CLI
Estimated Time:2m 0s