Add a port forwarding rule on a specific VM instance

0 votes
I want to add a port forwarding rule on a specific VM instance. How to do this?
Nov 11, 2019 in GCP by anonymous
• 6,260 points
2,978 views

1 answer to this question.

0 votes

To add a new forwarding rule, you can use the gcloud compute forwarding-rules create command or create a HTTP POST request to the Forwarding Rules collection. 

An example of creating a forwarding rule to a target instance using the gcloud command-line tool is:

gcloud compute forwarding-rules create [FORWARDING_RULE] \
    --load-balancing-scheme internal | external \
    --region [REGION] \
    [--target-instance-zone [ZONE]] \
    --ip-protocol TCP --ports 80 \
    --target-instance [TARGET_INSTANCE]

If you omit the --target-instance-zone flag, the gcloud command-line tool prompts you to choose a zone if you did not set the compute/zone property with gcloud config set compute/zone. 

The gcloud compute forwarding-rules create command supports setting a target instance as a target when the load balancing scheme is internal.

answered Nov 11, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Creating a SQL Server instance using Google Compute engine.

Google Compute Engine provides public images preconfigured with ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 59,230 points
2,899 views
0 votes
1 answer
0 votes
1 answer

How do i install gcloud compute?

The gcloud compute command-line tool enables you to easily ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 59,230 points

edited Jun 16, 2023 by Khan Sarfaraz 1,248 views
0 votes
1 answer

How to add a PTR record to my VM instance on gcp?

If your VM instance uses the primary ...READ MORE

answered Sep 26, 2019 in GCP by Sirajul
• 59,230 points
1,853 views
0 votes
1 answer

How to add a regional persistent disk to a VM instance on GCP?

You must first create the regional persistent ...READ MORE

answered Oct 18, 2019 in GCP by Sirajul
• 59,230 points
2,731 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