# Set Up GCP Load Balancer

{% hint style="info" %}
[Related video: Reblaze via Google Marketplace: Routing Traffic](https://www.youtube.com/watch?v=1KItI-YyVFA\&list=PL6cxA-Fe3c47lxm_aCjgngSU4seOUM5Er\&index=4).                                     This video includes explanations for [Set UP GCP Health Checks](https://waap.docs.link11.com/v2.18/marketplace-onboarding/gcp/set-up-gcp-health-checks) (previous topic) and for Set Up GCP Load Balancers (this topic).
{% endhint %}

{% hint style="info" %}
It is beyond the scope of this document to describe all the possible load balancer settings. More information about Google’s load balancing can be found at <https://cloud.google.com/compute/docs/load-balancing/>. If you have any questions, feel free to contact us at <support@reblaze.com>.
{% endhint %}

Once you set up the load balancers (LB), traffic will be routed through them to Reblaze. Using these load balancers allows GCP to create more instances as needed to handle the traffic.

{% hint style="warning" %}
For most most use cases, you will need to set up two load balancers, one for HTTP and one for HTTPS. The following steps assume that you will be setting up two load balancers.\
Therefore, the processes described here will be done **twice**, with some addition steps for HTTPS. The differences between the setup for the HTTP LB and the setup for the HTTPs LB will be noted.&#x20;
{% endhint %}

1. First, set up a load balancer and choose the **HTTP** protocol for the backend service as follows:
   1. [Create an HTTP or HTTPS load balancer](#create-a-load-balancer)
   2. [Create the backend service](#create-the-backend-service)
   3. [Select host and path rules](#select-host-and-path-rules)
   4. [Select frontend configuration](#select-frontend-configuration)
   5. [Complete the load balancer creation process](#complete-the-load-balancer-creation-process)<br>
2. When an HTTPS ( port 443 ) is required, create an additional load balancer and choose the **HTTPS** protocol. The steps for this are the same as creating an HTTP LB, with additional steps within the frontend configuration process.
3. After you have created the required load balancers, return to the main [GCP](https://waap.docs.link11.com/v2.18/marketplace-onboarding/gcp/broken-reference) section for the final steps needed to get Reblaze running on your website.

### Create a Load Balancer

1. In your [Google Cloud Platform Console](https://console.cloud.google.com/networking/loadbalancing), select **Navigation menu** ![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2Ft0pTdiVNYFkNGbjyAv2F%2Fimage.png?alt=media\&token=bffcee76-1ea4-4a3e-a6ea-45ccbf61b76a)> **Network services** > **Load Balancing**.

![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2FvaBr28q5loWMGzgmYBZ3%2Fimage.png?alt=media\&token=1845fb78-e311-48b7-b6bf-b56072febff4)

2\. Click **Create load balancer**.

3\. Click **Start configuration** for the appropriate type:

* The HTTP(S) load balancer supports ports 80, 8080, and 443, (including HTTP and HTTPS) and is the appropriate type for most Reblaze customers.

![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2FqEm5Smz11h8QlpFRYofq%2Fimage.png?alt=media\&token=ca78389c-5c54-4b1d-9274-774fc5d7e78d)

&#x20;    If you need non-standard ports, then use the TCP load balancer instead.

4\. You will now be asked whether this load balancer is for **Internet facing or internal only.**\
&#x20;     Select **From Internet to my VMs** and click **Continue**.\
&#x20;    The load balancer creation page appears.

![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2FSoxutkWC5KgNhy9N38Ro%2Fimage.png?alt=media\&token=5d9e59c9-9e3c-414b-905e-cf122e228096)

5\. Enter a name for the load balancer.\
&#x20;   We recommend that you include the protocol of this load balancer as part of the name (HTTP or      HTTPS), for example, LB1-http or LB2-https.

Continue to the section below: Create the Backend Servic&#x65;**.**

### Create the Backend Service

1. From the New load balancer panel on the current page, select **Backend configuration** > **Create or select backend services & backend buckets** > **Backend services** > **Create a backend service**.\
   ![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2F7NYjUHmqxwIQWT3R7zt5%2Fimage.png?alt=media\&token=74915bb9-4bf4-4685-92bb-a3f24c308791)
2. Enter a name for the backend service.\
   We recommend that you include the protocol of this load balancer as part of the name (HTTP or HTTPS), \
   for example, BE1-http or BE2-https.
3. Select either **HTTP** or **HTTPS** for **Protocol** and **Named port**, depending on which protocol you are creating the LB for.\
   &#x20;![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2Fqh038MLfpIpd8USa9hlS%2Fimage.png?alt=media\&token=d24b1301-37ea-4599-b2af-f0f44d867cd4)
4. In the **New backend** fields:.
   1. Select the **Instance group** that was created when you deployed Reblaze in GCP. The same instance group can be used for both HTTP and HTTPS.
   2. In the **Instance group has named ports** popup, make sure to select the correct port for each protocol (80 or 443). 80 is the default value.
   3. Click **Use selected port name**
   4. Select the Port numbers. Make sure that the port number selected matched the protocol that this LB is for.
   5. For **Balancing mode**, select **Rate**, and enter **1000000** for **Maximum RPS.**\
      This ensures that all servers stay available during a traffic spike unless a health check indicates otherwise.
   6. Click **Done** for **New backend**.
5. (optional) Enable **Google Cloud CDN.**
6. Select the **Health check** that you [previously created](https://waap.docs.link11.com/v2.18/marketplace-onboarding/gcp/set-up-gcp-health-checks) for this protocol. \
   Make sure to use the matching health check that was created for the load balancer you are now creating (HTTP or HTTPS).
7. Review the remaining values on the page to see that they are appropriate for your application environment.
8. Click **Create** for the backend service.

### Select Host and Path Rules

From the Edit load balancer panel on the current page, select **Host and path rules**.\
&#x20;![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2FJIy6qIYzgpmssswixgkF%2Fimage.png?alt=media\&token=103c1628-0908-446d-bc87-ce67d7216f29)

A default host and path rule has already been created. Additional rules are optional.

### Select Frontend Configuration

1. From the Edit load balancer panel on the current page, select **Frontend configuration**.\
   &#x20;![](https://1443104804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYa27AYz47cZTEzJZB1vy%2Fuploads%2FuKgLoawNUkC5cwxlRAW6%2Fimage.png?alt=media\&token=84617391-4cc9-40f9-a4fe-e33156db3817)
2. Enter a name for the frontend.\
   We recommend that you include the protocol of this load balancer as part of the name (HTTP or HTTPS), \
   for example, FE1-http or FE2-https.
3. For **Protocol**, select the protocol that was created for the load balancer you are now creating (HTTP or HTTPS). HTTP is the default value.
4. For most use cases, you will want to reserve a static IP address.

   If this is the first load balancer you are creating (usually HTTP), for **IP address** do the following:

   1. Select **Create IP address.**
   2. &#x20;In the **Reserve a new static IP address** dialog, enter a name. \
      The name for this IP address should not have the protocol embedded within it, since it will be the same for all load balancers that you create.
   3. Click **Reserve**.\
      GCP will reserve an IP address and it will now appear in the IP address field in the frontend configuration panel.\
      **Tip**: Make a note of the IP address provided by GCP. You will need it later at the end of the configuration process.

   If this is an additional LB (usually HTTPS):

   * For **IP address**, select the IP address previously created for the first LB.
5. **HTTPS only**: If this load balancer is for HTTPS, you need to add or create a SSL certificate.
   1. For **Certificate**, select **Create a new certificate**.
   2. Enter a name for the certificate.
   3. You can either use a certificate you already have, or create a new one:
   4. To use an existing certificate:
      * Enter the certificate information.
      * Click **Create** for the certificate..
   5. To create a Google-managed certificate:
      * Select **Create Google-managed certificate**.
      * Enter the domains to which this certificate will apply.\
        Multiple domains can be entered.
      * Click **Create** for the certificate.
6. Click **Done** in the **Frontend configuration** panel.

### Complete the Load Balancer Creation Process

* Once you have completed all the required components for the load balancer, click **Create** in the Load balancer panel.\
  The load balancer is then created. \
  The IP address provided is the destination for your website traffic.
