Associate Cloud Engineer ยท VPC design and firewalls
VPC firewall rules: the building blocks
Implied rules, priority, direction, action, targets (all instances, network tags, service accounts), sources/destinations, protocols and ports, creating rules with gcloud.
Key points
- A rule has a direction (ingress or egress), an action (allow or deny), a priority (0-65535, default 1000, lower wins), targets (all instances, network tags or service accounts), a source or destination, and protocols/ports.
- Rules are stateful: return traffic of an allowed connection is allowed.
- With nothing matching, the implied rules deny ingress and allow egress.
Source: https://docs.cloud.google.com/vpc/docs/firewalls
Practice questions
In a network with no custom rules, what do the implied rules do?
- Deny ingress and allow egress
- Allow ingress and deny egress
- Allow both directions
- Deny both directions
Show answer
Answer: A. Deny ingress and allow egress
The implied behavior denies incoming and allows outgoing traffic. The reverse or symmetric options misstate this.
Which can be used as the target of a VPC firewall rule?
- All instances in the network
- Instances with a network tag
- Instances running as a given service account
- Instances of a given machine type
- Instances with a given label
Show answer
Answer: A. All instances in the network, B. Instances with a network tag, C. Instances running as a given service account
A rule can target all instances, network tags or service accounts. Machine type and labels are not target selectors.
A deny rule always beats an allow rule, regardless of their priorities.
Show answer
Answer: False
False. Priority decides first; deny wins over allow only when both have the same priority.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
