1

I have one website and one api server on different instances:

  • Is it possible to serve both of them through the same HTTP load balancer?
  • Is there a down side to doing this vs. 2 load balancers?

I went over these:

1 Answer 1

2

It is possible to serve both of them from the same HTTP load balancer (LB) by creating

  • A backend (API) for the instance serving the API.
  • A backend (WEB) for the instance serving the Website.
  • An entry in the LB URL map matching the API requests with the API backend.
  • An entry in the LB URL map matching the web requests with the WEB backend.

The URL map can be configured from Developers Console or by using gcloud command as describe in step 7 of "Send traffic to your instances" section at Google Content-Based Load Balancing example. Every time an HTTP request arrives to your LB, it will check its URL map and dispatch it to the right backend.

Apart from duplicated configuration and number of external IPs, the difference between using one or two LBs is pricing as describe in "Load Balancing and Protocol Forwarding" section here. You can use the Google Cloud Platform Pricing Calculator to see how much would you pay depending on the number of LBs.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.