gcloud compute firewall-rules create allow-http --allow tcp:80,tcp:443 --target-tags http-server

Category: Google Cloud & Workspace

gcloud compute firewall-rules create allow-http --allow tcp:80,tcp:443 --target-tags http-server

Create a firewall rule allowing web traffic

Opens inbound TCP ports 80 and 443 for every VM carrying the http-server network tag, which you set with --tags when creating instances. Without --target-tags the rule applies to all instances in the network, so tags keep exposure narrow. Delete it with gcloud compute firewall-rules delete, and remember the OS-level firewall must also permit the port.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.