Skip to main content

load_balancers

Creates, updates, deletes, gets or lists a load_balancers resource.

Overview

Nameload_balancers
TypeResource
Iddigitalocean.compute.load_balancers

Fields

The following fields are returned by SELECT queries:

The response will be a JSON object with a key called load_balancer. The
value of this will be an object that contains the standard attributes
associated with a load balancer

NameDatatypeDescription
idstring (uuid)A unique ID that can be used to identify and reference a load balancer. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6)
namestringA human-readable name for a load balancer instance. (example: example-lb-01)
project_idstringThe ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6)
algorithmstringThis field has been deprecated. You can no longer specify an algorithm for load balancers. (example: round_robin, default: round_robin)
created_atstring (date-time)A time value given in ISO8601 combined date and time format that represents when the load balancer was created. (example: 2017-02-01T22:22:58Z)
disable_lets_encrypt_dns_recordsbooleanA boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.
domainsarrayAn array of objects specifying the domain configurations for a Global load balancer.
droplet_idsarrayAn array containing the IDs of the Droplets assigned to the load balancer.
enable_backend_keepalivebooleanA boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.
enable_proxy_protocolbooleanA boolean value indicating whether PROXY Protocol is in use.
firewallobjectAn object specifying allow and deny rules to control traffic to the load balancer.
forwarding_rulesarrayAn array of objects specifying the forwarding rules for a load balancer.
glb_settingsobjectAn object specifying forwarding configurations for a Global load balancer.
health_checkobjectAn object specifying health check settings for the load balancer.
http_idle_timeout_secondsintegerAn integer value which configures the idle timeout for HTTP requests to the target droplets.
ipstringAn attribute containing the public-facing IP address of the load balancer. (pattern: ^$|^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$, example: 104.131.186.241)
ipv6stringAn attribute containing the public-facing IPv6 address of the load balancer. (example: 2604:a880:800:14::85f5:c000)
networkstringA string indicating whether the load balancer should be external or internal. Internal load balancers have no public IPs and are only accessible to resources on the same VPC network. This property cannot be updated after creating the load balancer. (example: EXTERNAL, default: EXTERNAL)
network_stackstringA string indicating whether the load balancer will support IPv4 or both IPv4 and IPv6 networking. This property cannot be updated after creating the load balancer. (example: IPV4, default: IPV4)
redirect_http_to_httpsbooleanA boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.
regionobjectThe region where the load balancer instance is located. When setting a region, the value should be the slug identifier for the region. When you query a load balancer, an entire region object will be returned.
sizestringThis field has been replaced by the size_unit field for all regions except in AMS2, NYC2, and SFO1. Each available load balancer size now equates to the load balancer having a set number of nodes. * lb-small = 1 node * lb-medium = 3 nodes * lb-large = 6 nodes You can resize load balancers after creation up to once per hour. You cannot resize a load balancer within the first hour of its creation. (default: lb-small, example: lb-small)
size_unitintegerHow many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the size field to scale load balancers that reside in these regions.
statusstringA status string indicating the current state of the load balancer. This can be new, active, or errored. (example: new)
sticky_sessionsobjectAn object specifying sticky sessions settings for the load balancer.
tagstringThe name of a Droplet tag corresponding to Droplets assigned to the load balancer. (example: prod:web)
target_load_balancer_idsarrayAn array containing the UUIDs of the Regional load balancers to be used as target backends for a Global load balancer.
tls_cipher_policystringA string indicating the policy for the TLS cipher suites used by the load balancer. The possible values are DEFAULT or STRONG. The default value is DEFAULT. (example: STRONG, default: DEFAULT)
typestringA string indicating whether the load balancer should be a standard regional HTTP load balancer, a regional network load balancer that routes traffic at the TCP/UDP transport layer, or a global load balancer. (example: REGIONAL, default: REGIONAL)
vpc_uuidstring (uuid)A string specifying the UUID of the VPC to which the load balancer is assigned. (example: c33931f2-a26a-4e61-b85c-4e95a2ec431b)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
load_balancers_getselectlb_idTo show information about a load balancer instance, send a GET request to
/v2/load_balancers/$LOAD_BALANCER_ID.
load_balancers_listselectper_page, pageTo list all of the load balancer instances on your account, send a GET request
to /v2/load_balancers.
load_balancers_createinsertTo create a new load balancer instance, send a POST request to
/v2/load_balancers.

You can specify the Droplets that will sit behind the load balancer using one
of two methods:

* Set droplet_ids to a list of specific Droplet IDs.
* Set tag to the name of a tag. All Droplets with this tag applied will be
assigned to the load balancer. Additional Droplets will be automatically
assigned as they are tagged.

These methods are mutually exclusive.
load_balancers_updatereplacelb_idTo update a load balancer's settings, send a PUT request to
/v2/load_balancers/$LOAD_BALANCER_ID. The request should contain a full
representation of the load balancer including existing attributes. It may
contain one of the droplets_ids or tag attributes as they are mutually
exclusive. Note that any attribute that is not provided will be reset to its
default value.

load_balancers_deletedeletelb_idTo delete a load balancer instance, disassociating any Droplets assigned to it
and removing it from your account, send a DELETE request to
/v2/load_balancers/$LOAD_BALANCER_ID.

A successful request will receive a 204 status code with no body in response.
This indicates that the request was processed successfully.
load_balancers_delete_cacheexeclb_idTo delete a Global load balancer CDN cache, send a DELETE request to
/v2/load_balancers/$LOAD_BALANCER_ID/cache.

A successful request will receive a 204 status code with no body in response.
This indicates that the request was processed successfully.
load_balancers_add_dropletsexeclb_id, droplet_idsTo assign a Droplet to a load balancer instance, send a POST request to
/v2/load_balancers/$LOAD_BALANCER_ID/droplets. In the body of the request,
there should be a droplet_ids attribute containing a list of Droplet IDs.
Individual Droplets can not be added to a load balancer configured with a
Droplet tag. Attempting to do so will result in a "422 Unprocessable Entity"
response from the API.

No response body will be sent back, but the response code will indicate
success. Specifically, the response code will be a 204, which means that the
action was successful with no returned body data.
load_balancers_remove_dropletsexeclb_id, droplet_idsTo remove a Droplet from a load balancer instance, send a DELETE request to
/v2/load_balancers/$LOAD_BALANCER_ID/droplets. In the body of the request,
there should be a droplet_ids attribute containing a list of Droplet IDs.

No response body will be sent back, but the response code will indicate
success. Specifically, the response code will be a 204, which means that the
action was successful with no returned body data.
load_balancers_add_forwarding_rulesexeclb_id, forwarding_rulesTo add an additional forwarding rule to a load balancer instance, send a POST
request to /v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules. In the body
of the request, there should be a forwarding_rules attribute containing an
array of rules to be added.

No response body will be sent back, but the response code will indicate
success. Specifically, the response code will be a 204, which means that the
action was successful with no returned body data.
load_balancers_remove_forwarding_rulesexeclb_id, forwarding_rulesTo remove forwarding rules from a load balancer instance, send a DELETE
request to /v2/load_balancers/$LOAD_BALANCER_ID/forwarding_rules. In the
body of the request, there should be a forwarding_rules attribute containing
an array of rules to be removed.

No response body will be sent back, but the response code will indicate
success. Specifically, the response code will be a 204, which means that the
action was successful with no returned body data.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
lb_idstringA unique identifier for a load balancer. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6)
pageintegerWhich 'page' of paginated results to return. (example: 1)
per_pageintegerNumber of items returned per page (example: 2)

SELECT examples

To show information about a load balancer instance, send a GET request to
/v2/load_balancers/$LOAD_BALANCER_ID.

SELECT
id,
name,
project_id,
algorithm,
created_at,
disable_lets_encrypt_dns_records,
domains,
droplet_ids,
enable_backend_keepalive,
enable_proxy_protocol,
firewall,
forwarding_rules,
glb_settings,
health_check,
http_idle_timeout_seconds,
ip,
ipv6,
network,
network_stack,
redirect_http_to_https,
region,
size,
size_unit,
status,
sticky_sessions,
tag,
target_load_balancer_ids,
tls_cipher_policy,
type,
vpc_uuid
FROM digitalocean.compute.load_balancers
WHERE lb_id = '{{ lb_id }}' -- required;

INSERT examples

To create a new load balancer instance, send a POST request to
/v2/load_balancers.

You can specify the Droplets that will sit behind the load balancer using one
of two methods:

* Set droplet_ids to a list of specific Droplet IDs.
* Set tag to the name of a tag. All Droplets with this tag applied will be
assigned to the load balancer. Additional Droplets will be automatically
assigned as they are tagged.

These methods are mutually exclusive.

INSERT INTO digitalocean.compute.load_balancers (

)
SELECT

RETURNING
load_balancer
;

REPLACE examples

To update a load balancer's settings, send a PUT request to
/v2/load_balancers/$LOAD_BALANCER_ID. The request should contain a full
representation of the load balancer including existing attributes. It may
contain one of the droplets_ids or tag attributes as they are mutually
exclusive. Note that any attribute that is not provided will be reset to its
default value.

REPLACE digitalocean.compute.load_balancers
SET
-- No updatable properties
WHERE
lb_id = '{{ lb_id }}' --required
RETURNING
load_balancer;

DELETE examples

To delete a load balancer instance, disassociating any Droplets assigned to it
and removing it from your account, send a DELETE request to
/v2/load_balancers/$LOAD_BALANCER_ID.

A successful request will receive a 204 status code with no body in response.
This indicates that the request was processed successfully.

DELETE FROM digitalocean.compute.load_balancers
WHERE lb_id = '{{ lb_id }}' --required;

Lifecycle Methods

To delete a Global load balancer CDN cache, send a DELETE request to
/v2/load_balancers/$LOAD_BALANCER_ID/cache.

A successful request will receive a 204 status code with no body in response.
This indicates that the request was processed successfully.

EXEC digitalocean.compute.load_balancers.load_balancers_delete_cache 
@lb_id='{{ lb_id }}' --required;