Skip to content
  • Auto
  • Light
  • Dark

Load Balancers

Load Balancers

Load Balancers

Create a New Load Balancer
gpu_droplets.load_balancers.create(LoadBalancerCreateParams**kwargs) -> load_balancerLoadBalancerLoadBalancerCreateResponse
post/v2/load_balancers
Delete a Load Balancer
gpu_droplets.load_balancers.delete(strlb_id)
delete/v2/load_balancers/{lb_id}
Delete a Global Load Balancer CDN Cache
gpu_droplets.load_balancers.delete_cache(strlb_id)
delete/v2/load_balancers/{lb_id}/cache
List All Load Balancers
gpu_droplets.load_balancers.list(LoadBalancerListParams**kwargs) -> metaMetaPropertieslinksPageLinksload_balancerslistLoadBalancerListResponse
get/v2/load_balancers
Retrieve an Existing Load Balancer
gpu_droplets.load_balancers.retrieve(strlb_id) -> load_balancerLoadBalancerLoadBalancerRetrieveResponse
get/v2/load_balancers/{lb_id}
Update a Load Balancer
gpu_droplets.load_balancers.update(strlb_id, LoadBalancerUpdateParams**kwargs) -> load_balancerLoadBalancerLoadBalancerUpdateResponse
put/v2/load_balancers/{lb_id}
Domains
Domainsclass

An object specifying domain configurations for a Global load balancer.

ShowShow
certificate_idstr
optional

The ID of the TLS certificate used for SSL termination.

is_managedbool
optional

A boolean value indicating if the domain is already managed by DigitalOcean. If true, all A and AAAA records required to enable Global load balancers will be automatically added.

namestr
optional

FQDN to associate with a Global load balancer.

Forwarding Rule
ForwardingRuleclass

An object specifying a forwarding rule for a load balancer.

ShowShow
entry_portint

An integer representing the port on which the load balancer instance will listen.

entry_protocolliteral
Literal["http", "https", "http2", 3 more]

The protocol used for traffic to the load balancer. The possible values are: http, https, http2, http3, tcp, or udp. If you set the entry_protocol to udp, the target_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

Hide ParametersShow Parameters
"http"
"https"
"http2"
"http3"
"tcp"
"udp"
target_portint

An integer representing the port on the backend Droplets to which the load balancer will send traffic.

target_protocolliteral
Literal["http", "https", "http2", 2 more]

The protocol used for traffic from the load balancer to the backend Droplets. The possible values are: http, https, http2, tcp, or udp. If you set the target_protocol to udp, the entry_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

Hide ParametersShow Parameters
"http"
"https"
"http2"
"tcp"
"udp"
certificate_idstr
optional

The ID of the TLS certificate used for SSL termination if enabled.

tls_passthroughbool
optional

A boolean value indicating whether SSL encrypted traffic will be passed through to the backend Droplets.

Glb Settings
GlbSettingsclass

An object specifying forwarding configurations for a Global load balancer.

ShowShow
cdnis_enabledboolCdn
optional

An object specifying CDN configurations for a Global load balancer.

Hide ParametersShow Parameters
is_enabledbool
optional

A boolean flag to enable CDN caching.

failover_thresholdint
optional

An integer value as a percentage to indicate failure threshold to decide how the regional priorities will take effect. A value of 50 would indicate that the Global load balancer will choose a lower priority region to forward traffic to once this failure threshold has been reached for the higher priority region.

region_prioritiesDict[str, int]
optional
Optional[Dict[str, int]]

A map of region string to an integer priority value indicating preference for which regional target a Global load balancer will forward traffic to. A lower value indicates a higher priority.

target_portint
optional

An integer representing the port on the target backends which the load balancer will forward traffic to.

target_protocolliteral
optional
Optional[Literal["http", "https", "http2"]]

The protocol used for forwarding traffic from the load balancer to the target backends. The possible values are http, https and http2.

Hide ParametersShow Parameters
"http"
"https"
"http2"
Health Check
HealthCheckclass

An object specifying health check settings for the load balancer.

ShowShow
check_interval_secondsint
optional

The number of seconds between between two consecutive health checks.

healthy_thresholdint
optional

The number of times a health check must pass for a backend Droplet to be marked "healthy" and be re-added to the pool.

pathstr
optional

The path on the backend Droplets to which the load balancer instance will send a request.

portint
optional

An integer representing the port on the backend Droplets on which the health check will attempt a connection.

protocolliteral
optional
Optional[Literal["http", "https", "tcp"]]

The protocol used for health checks sent to the backend Droplets. The possible values are http, https, or tcp.

Hide ParametersShow Parameters
"http"
"https"
"tcp"
response_timeout_secondsint
optional

The number of seconds the load balancer instance will wait for a response until marking a health check as failed.

unhealthy_thresholdint
optional

The number of times a health check must fail for a backend Droplet to be marked "unhealthy" and be removed from the pool.

Lb Firewall
LbFirewallclass

An object specifying allow and deny rules to control traffic to the load balancer.

ShowShow
allowlist
optional
Optional[List[str]]

the rules for allowing traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')

denylist
optional
Optional[List[str]]

the rules for denying traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')

Load Balancer
LoadBalancerclass
ShowShow
forwarding_ruleslist
List[entry_portintentry_protocolliteraltarget_portinttarget_protocolliteralcertificate_idstrtls_passthroughboolForwardingRule]

An array of objects specifying the forwarding rules for a load balancer.

Hide ParametersShow Parameters
entry_portint

An integer representing the port on which the load balancer instance will listen.

entry_protocolliteral
Literal["http", "https", "http2", 3 more]

The protocol used for traffic to the load balancer. The possible values are: http, https, http2, http3, tcp, or udp. If you set the entry_protocol to udp, the target_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

Hide ParametersShow Parameters
"http"
"https"
"http2"
"http3"
"tcp"
"udp"
target_portint

An integer representing the port on the backend Droplets to which the load balancer will send traffic.

target_protocolliteral
Literal["http", "https", "http2", 2 more]

The protocol used for traffic from the load balancer to the backend Droplets. The possible values are: http, https, http2, tcp, or udp. If you set the target_protocol to udp, the entry_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

Hide ParametersShow Parameters
"http"
"https"
"http2"
"tcp"
"udp"
certificate_idstr
optional

The ID of the TLS certificate used for SSL termination if enabled.

tls_passthroughbool
optional

A boolean value indicating whether SSL encrypted traffic will be passed through to the backend Droplets.

idstr
optional

A unique ID that can be used to identify and reference a load balancer.

formatuuid
algorithmliteral
optional
deprecated
Optional[Literal["round_robin", "least_connections"]]

This field has been deprecated. You can no longer specify an algorithm for load balancers.

Hide ParametersShow Parameters
"round_robin"
"least_connections"
created_atdatetime
optional

A time value given in ISO8601 combined date and time format that represents when the load balancer was created.

formatdate-time
disable_lets_encrypt_dns_recordsbool
optional

A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.

domainslist
optional
Optional[List[certificate_idstris_managedboolnamestrDomains]]

An array of objects specifying the domain configurations for a Global load balancer.

Hide ParametersShow Parameters
certificate_idstr
optional

The ID of the TLS certificate used for SSL termination.

is_managedbool
optional

A boolean value indicating if the domain is already managed by DigitalOcean. If true, all A and AAAA records required to enable Global load balancers will be automatically added.

namestr
optional

FQDN to associate with a Global load balancer.

droplet_idslist
optional
Optional[List[int]]

An array containing the IDs of the Droplets assigned to the load balancer.

enable_backend_keepalivebool
optional

A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.

enable_proxy_protocolbool
optional

A boolean value indicating whether PROXY Protocol is in use.

firewallLbFirewall
optional

An object specifying allow and deny rules to control traffic to the load balancer.

glb_settingsGlbSettings
optional

An object specifying forwarding configurations for a Global load balancer.

health_checkHealthCheck
optional

An object specifying health check settings for the load balancer.

http_idle_timeout_secondsint
optional

An integer value which configures the idle timeout for HTTP requests to the target droplets.

minimum30
maximum600
ipstr
optional

An attribute containing the public-facing IP address of the load balancer.

ipv6str
optional

An attribute containing the public-facing IPv6 address of the load balancer.

namestr
optional

A human-readable name for a load balancer instance.

networkliteral
optional
Optional[Literal["EXTERNAL", "INTERNAL"]]

A 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.

Hide ParametersShow Parameters
"EXTERNAL"
"INTERNAL"
network_stackliteral
optional
Optional[Literal["IPV4", "DUALSTACK"]]

A 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.

Hide ParametersShow Parameters
"IPV4"
"DUALSTACK"
project_idstr
optional

The 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.

redirect_http_to_httpsbool
optional

A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.

regionRegion
optional

The 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.

sizeliteral
optional
deprecated
Optional[Literal["lb-small", "lb-medium", "lb-large"]]

This 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.

Hide ParametersShow Parameters
"lb-small"
"lb-medium"
"lb-large"
size_unitint
optional

How 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.

minimum1
maximum100
statusliteral
optional
Optional[Literal["new", "active", "errored"]]

A status string indicating the current state of the load balancer. This can be new, active, or errored.

Hide ParametersShow Parameters
"new"
"active"
"errored"
sticky_sessionsStickySessions
optional

An object specifying sticky sessions settings for the load balancer.

tagstr
optional

The name of a Droplet tag corresponding to Droplets assigned to the load balancer.

target_load_balancer_idslist
optional
Optional[List[str]]

An array containing the UUIDs of the Regional load balancers to be used as target backends for a Global load balancer.

tls_cipher_policyliteral
optional
Optional[Literal["DEFAULT", "STRONG"]]

A 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.

Hide ParametersShow Parameters
"DEFAULT"
"STRONG"
typeliteral
optional
Optional[Literal["REGIONAL", "REGIONAL_NETWORK", "GLOBAL"]]

A 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.

Hide ParametersShow Parameters
"REGIONAL"
"REGIONAL_NETWORK"
"GLOBAL"
vpc_uuidstr
optional

A string specifying the UUID of the VPC to which the load balancer is assigned.

formatuuid
Sticky Sessions
StickySessionsclass

An object specifying sticky sessions settings for the load balancer.

ShowShow
typeliteral
optional
Optional[Literal["cookies", "none"]]

An attribute indicating how and if requests from a client will be persistently served by the same backend Droplet. The possible values are cookies or none.

Hide ParametersShow Parameters
"cookies"
"none"

Load BalancersDroplets

Add Droplets to a Load Balancer
gpu_droplets.load_balancers.droplets.add(strlb_id, DropletAddParams**kwargs)
post/v2/load_balancers/{lb_id}/droplets
Remove Droplets from a Load Balancer
gpu_droplets.load_balancers.droplets.remove(strlb_id, DropletRemoveParams**kwargs)
delete/v2/load_balancers/{lb_id}/droplets

Load BalancersForwarding Rules

Add Forwarding Rules to a Load Balancer
gpu_droplets.load_balancers.forwarding_rules.add(strlb_id, ForwardingRuleAddParams**kwargs)
post/v2/load_balancers/{lb_id}/forwarding_rules
Remove Forwarding Rules from a Load Balancer
gpu_droplets.load_balancers.forwarding_rules.remove(strlb_id, ForwardingRuleRemoveParams**kwargs)
delete/v2/load_balancers/{lb_id}/forwarding_rules