# What is Load balancing?

A load balancer gives your instances one address and spreads incoming connections or requests across them, leaving out the ones that fail their health check.

You create load balancers under **Load balancers** in the Deutsche Cloud Console. Each one lives in one
region. An instance target must be in that region; an IP target is any address its type accepts.

## When to use it

- Several instances serve the same website or API, and clients should reach them at one address
  or name that stays the same while instances come and go.
- An instance that stops answering should stop receiving traffic without anyone changing DNS.
- You want TLS ended in front of your instances with a certificate Deutsche Cloud issues and renews.

## The four kinds of load balancer

The type is chosen at creation and cannot be changed. The types behave very differently; see
[Load balancer types](load-balancer-types.md).

| Type                   | What it is                                                                                                                                                                                                                                                                   |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `lb11`, `lb21`, `lb31` | A network load balancer at the infrastructure provider, in three sizes: tcp, http and https on any port, targets reached over the internet or a VPC.                                                                                                                         |
| `application`          | HTTP and HTTPS on the region's shared Deutsche Cloud fleet: its own name at once, host and path rules, a web ACL, live numbers and an access log. Ports 80 and 443; targets at public addresses, except instances in an organization whose load balancers run on its own hosts. |
| `dedicated`            | Its own address on the Deutsche Cloud fleet: tcp, http and https on any port, public (its own IPv4 and IPv6) or private (addresses in one VPC only).                                                                                                                            |

## Concepts

| Term          | Meaning                                                                                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Load balancer | Has a name, a type, an algorithm, a region and, once placed, its addresses. It starts with no services and no targets.                                  |
| Service       | One listener: a protocol (`tcp`, `http`, `https`), the port the load balancer listens on, the port on the targets it forwards to, and the health check. |
| Target        | An instance of your organization (`server`) or an IP address (`ip`) that receives the traffic.                                                          |
| Health check  | The probe a service runs against each target; see [Health checks](health-checks.md).                                                                    |
| Algorithm     | `round_robin` sends each new connection to the next target; `least_connections` to the least busy. Fixed at creation.                                   |
| Target group  | `application` only: a named set of targets that host and path rules forward to. Targets without one are in `default`.                                   |
| Rule          | `application` only: requests matching a host and path prefix go to a target group. See [Route requests by host and path](route-by-host-and-path.md).    |

## Pricing

Every type is metered per started hour, up to a monthly price per load balancer:

- `lb11`, `lb21`, `lb31`: from when the provider has it until it is deleted, up to the type's
  monthly price. The create form shows the estimate for the type you pick; whether it is charged
  depends on your installation's pricing.
- `application`: €4.99 a month at most (`lb.application.hour`), while it is active on the fleet.
  1 TB of traffic a month is included.
- `dedicated`: €6.99 a month at most (`lb.dedicated.hour`), public and private alike. A dedicated
  load balancer that is the endpoint of one of your databases is part of that database's price.

## Interfaces

- The Deutsche Cloud Console: **Load balancers**.
- The CLI: `dcloud lb load-balancers`, `dcloud lb services`, `dcloud lb targets` and
  `dcloud lb rules`.
- The API under `/lb/api`; see the _API Reference_.
- Terraform: `dcloud_lb`, `dcloud_lb_service`, `dcloud_lb_target` and
  `dcloud_lb_rule`.

## Next steps

- [Get started with an application load balancer](getting-started.md)
- [Load balancer types](load-balancer-types.md)
- [Create a load balancer](create-a-load-balancer.md)
