Remember_me
Remember_me

Reputation: 283

Is it possible to load balance several services using the same HTTP load balancer in GCE?

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

I went over these:

Upvotes: 1

Views: 564

Answers (1)

Antxon
Antxon

Reputation: 1943

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.

Upvotes: 2

Related Questions