> For the complete documentation index, see [llms.txt](https://docs.glesys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glesys.com/products/connectivity/load-balancer/how-tos/create-a-tcp-load-balancer.md).

# Create a TCP load balancer

***

## Create a TCP load balancer using the control panel

It is also possible to load balance TCP traffic that is not HTTP, such as PostgreSQL servers.

To set up a load balancer for TCP, create a new listener and select *tcp* under *Mode*. Enter the TCP port the listener should listen on. Then, add the targets and their TCP ports.

In the example below, we use PostgreSQL servers behind the load balancer.

<figure><img src="/files/mDB4hPk6FC026n2XlHPD" alt=""><figcaption></figcaption></figure>

## Create a TCP load balancer using the API

1. Use the [loadbalancer/create endpoint](https://github.com/GleSYS/API-docs/wiki/API-Documentation#loadbalancercreate) in the API to create a load balancer.&#x20;
2. To add a listener to the load balancer, use the [loadbalancer/addfrontend endpoint](https://github.com/GleSYS/API-docs/wiki/API-Documentation#loadbalanceraddfrontend).
3. To add a target (server) to the load balancer, use the [loadbalancer/addbackend endpoint](https://github.com/GleSYS/API-docs/wiki/API-Documentation#loadbalanceraddbackend).
4. To add a certificate to the listener for SSL traffic, use the [loadbalancer/addcertificate endpoint](https://github.com/GleSYS/API-docs/wiki/API-Documentation#loadbalanceraddcertificate).

Additional load balancer endpoints are available in the [loadbalancer module](https://github.com/GleSYS/API-docs/wiki/API-Documentation#loadbalancer-module).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.glesys.com/products/connectivity/load-balancer/how-tos/create-a-tcp-load-balancer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
