API: Load Balancers
Endpoints
| Method | Path | Description |
|---|
| POST | /v1/loadbalancers | Create a load balancer |
| GET | /v1/loadbalancers | List all load balancers |
| GET | /v1/loadbalancers/{id} | Get details |
| DELETE | /v1/loadbalancers/{id} | Delete |
## Create Load Balancer
POST /v1/loadbalancers
Request Body
{
"metadata": {"name": "web-lb"},
"spec": {
"type": "http",
"vpc_id": "vpc-abc123",
"listeners": [
{"listen_port": 80, "target_port": 8080, "protocol": "http"},
{"listen_port": 443, "target_port": 8080, "protocol": "https"}
],
"health_check": {
"path": "/healthz",
"interval_seconds": 10,
"timeout_seconds": 5,
"healthy_threshold": 3,
"unhealthy_threshold": 3
}
}
}
Response (201)
{
"id": "lb-a1b2c3",
"metadata": {"name": "web-lb", "created_at": "2025-01-15T10:30:00Z"},
"spec": {
"type": "http",
"vpc_id": "vpc-abc123",
"listeners": [
{"listen_port": 80, "target_port": 8080, "protocol": "http"},
{"listen_port": 443, "target_port": 8080, "protocol": "https"}
],
"health_check": {
"path": "/healthz",
"interval_seconds": 10,
"timeout_seconds": 5,
"healthy_threshold": 3,
"unhealthy_threshold": 3
}
},
"status": {
"state": "provisioning",
"public_ip": "",
"active_targets": 0
},
"operation_id": "op-lb-001"
}
LoadBalancerSpec Fields
| Field | Type | Required | Description |
|---|
type | string | Yes | http (Layer 7) or tcp (Layer 4) |
vpc_id | string | Yes | VPC for the load balancer |
listeners | array | Yes | Listener configurations |
health_check | object | No | Health check settings |
### Listener Object
| Field | Type | Description |
|---|
listen_port | int | Port the LB listens on |
target_port | int | Port on target instances |
protocol | string | http, https, or tcp |
### HealthCheck Object
| Field | Type | Description |
|---|
path | string | HTTP path for health checks |
interval_seconds | int | Time between checks |
timeout_seconds | int | Check timeout |
healthy_threshold | int | Consecutive successes to mark healthy |
unhealthy_threshold | int | Consecutive failures to mark unhealthy |