Update a Load Balancer
- Name
put
- Type
- /v1/load_balancers/:uuid
- Description
Send a
PUT
request to update a load balancer.
Request
Load balancer Attributes
Required
- Name
name
- Type
- string
- Description
Human readable name for the load balancer.
- Name
health
- Type
- array
- Description
Health check settings for the load balancer.
- Name
algorithm
- Type
- boolean
- Description
The load balancing algorithm used to determine which backend Stacklet will be selected by the client. It must be either
round_robin
orleast_connections
.
Optional
- Name
sticky_sessions
- Type
- object
- Description
Sticky sessions settings for the load balancer.
- Name
redirect_http_to_https
- Type
- boolean
- Description
A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.
Example
curl -X PUT "https://api.simplystack.com/v1/load_balancers" \
-H "Content-Type: application/json" \
-H "Authorization: Token d359ad9cc9422b5ff07aede0cd2707da4ff82be0" \
-d '{"name": "lb01","algorithm": "round_robin","health": {"protocol": "http","port": 80,"path": "/","interval": 10,"rise": 3,"fall": 3},"redirect_http_to_https": false}'
Response
JSON object with key named load_balancer
which is an array of the following attributes for the load_balancers object:
Load Balancer Attributes
Health Attibutes
When the health
object is returned, health checks are used to tell if a Stacklet is responding and should receive traffic. The load balancer will automatically stop sending traffic to the unresponsive Stacklets. The User may specify the protocol, port, and path for a health check as well as additional setting such as the check interval and response timeout. The following are the returned attributes:
Rules Attributes
When the rules
object is returned, the Forwarding rules determine how traffic will be routed from the load balancer to the Stacklets assigned to it. They can be used to configure the type of traffic (HTTP, HTTPS, or TCP) and to map ports on the load balancer to ports on the Stacklets. For SSL encrypted traffic, the user may also configure whether to use SSL termination at the load balancer (by specifying an SSL certificate) or to pass the encrypted traffic through to the Stacklet. The following are the returned attributes:
Sticky Sessions Attributes
When sticky_sessions
object is returned, that means sticky sessions are in use, follow up requests from the client will be sent to the same Stacklet as the original request. Both the name of the cookie and the TTL are configurable as follow:
Example
{
"load_balancer": {
"uuid": "21848c7e-0389-4fdf-95bf-7d4d58d62c22",
"name": "lb01",
"created_at": "2020-01-07T18:37:45.190194Z",
"task": {
"id": 4,
"name": "update",
"description": {
"completed": "Load balancer updated settings.",
"progress": "Load balancer is updating settings."
}
},
"region": {
"available": true,
"features": [
"floating_ips"
],
"name": "Frankfurt",
"slug": "fra"
},
"ip": 192.168.1.17,
"algorithm": "round_robin",
"sticky_sessions": {
"cookie": "LB-TEST",
"ttl": 300
},
"rules": [
{
"protocol": "http",
"source_port": 80,
"target_port": 80,
"certificate_id": null,
"tls_passthrough": false
},
{
"protocol": "https",
"source_port": 443,
"target_port": 443,
"certificate_id": 7,
"tls_passthrough": false
}
],
"health": {
"protocol": "http",
"port": 80,
"path": "/",
"interval": 10,
"rise": 3,
"fall": 3
},
"redirect_http_to_https": false,
"stacklet_ids": [
1,
2
]
}
}