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,260 points
2,296 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


Hope this helps!!

If you need to know more about Google Cloud, It's recommended to go for Google Cloud architect certification course.

Thanks!

answered Aug 24, 2020 by MD
• 95,460 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
• 95,460 points
1,062 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
• 59,230 points
761 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 23, 2020 in GCP by MD
• 95,460 points
2,030 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
• 59,230 points
7,037 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
• 59,230 points
2,773 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
• 59,230 points
1,855 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
• 59,230 points
4,018 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
• 95,460 points
1,501 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 23, 2020 in GCP by MD
• 95,460 points
1,645 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP