How to open a specific port such as 9090 in Google Compute Engine

前端 未结 8 2030
孤独总比滥情好
孤独总比滥情好 2020-11-22 13:15

I have 2 Google Compute Engine instances and I want to open port 9090 in both the instances. I think we need to add some firewall rules.

Can you tell me how can I

8条回答
  •  庸人自扰
    2020-11-22 13:43

    Here is the command-line approach to answer this question:

    gcloud compute firewall-rules create  --allow tcp:9090 --source-tags= --source-ranges=0.0.0.0/0 --description=""
    

    This will open the port 9090 for the instances that you name. Omitting --source-tags and --source-ranges will apply the rule to all instances. More details are in the Gcloud documentation and the firewall-rule create command manual

    The previous answers are great, but Google recommends using the newer gcloud commands instead of the gcutil commands.

    PS: To get an idea of Google's firewall rules, run gcloud compute firewall-rules list and view all your firewall rules

提交回复
热议问题