POST /load_balancers
Creates a Load Balancer.
Call specific error codes
Code | Description |
---|---|
cloud_resource_ip_not_allowed | The IP you are trying to add as a target belongs to a Hetzner Cloud resource |
ip_not_owned | The IP is not owned by the owner of the project of the Load Balancer |
load_balancer_not_attached_to_network | The Load Balancer is not attached to a network |
robot_unavailable | Robot was not available. The caller may retry the operation after a short delay. |
server_not_attached_to_network | The server you are trying to add as a target is not attached to the same network as the Load Balancer |
source_port_already_used | The source port you are trying to add is already in use |
missing_ipv4 | The server that you are trying to add as a public target does not have a public IPv4 address |
target_already_defined | The Load Balancer target you are trying to define is already defined |
Servers
- https://api.hetzner.cloud/v1
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
load_balancer_type |
String | Yes |
ID or name of the Load Balancer type this Load Balancer should be created with |
public_interface |
Boolean | No |
Enable or disable the public interface of the Load Balancer |
network |
Integer | No |
ID of the network the Load Balancer should be attached to on creation |
name |
String | Yes |
Name of the Load Balancer |
algorithm |
Object | No |
Algorithm of the Load Balancer Default value: { "type": "round_robin" } |
algorithm.type |
String | Yes |
Type of the algorithm. Possible values:
Default value: "round_robin" |
labels |
Object | No |
User-defined labels ( |
location |
String | No |
ID or name of Location to create Load Balancer in |
services[] |
Array | No |
Array of services |
services[].destination_port |
Integer | Yes |
Port the Load Balancer will balance to |
services[].proxyprotocol |
Boolean | Yes |
Is Proxyprotocol enabled or not |
services[].health_check |
Object | Yes |
Service health check |
services[].health_check.port |
Integer | Yes |
Port the health check will be performed on |
services[].health_check.interval |
Integer | Yes |
Time interval in seconds health checks are performed |
services[].health_check.protocol |
String | Yes |
Type of the health check Possible values:
|
services[].health_check.timeout |
Integer | Yes |
Time in seconds after an attempt is considered a timeout |
services[].health_check.retries |
Integer | Yes |
Unsuccessful retries needed until a target is considered unhealthy; an unhealthy target needs the same number of successful retries to become healthy again |
services[].health_check.http |
Object | No |
Additional configuration for protocol http |
services[].health_check.http.status_codes[] |
Array | No |
List of returned HTTP status codes in order to pass the health check. Supports the wildcards Default value: [ "2??", "3??" ] |
services[].health_check.http.response |
String | No |
String that must be contained in HTTP response in order to pass the health check |
services[].health_check.http.tls |
Boolean | No |
Use HTTPS for health check |
services[].health_check.http.domain |
String | Yes |
Host header to send in the HTTP request. May not contain spaces, percent or backslash symbols. Can be null, in that case no host header is sent. |
services[].health_check.http.path |
String | Yes |
HTTP path to use for health checks. May not contain literal spaces, use percent-encoding instead. |
services[].listen_port |
Integer | Yes |
Port the Load Balancer listens on |
services[].protocol |
String | Yes |
Protocol of the Load Balancer Possible values:
|
services[].http |
Object | No |
Configuration option for protocols http and https |
services[].http.cookie_name |
String | No |
Name of the cookie used for sticky sessions. Default value: "HCLBSTICKY" |
services[].http.cookie_lifetime |
Integer | No |
Lifetime of the cookie used for sticky sessions (in seconds). Default value: 300 |
services[].http.certificates[] |
Array | No |
IDs of the Certificates to use for TLS/SSL termination by the Load Balancer; empty for TLS/SSL passthrough or if |
services[].http.sticky_sessions |
Boolean | No |
Use sticky sessions. Only available if Default value: false |
services[].http.redirect_http |
Boolean | No |
Redirect HTTP requests to HTTPS. Only available if Default value: false |
targets[] |
Array | No |
Array of targets |
targets[].label_selector |
Object | No |
Configuration for label selector targets, only valid and required if type is |
targets[].label_selector.selector |
String | Yes |
Label selector |
targets[].type |
String | Yes |
Type of the resource Possible values:
|
targets[].server |
Object | No |
Configuration for type Server, only valid and required if type is |
targets[].server.id |
Integer | Yes |
ID of the Server |
targets[].use_private_ip |
Boolean | No |
Use the private network IP instead of the public IP of the Server, requires the Server and Load Balancer to be in the same network. Default value: false |
targets[].ip |
Object | No |
Configuration for an IP target. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only valid and required if type is |
targets[].ip.ip |
String | Yes |
IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch. |
network_zone |
String | No |
Name of network zone |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.