A system administrator needs to restrict outbound network connections from Compute Engine instances with the network tag `database-node` in a custom Virtual Private Cloud (VPC) named `production-vpc`. The requirement specifies blocking all egress traffic originating from these instances to a legacy external IP address `198.51.100.50/32`, while taking precedence over standard default rules. Which `gcloud` command correctly implements this security requirement?
- gcloud compute firewall-rules create deny-db-outbound --network=production-vpc --direction=EGRESS --action=DENY --rules=all --destination-ranges=198.51.100.50/32 --target-tags=database-node --priority=500Answer
- Bgcloud compute firewall-rules create deny-db-outbound --network=production-vpc --direction=EGRESS --action=DENY --rules=all --destination-ranges=198.51.100.50/32 --target-tags=database-node --priority=65534
- Cgcloud compute firewall-rules create deny-db-outbound --network=production-vpc --direction=INGRESS --action=DENY --rules=all --source-ranges=198.51.100.50/32 --target-tags=database-node --priority=500
- Dgcloud compute firewall-rules create deny-db-outbound --network=production-vpc --direction=EGRESS --action=DENY --rules=all --source-ranges=198.51.100.50/32 --target-tags=database-node --priority=500
Answer
The correct command executes `gcloud compute firewall-rules create deny-db-outbound --network=production-vpc --direction=EGRESS --action=DENY --rules=all --destination-ranges=198.51.100.50/32 --target-tags=database-node --priority=500`.
The correct command uses `--direction=EGRESS` with `--destination-ranges=198.51.100.50/32` to block outbound connections from instances matching `--target-tags=database-node`. Choosing `--priority=500` ensures this custom rule takes precedence over default rules because GCP evaluates lower priority numbers first.
Step-by-Step Solution
Key Concept
GCP VPC Egress Firewall Rules and Priority Precedence