---
title: "Getting started with Load Balancer on Public Cloud"
description: "Our Public Cloud Load Balancer is based on OpenStack Octavia and is fully integrated into the Public Cloud universe."
url: https://docs.us.ovhcloud.com/en/public-cloud/network-services/getting-started-load-balancer
lang: en
---
> For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt.

# Getting started with Load Balancer on Public Cloud

Our Public Cloud Load Balancer is based on [OpenStack Octavia](https://docs.openstack.org/octavia/queens/reference/introduction.html) and is fully integrated into the Public Cloud universe.

 

## Requirements

- A [Public Cloud project](https://docs.us.ovhcloud.com/en/public-cloud/cross-functional/create-a-public-cloud-project.md) in your OVHcloud account
- Understanding the [Load Balancer concepts](https://docs.us.ovhcloud.com/en/public-cloud/network-services/load-balancer-concepts.md)
- Understanding the [Public Cloud Networking concepts](https://docs.us.ovhcloud.com/en/public-cloud/network-services/networking-concepts.md)
- A Load Balancer requires a subnet; read the [Getting started with vRack](https://docs.us.ovhcloud.com/en/public-cloud/network-services/configure-vrack.md) guide for more information
- (Optional): This guide explains the load balancer configuration through the Graphical Interface & Command Line Interface. If you want to use the latter, then install the [OpenStack Command Line environment](https://docs.us.ovhcloud.com/en/public-cloud/cross-functional/compute-prepare-openstack-api-environment.md)

 

## Instructions

***

### OVHcloud Control Panel Access

- **Direct link:** [Public Cloud Projects](https://manager.us.ovhcloud.com/#/public-cloud/pci/projects/)
- **Navigation path:** `Public Cloud` > Select your project

***

 

### Creating the Load Balancer

#### Via the OVHcloud Control Panel

Click `Load Balancer` (under **Network**) in the left menu, then click the `Create a Load Balancer` button.
The configuration page will open.
**Step 1: Region choice**
1. **Select the zone type:&#x20;**&#x31;AZ, Deployment in a single availability zone.
2. **Choose the region:** Only regions where you have a private network and at least one subnet can be selected. Select the region and click `Next`.

**Step 2: Size choice**
The interface contains a link to the website on which the characteristics / benchmark of all size are provided. Once you have chosen your size, click `Next`.
**Step 3: Attach a public IP (or not)**
At this stage, you need to know if your Load Balancer will be receiving public traffic or not (for more details, read our [Public Cloud Networking concepts](https://docs.us.ovhcloud.com/en/public-cloud/network-services/networking-concepts.md) page).
If your Load Balancer is processing public traffic, you have two options:
- `New Public IP`: This option will create a new Floating IP for your Load Balancer.
- If you already have a Floating IP, the interface will offer you to pick one.

If your Load Balancer is processing private traffic, choose `No Public IP`.
**Step 4: Select the private network and the subnet where the Load Balancer will be spawned**
The interface will inform you if the private network / subnet is not compliant with the prerequisites (see [Public Cloud Networking concepts](https://docs.us.ovhcloud.com/en/public-cloud/network-services/load-balancer-concepts.md)).
**Step 5 (optional): Define the listener(s) and the members**
- First, choose the listener protocol & the port according to the traffic you will receive. Note that a specific listener called `Prometheus` is available to monitor your Load Balancer. In that case, it is not possible to add members. For more information on this listener, read the [Monitor your Public Cloud Load Balancer with Prometheus](https://docs.us.ovhcloud.com/en/public-cloud/network-services/loadbalancer-monitoring-prometheus.md) guide.
- Then, choose the Health Monitor type. Note that since some health monitor types are not compatible with some protocols, the user interface filters those types so that you can only choose compatible items. For more information on the health monitor compatibility, read the [Public Cloud Networking concepts](https://docs.us.ovhcloud.com/en/public-cloud/network-services/networking-concepts.md) guide.
- Finally, from the instances of your region, choose the member IP & port that will be part of the pool. Note that in order to simplify the configuration workflow, it is only possible to have a pool with the same protocol as the listener, and that the member can only be chosen from the instance. Those limitations can be bypassed by skipping this part of configuration and use the pool / member configuration once the Load Balancer is created.

**Note:** In order to simplify the Load Balancer configuration workflow, it is only possible to have a pool with the same protocol as the listener and the member can only be chosen from the instance. Furthermore the pool load balancing algorithm is by default set to `ROUND_ROBIN`.
Those limitations can be bypassed by skipping this part of configuration and use the pool / member configuration once the Load Balancer is created.

**Step 6: Define the name of Load Balancer**
You can update the name according to your choice and click on `Create a Load Balancer`.
You will be redirected to the Load Balancer listing page. Among the attributes that are displayed, the `Operating status` and `Provisioning status` provide information on the state of your load balancer. Find more information on the "[Load Balancer concepts](https://docs.us.ovhcloud.com/en/public-cloud/network-services/load-balancer-concepts.md)" page.

**Warning:** **NOTE:** On the Load Balancer listing page, you can delete your service by clicking the _more options_ `...` and choosing `Delete`.

#### Via the OpenStack CLI

Another way to create a Load Balancer is through the OpenStack Command Line Interface. Before you begin, consult the following guides:
- [Preparing an environment for using the OpenStack API](https://docs.us.ovhcloud.com/en/public-cloud/cross-functional/compute-prepare-openstack-api-environment.md).
- [Setting OpenStack environment variables](https://docs.us.ovhcloud.com/en/public-cloud/cross-functional/compute-set-openstack-environment-variables.md).

**Configuring your private network**
Before creating a Load Balancer, you will need to set up a private network:
```
openstack network create my_network
 
openstack subnet create my_subnet --subnet-range <my_private_ip_range/mask> --network my_network --no-dhcp
 
openstack router create my_router
 
openstack router add subnet my_router my_subnet
 
openstack router set --external-gateway Ext-Net my_router
```
You can now attach your instances to the new network. We recommend following our guide to [integrate an instance into vRack](https://docs.us.ovhcloud.com/en/public-cloud/network-services/configure-vrack.md).
List the addresses of your instances in your network with the following command:
```
openstack server list
```
In the next step, configure the network interfaces of your instances according to this output.
**Creating the Load Balancer**
You can view a list of the different Load Balancer flavors we offer with this command:
```
openstack loadbalancer flavor list
```
You can now create your Load Balancer with the following command. In this example, we will create a "Small" Load Balancer.
```
openstack loadbalancer create --name my_load_balancer --flavor small --vip-subnet-id my_subnet
```
Your Load Balancer will be configured with an IP address of the private network. If you want to have access from the internet, you will need to attach a Floating IP address.
**Attaching a Floating IP address to a Load Balancer**
This is how to attach a Floating IP address to a Load Balancer:
```
openstack floating ip create Ext-Net
openstack floating ip set --port <my_load_balancer_vip_port_id> <floating_ip>
```

**Note:** To retrieve the VIP port ID of your Load Balancer, use `openstack loadbalancer show my_load_balancer`.

**Configuring your Load Balancer**
In this example we will configure an HTTP Load Balancer. In order to listen on port 80 of the Load Balancer, create a Listener with this command:
```
openstack loadbalancer listener create --name my_listener_http --protocol HTTP --protocol-port 80 my_loadbalancer
```
Once the Listener has been created, you need to add each instance that can respond to external requests. To do this, you must create an Instance Pool:
```
openstack loadbalancer pool create --name my_pool_http --lb-algorithm ROUND_ROBIN --listener my_listener --protocol HTTP
```
Add your instances to the Instance Pool:
```
openstack loadbalancer member create --subnet-id my_subnet --address <private_ip_instance_1> --protocol-port 80 my_pool
openstack loadbalancer member create --subnet-id my_subnet --address <private_ip_instance_2> --protocol-port 80 my_pool
```
You can now access your Load Balancer via the Floating IP or private IP address from an instance in your private network.

#### Via the OVHcloud API

Use the OVHcloud API to create a Load Balancer programmatically.
**Retrieve available flavors**

[GET /cloud/project/{serviceName}/region/{regionName}/loadbalancing/flavor](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#get-/cloud/project/-serviceName-/region/-regionName-/loadbalancing/flavor)

**Create the Load Balancer**

[POST /cloud/project/{serviceName}/region/{regionName}/loadbalancing/loadbalancer](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#post-/cloud/project/-serviceName-/region/-regionName-/loadbalancing/loadbalancer)

```
{
  "flavorId": "<flavor_id>",
  "name": "my-load-balancer",
  "network": {
    "private": {
      "network": {
        "id": "<network_id>",
        "subnetId": "<subnet_id>"
      }
    }
  }
}
```
**Attach a Floating IP (for public traffic)**

[POST /cloud/project/{serviceName}/region/{regionName}/loadbalancing/loadbalancer/{loadBalancerId}/floatingIp](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#post-/cloud/project/-serviceName-/region/-regionName-/loadbalancing/loadbalancer/-loadBalancerId-/floatingIp)

**Create a listener**

[POST /cloud/project/{serviceName}/region/{regionName}/loadbalancing/listener](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#post-/cloud/project/-serviceName-/region/-regionName-/loadbalancing/listener)

```
{
  "loadbalancerId": "<loadbalancer_id>",
  "name": "my-listener",
  "port": 80,
  "protocol": "http"
}
```
**Create a pool**

[POST /cloud/project/{serviceName}/region/{regionName}/loadbalancing/pool](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#post-/cloud/project/-serviceName-/region/-regionName-/loadbalancing/pool)

```
{
  "algorithm": "roundRobin",
  "listenerId": "<listener_id>",
  "loadbalancerId": "<loadbalancer_id>",
  "name": "my-pool",
  "protocol": "http"
}
```
**Add members to the pool**

[POST /cloud/project/{serviceName}/region/{regionName}/loadbalancing/pool/{poolId}/member](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#post-/cloud/project/-serviceName-/region/-regionName-/loadbalancing/pool/-poolId-/member)

```
{
  "members": [
    { "address": "<private_ip_1>", "name": "member-1", "protocolPort": 80 },
    { "address": "<private_ip_2>", "name": "member-2", "protocolPort": 80 }
  ]
}
```

#### Via the OVHcloud CLI

Use the [OVHcloud CLI](https://github.com/ovh/ovhcloud-cli) to manage your Load Balancer. Set your cloud project with `--cloud-project <project_id>` or configure it in your profile.
**Create the Load Balancer**
```
ovhcloud cloud loadbalancer create <region> \
  --name my-load-balancer \
  --size small \
  --network-id <network_id> \
  --subnet-id <subnet_id>
```
**Attach a Floating IP (for public traffic)**
```
ovhcloud cloud loadbalancer create-floating-ip <loadbalancer_id>
```
**Create a listener**
```
ovhcloud cloud loadbalancer listener create <region> \
  --loadbalancer-id <loadbalancer_id> \
  --name my-listener \
  --port 80 \
  --protocol http
```
**Create a pool**
```
ovhcloud cloud loadbalancer pool create <region> \
  --loadbalancer-id <loadbalancer_id> \
  --listener-id <listener_id> \
  --name my-pool \
  --algorithm roundRobin \
  --protocol http
```
**Add members to the pool**
```
ovhcloud cloud loadbalancer pool member create <pool_id> \
  --address <private_ip_1> --name member-1 --protocol-port 80
ovhcloud cloud loadbalancer pool member create <pool_id> \
  --address <private_ip_2> --name member-2 --protocol-port 80
```

#### Via Terraform

Use the [OVHcloud Terraform provider](https://registry.terraform.io/providers/ovh/ovh/latest/docs/resources/cloud_project_loadbalancer) to create a Load Balancer with the `ovh_cloud_project_loadbalancer` resource.
**Retrieve available flavors**
```
data "ovh_cloud_project_loadbalancer_flavors" "flavors" {
  service_name = var.service_name
  region_name  = var.region
}
```
**Create the Load Balancer**
```
resource "ovh_cloud_project_loadbalancer" "lb" {
  service_name = var.service_name
  region_name  = var.region
  flavor_id    = data.ovh_cloud_project_loadbalancer_flavors.flavors.flavors[0].id
  name         = "my-load-balancer"
  network = {
    private = {
      network = {
        id        = var.network_id
        subnet_id = var.subnet_id
      }
    }
  }
}
```

 

## Go further

[Official documentation of OpenStack Octavia](https://docs.openstack.org/octavia/latest/)

[Cookbook OpenStack Octavia](https://docs.openstack.org/octavia/latest/user/guides/basic-cookbook.html)

Browse all the [Networking guides](https://docs.us.ovhcloud.com/en/public-cloud/network-services/landing-page-network-services.md).

Browse the rest of the [OVHcloud US documentation](https://docs.us.ovhcloud.com/en/index.md) for guides on our other products and services.

Learn more about [Public Cloud Network](https://us.ovhcloud.com/public-cloud/network/) on the OVHcloud US website.

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://us.ovhcloud.com/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.
