You must specify a name when creating a LoadBalanacer part. Some backends will use this as a unique id for the load balancer. Take care to avoid duplicating load balancer names in different configurations!

The driver section contains the settings used by libcloud to initialize a driver. This typically includes account information - a access key and secret, a username and password, or similar.

You must specify a port for the load balancer to listen on.

The load balancer needs to know what protocol it is balancing. For example, if it is handling SSL connections it can act as an SSL terminator but to do this it needs to know it is an SSL protocol. Not all balancers support all protocols, and Yaybu doesn’t expose SSL support at the moment. You can set protocol to one of:

http

https

tcp

ssl

Some load balancers let you choose an algorithm. This is the method by which the load balancer distributes traffic. It can be one of:

random

Incoming connections are assigned to a backend at random

round-robin

Incoming connections are passed to a backend in a circular fashion without any considering of priority.

least-connections

Incoming connections are passed to the backend with the least number of active connections with the assumption that it must have the most free capacity.

weighted-round-robin

Same as round-robin, but also factors in a weight factor for each member

weighted-least-connections

Same as least-connections, but also factors in a weight factor for each member

The members input is a list of all compute resources that load will be spread over. There are a few variations here.

If you are doing load balancing for port 80 and forwarding to port 80 on the backend VM’s then you can:

Not all backends support this, and an error will be raised before deployment starts if it is not.

There are 2 main types of cloud load balancer. The first accepts IP addresses and ports. If you pass a Compute node to this type of load balancer Yaybu will determine it’s IP automatically. But you can pass ip addresses manually:

new LoadBalancer as lb:
<snip>
members:
- ip: 192.168.0.1
port: 8080

Other load balancers expect to be give a list of compute instance ids. Again, Yaybu will do the right thing if given Compute parts. But you can also give it id values directly: