Wednesday, December 10, 2014

Google Cloud Compute Engine HTTP and HTTPS Traffic to a Load Balancer

So....

I had the problem of getting HTTP and HTTPS traffic to resolve to the same domain with my servers in Googles Cloud.  Seems pretty simple at first (or if you use someone like Rackspace), but unfortunately it is not terribly straight forward.

So here is the write up to solve your problem and avoid calling Googles Support line.

1) Create a static IP address but don't assign it to anything.
2) Using the command line tools gcloud, create 2 firewall rules
3) The first firewall rule should be for port 80
4) The second firewall rule should be for port 443

The trick is that when you set up these firewall rules, you need to assign them to the static IP address you created in the first step.  Lets pretend you have a new external IP address of 1.2.3.4   You would build your firewall rules like so:

gcloud compute forwarding-rules create rule-name-www --port-range 80 --region us-central1 --target-pool pool-of-vms --address 1.2.3.4

gcloud compute forwarding-rules create rule-name-ssl --port-range 443 --region us-central1 --target-pool pool-of-vms --address 1.2.3.4

And boom!  You have it.

I'm sure this could be more robust, but I have more servers to spin up.  So off I go.  #NeverStopLearning

1 comment:

  1. Very informative and useful post and thanks for your informative post
    Yahoo Helpline Number.

    ReplyDelete