How To Get Started With Google Cloud Platform’s Global Load Balancing

0
266

Much like AWS, Google offers managed load balancing as a service, helping to distribute traffic across multiple servers. On Google’s Premium Network tier, there’s also Global Load Balancing, which uses a single IP across all regions.

What Is Global Load Balancing?

Load Balancers are network device which allows horizontal scaling, basically making multiple servers respond as one big server by splitting traffic between them. This also has the benefit of ensuring high availability, as the crash of any single application server should not tank the whole cluster or affect the availability of your application.

Usually, you’ll need a separate Load Balancer for each region, and that’s how it works on Google’s standard network tier. However, on their premium network tier, you only need one load balancer which can be used to balance traffic across the globe. This load balancer only needs a single anycast IP, so you won’t have to mess about with DNS geo-routing. Users sent to your IP address will automatically be routed to the closest location.

Google is a massive company, and actually owns a lot of the physical internet. Their premium network tier routes traffic using only a Google controlled network, only exiting into the clearnet close to the user for final routing. Control of most of the transport chain allows for global-level features like Global Load Balancing, and Global CDNs.

Setting Up A Load Balancer

From the Network Services Console, create a new load balancer.

Set the load balancer to be internet facing, unless it’s for an internal service.

Load balancers consist of a few things—a backend configuration, a frontend configuration, and routing rules.

The backend configuration tells the load balancer where to balance traffic between. This can be a Cloud Storage bucket, or a

Unless you have an autoscaling instance group already, click “Create more instance groups.”

You don’t actually have to set up autoscaling. If you want to manage the instances yourself, choose “Unmanaged instance group,” and select any number of VM instances.

You’ll need to set up a health check, for which the default configuration is likely fine. If you need to set up multiple regions, you’ll need multiple “Backends.” The configuration is the same.

You can also set up Cloud CDN, or other advanced features like Session affinity, which will keep users connected to the same server for their whole session.

For the next step, you can set up any complex routing rules. By default, all traffic will be routed to the backends you set up, but you can route different paths to separate backends. For example, if you want to store static content in a Cloud Storage bucket, your can set up a backend using that bucket specifically for the /images path.

For the frontend configuration, you’ll want to set the protocol to HTTPS, and switch the IP address type from Ephemeral to Static, which you can use with your DNS.

You’ll of course need an SSL certificate—you can create your own from Google, or upload one manually.

Click Review, and then create your load balancer. It should start working within a few minutes.