Google Cloud VPC firewall rules are evaluated in order of priority, where a lower numeric value indicates higher precedence. Every VPC network also has an implied allow-all-egress rule at priority 65535. To minimize open egress ports, you should create a high-priority rule (priority 1000, which is evaluated first) that explicitly allows only the specific ports required by the application, combined with a low-priority rule (priority 65534) that denies all other egress traffic. Because the allow rule at priority 1000 is evaluated before the deny rule at priority 65534, only the specified ports remain open, while the deny rule blocks everything else that isn't explicitly permitted, effectively overriding the network's implied allow-all-egress default and enforcing least-privilege network access.
Community Discussion