Load Balancers
Create a Load Balancer
Creates a Load Balancer.
Operation specific errors
| Status | Code | Description |
|---|---|---|
| 412 | source_port_already_used | The source port you are trying to add is already in use |
| 412 | primary_ip_version_mismatch | The specified Primary IP has the wrong IP version |
| 422 | ip_not_owned | The IP is not owned by the owner of the project of the Load Balancer |
| 422 | load_balancer_not_attached_to_network | The Load Balancer is not attached to a network |
| 422 | resolve_cloud_private_targets_error | The server you are trying to add as a target is not attached to the same network as the Load Balancer |
| 422 | resolve_cloud_public_targets_error | The server that you are trying to add as a public target does not have a public IPv4 address |
| 422 | target_already_defined | The Load Balancer target you are trying to define is already defined |
| 422 | primary_ip_assigned | The specified Primary IP is already assigned to a resource |
| 422 | primary_ip_blocked | The specified Primary IP is blocked |
| 422 | primary_ip_location_mismatch | The specified Primary IP is bound to a different Location than the Load Balancer |
post/load_balancers
Request
- Base URL: https://api.hetzner.cloud/v1
- URL: https://api.hetzner.cloud/v1/load_balancers
- Auth: HTTP bearer
Request body
Example request
{
"name": "Web Frontend",
"load_balancer_type": "lb11",
"services": [
{
"protocol": "tcp",
"listen_port": 443,
"destination_port": 80,
"health_check": {
"protocol": "http",
"port": 4711,
"interval": 15,
"timeout": 10,
"retries": 3,
"http": {
"domain": "example.com",
"path": "/",
"response": "{\"status\": \"ok\"}",
"status_codes": [
"2??",
"3??"
]
}
}
}
],
"targets": [
{
"server": {
"id": 80,
"ip": "2001:db8::1"
},
"label_selector": {
"selector": "env=prod"
},
"ip": {
"ip": "203.0.113.1"
},
"use_private_ip": true
}
],
"labels": {
"environment": "prod",
"example.com/my": "label",
"just-a-key": ""
},
"public_interface": true,
"public_net": {
"ipv4": 42,
"ipv6": 42
},
"network": 123,
"network_zone": "eu-central",
"location": "fsn1"
}Response
Request succeeded.
Example response
{
"load_balancer": {
"id": 42,
"name": "my-resource",
"public_net": {
"ipv4": {
"id": 42,
"ip": "1.2.3.4",
"dns_ptr": "lb1.example.com"
},
"ipv6": {
"id": 42,
"ip": "2001:db8::1",
"dns_ptr": "lb1.example.com"
}
},
"private_net": [
{
"network": 4711,
"ip": "10.0.0.2"
}
],
"location": {
"id": 42,
"name": "fsn1",
"description": "Falkenstein DC Park 1",
"country": "DE",
"city": "Falkenstein",
"latitude": 50.47612,
"longitude": 12.370071,
"network_zone": "eu-central"
},
"load_balancer_type": {
"id": 1,
"name": "lb11",
"description": "LB11",
"max_connections": 20000,
"max_services": 5,
"max_targets": 25,
"max_assigned_certificates": 10,
"deprecated": "2016-01-30T23:50:00Z",
"deprecation": {
"unavailable_after": "2023-09-01T00:00:00Z",
"announced": "2023-06-01T00:00:00Z"
},
"prices": [
{
"location": "fsn1",
"price_hourly": {
"net": "1.0000",
"gross": "1.1900"
},
"price_monthly": {
"net": "1.0000",
"gross": "1.1900"
},
"included_traffic": 654321,
"price_per_tb_traffic": {
"net": "1.0000",
"gross": "1.1900"
}
}
]
},
"labels": {
"environment": "prod",
"example.com/my": "label",
"just-a-key": ""
},
"created": "2016-01-30T23:55:00Z",
"services": [
{
"protocol": "tcp",
"listen_port": 443,
"destination_port": 80,
"health_check": {
"protocol": "http",
"port": 4711,
"interval": 15,
"timeout": 10,
"retries": 3,
"http": {
"domain": "example.com",
"path": "/",
"response": "{\"status\": \"ok\"}",
"status_codes": [
"2??",
"3??"
]
}
}
}
],
"targets": [
{
"type": "server",
"server": {
"id": 80,
"ip": "2001:db8::1"
},
"health_status": [
{
"listen_port": 443,
"status": "healthy",
"detail": "unexpected_http_status",
"http_status_code": 503
}
]
}
],
"included_traffic": 10000
},
"action": {
"id": 42,
"command": "start_resource",
"started": "2016-01-30T23:55:00Z",
"finished": "2016-01-30T23:55:00Z",
"progress": 100,
"resources": [
{
"id": 42,
"type": "server"
}
],
"error": {
"code": "action_failed",
"message": "Action failed"
}
}
}Changes
No recorded changes to this operation across all 1 revision of this API.