Create a firewall rule on GCP Cloud from command line

+2 votes

Hi Guys,

I have created one VPC on GCP Cloud from the command line. I want to add one firewall rule to this VPC. Can anyone tell me how can I create a firewall rule from the command line?

Aug 24, 2020 in GCP by akhtar
• 38,120 points
171 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to configure GCP Cloud SDK in your command line. It will connect to your GCP Cloud API. After that, you can use the below command to create a firewall rule to your VPC.

$ gcloud compute --project=nadeem-gcp-123456 firewall-rules create NAME --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=PROTOCOL:PORT
answered Aug 24, 2020 by MD
• 94,990 points

Related Questions In GCP

0 votes
1 answer
+2 votes
1 answer

How to launch one instance on GCP Cloud from command line?

Hi@akhtar, You can compute service in GCP to launch ...READ MORE

answered Aug 24, 2020 in GCP by MD
• 94,990 points
90 views
+1 vote
1 answer

Create a Cloud Filestiore instance on GCP.

You could create a cloud filestore instance ...READ MORE

answered Nov 22, 2019 in GCP by Sirajul
• 58,950 points
126 views
+2 votes
1 answer

How to create a project from GCP Cloud Shell?

Hi@akhtar, GCP shell has a command named gcloud. ...READ MORE

answered Aug 22, 2020 in GCP by MD
• 94,990 points
93 views
0 votes
1 answer

Does Google cloud platform (GCP) offer IaaS ? Or just PaaS?

GCP provides IaaS as well, although it ...READ MORE

answered Sep 20, 2019 in GCP by Sirajul
• 58,950 points
2,273 views
0 votes
1 answer

How do I create a Google Cloud Platform (GCP) account?

In order to access the services provided ...READ MORE

answered Sep 20, 2019 in GCP by Sirajul
• 58,950 points
1,370 views
0 votes
1 answer

How do I create a VPCN (Virtual private cloud network) on Google Cloud?

You can connect various GCP resources to each ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 58,950 points
430 views
0 votes
1 answer

Cloud SQL of google cloud is IaaS or PaaS?

Cloud SQL is PAAS (Plaform As A ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 58,950 points
1,010 views
+2 votes
1 answer

How to create a VPC on GCP from command line?

Hi@akhtar, To create a personal network, you need ...READ MORE

answered Aug 24, 2020 in GCP by MD
• 94,990 points
137 views
+2 votes
1 answer

How to create a firewall rule in GCP Cloud?

Hi@akhtar, If you are using the default VPC ...READ MORE

answered Aug 22, 2020 in GCP by MD
• 94,990 points
103 views