Show answerHide answer
Correct answer: B gcloud compute security policies rules update 1000 \ --security-policy hlr-policy \ -expression "evaluatePreconfiguredExpr('sourceiplist-fastly')" \ --action " allow"
Explanation
Explanation:The question asks how to allow traffic only from Fastly’s IP ranges into HRL’s VPC network through an External HTTP(S) Load Balancer. Since External HTTP(S) Load Balancers use Google Cloud Armor security policies for controlling traffic at the edge of the Google network, the correct solution involves updating the Cloud Armor security policy—not a VPC firewall rule.
Option B: gcloud compute security policies rules update 1000 \ --security-policy hlr-policy \ --expression "evaluatePreconfiguredExpr('sourceiplist-fastly')" \ --action "allow" ✅
Why it’s correct:
Cloud Armor security policies apply at the HTTP(S) load balancer level, making them ideal for filtering traffic before it reaches the backend VPC network.
The command uses the preconfigured expression evaluatePreconfiguredExpr('sourceiplist-fastly'), which references Google’s maintained list of Fastly IP ranges.
This expression automatically updates when Fastly changes their IP addresses, so HRL won’t need to manually maintain IP lists.
The rule priority 1000 ensures this rule is evaluated before other lower-priority rules.
The --action "allow" flag allows traffic from those IP ranges while implicitly denying others, satisfying the requirement of allowing only Fastly IP addresses.
The --security-policy hlr-policy argument ensures the change applies to the existing Cloud Armor security policy linked to the External HTTP(S) Load Balancer.
This approach provides centralized, scalable, and managed access control at the edge with minimal administrative overhead.
References:
Google Cloud Armor preconfigured rules
gcloud compute security-policies rules update
Google Cloud Armor overview
Why the other options are incorrect:
A. gcloud compute firewall rules update hlr-policy \ --priority 1000 \ target tags-sourceiplist fastly \ --allow tcp:443 ❌
VPC firewall rules are not used to filter traffic before it reaches the HTTP(S) Load Balancer.
The External HTTP(S) Load Balancer is a global service that terminates connections at the Google Front End (GFE) before traffic enters the VPC network.
Therefore, VPC firewall rules do not apply to traffic at the load balancer edge—only to backend instances inside the VPC.
Also, the command syntax is invalid (target tags-sourceiplist fastly is not a valid flag structure).
Reference:
Firewall Rules Overview
C. gcloud compute firewall rules update sourceiplist-fastly \ priority 1000 \ allow tcp:443 ❌
Again, this modifies a VPC-level firewall rule, which cannot control traffic to the load balancer frontend.
Even if correctly formatted, this rule would not restrict inbound requests to the load balancer but rather to backend instances.
The question specifically refers to traffic coming through the External HTTP(S) Load Balancer, making this command irrelevant.
Reference:
VPC Firewall Rules and Load Balancer Interaction
D. gcloud compute priority-policies rules update 1000 \ security policy from fastly --src-ip-ranges" --action "allow" ❌
This command syntax is invalid and does not match any gcloud command group.
There is no command group called priority-policies or a flag security policy from fastly.
The valid command structure must use gcloud compute security-policies rules update as in Option B.
Hence, this option is technically incorrect and syntactically invalid.
Reference:
gcloud compute security-policies documentation
References:
Google Cloud Armor: Security Policy Rules
Google Cloud SDK: compute security-policies rules update
External HTTP(S) Load Balancing Overview
Google Cloud Armor preconfigured expressions