Skip to content
  • Auto
  • Light
  • Dark

List

List All Load Balancers
gpu_droplets.load_balancers.list(LoadBalancerListParams**kwargs) -> LoadBalancerListResponse
get/v2/load_balancers

To list all of the load balancer instances on your account, send a GET request to /v2/load_balancers.

ParametersExpand Collapse
page: Optional[int]

Which 'page' of paginated results to return.

minimum1
per_page: Optional[int]

Number of items returned per page

minimum1
maximum200
ReturnsExpand Collapse
class LoadBalancerListResponse:

Information about the response itself.

load_balancers: Optional[List[LoadBalancer]]
forwarding_rules: List[ForwardingRule]

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

entry_port: int

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

entry_protocol: 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.

Accepts one of the following:
"http"
"https"
"http2"
"http3"
"tcp"
"udp"
target_port: int

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

target_protocol: 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.

Accepts one of the following:
"http"
"https"
"http2"
"tcp"
"udp"
certificate_id: Optional[str]

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

tls_passthrough: Optional[bool]

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

id: Optional[str]

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

formatuuid
Deprecatedalgorithm: Optional[Literal["round_robin", "least_connections"]]

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

Accepts one of the following:
"round_robin"
"least_connections"
created_at: Optional[datetime]

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_records: Optional[bool]

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

domains: Optional[List[Domains]]

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

certificate_id: Optional[str]

The ID of the TLS certificate used for SSL termination.

is_managed: Optional[bool]

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.

name: Optional[str]

FQDN to associate with a Global load balancer.

droplet_ids: Optional[List[int]]

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

enable_backend_keepalive: Optional[bool]

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

enable_proxy_protocol: Optional[bool]

A boolean value indicating whether PROXY Protocol is in use.

firewall: Optional[LbFirewall]

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

glb_settings: Optional[GlbSettings]

An object specifying forwarding configurations for a Global load balancer.

health_check: Optional[HealthCheck]

An object specifying health check settings for the load balancer.

http_idle_timeout_seconds: Optional[int]

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

minimum30
maximum600
ip: Optional[str]

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

ipv6: Optional[str]

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

name: Optional[str]

A human-readable name for a load balancer instance.

network: 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.

Accepts one of the following:
"EXTERNAL"
"INTERNAL"
network_stack: 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.

Accepts one of the following:
"IPV4"
"DUALSTACK"
project_id: Optional[str]

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_https: Optional[bool]

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

region: Optional[Region]

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.

Deprecatedsize: 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.

Accepts one of the following:
"lb-small"
"lb-medium"
"lb-large"
size_unit: Optional[int]

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
status: Optional[Literal["new", "active", "errored"]]

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

Accepts one of the following:
"new"
"active"
"errored"
sticky_sessions: Optional[StickySessions]

An object specifying sticky sessions settings for the load balancer.

tag: Optional[str]

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

target_load_balancer_ids: 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_policy: 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.

Accepts one of the following:
"DEFAULT"
"STRONG"
type: 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.

Accepts one of the following:
"REGIONAL"
"REGIONAL_NETWORK"
"GLOBAL"
vpc_uuid: Optional[str]

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

formatuuid
from gradient import Gradient

client = Gradient()
load_balancers = client.gpu_droplets.load_balancers.list()
print(load_balancers.meta)
{
  "load_balancers": [
    {
      "id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
      "name": "example-lb-01",
      "ip": "104.131.186.241",
      "size": "lb-small",
      "algorithm": "round_robin",
      "status": "new",
      "created_at": "2017-02-01T22:22:58Z",
      "forwarding_rules": [
        {
          "entry_protocol": "http",
          "entry_port": 80,
          "target_protocol": "http",
          "target_port": 80,
          "certificate_id": "",
          "tls_passthrough": false
        },
        {
          "entry_protocol": "https",
          "entry_port": 443,
          "target_protocol": "https",
          "target_port": 443,
          "certificate_id": "",
          "tls_passthrough": true
        }
      ],
      "health_check": {
        "protocol": "http",
        "port": 80,
        "path": "/",
        "check_interval_seconds": 10,
        "response_timeout_seconds": 5,
        "healthy_threshold": 5,
        "unhealthy_threshold": 3
      },
      "sticky_sessions": {
        "type": "none"
      },
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent"
        ],
        "available": true
      },
      "tag": "",
      "droplet_ids": [
        3164444,
        3164445
      ],
      "redirect_http_to_https": false,
      "enable_proxy_protocol": false,
      "enable_backend_keepalive": false,
      "vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b",
      "disable_lets_encrypt_dns_records": false,
      "firewall": {
        "deny": [
          "cidr:1.2.0.0/16",
          "ip:2.3.4.5"
        ],
        "allow": [
          "ip:1.2.3.4",
          "cidr:2.3.4.0/24"
        ]
      }
    },
    {
      "id": "56775c3f-04ab-4fb3-a7ed-40ef9bc8eece",
      "name": "prod-web-lb-01",
      "ip": "45.55.125.24",
      "size": "lb-small",
      "algorithm": "round_robin",
      "status": "active",
      "created_at": "2020-09-08T18:58:04Z",
      "forwarding_rules": [
        {
          "entry_protocol": "https",
          "entry_port": 443,
          "target_protocol": "http",
          "target_port": 8080,
          "certificate_id": "892071a0-bb95-49bc-8021-3afd67a210bf",
          "tls_passthrough": false
        }
      ],
      "health_check": {
        "protocol": "https",
        "port": 443,
        "path": "/",
        "check_interval_seconds": 10,
        "response_timeout_seconds": 5,
        "healthy_threshold": 5,
        "unhealthy_threshold": 3
      },
      "sticky_sessions": {
        "type": "cookies",
        "cookie_name": "DO-LB",
        "cookie_ttl_seconds": 300
      },
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent"
        ],
        "available": true
      },
      "tag": "prod:web",
      "droplet_ids": [
        55806512,
        55806515,
        55806524
      ],
      "redirect_http_to_https": true,
      "enable_proxy_protocol": false,
      "enable_backend_keepalive": false,
      "vpc_uuid": "587d698c-de84-11e8-80bc-3cfdfea9fcd1",
      "disable_lets_encrypt_dns_records": false,
      "project_id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
      "http_idle_timeout_seconds": 60,
      "firewall": {
        "deny": [
          "cidr:1.2.0.0/16",
          "ip:2.3.4.5"
        ],
        "allow": [
          "ip:1.2.3.4",
          "cidr:2.3.4.0/24"
        ]
      }
    }
  ],
  "links": {},
  "meta": {
    "total": 2
  }
}
Returns Examples
{
  "load_balancers": [
    {
      "id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
      "name": "example-lb-01",
      "ip": "104.131.186.241",
      "size": "lb-small",
      "algorithm": "round_robin",
      "status": "new",
      "created_at": "2017-02-01T22:22:58Z",
      "forwarding_rules": [
        {
          "entry_protocol": "http",
          "entry_port": 80,
          "target_protocol": "http",
          "target_port": 80,
          "certificate_id": "",
          "tls_passthrough": false
        },
        {
          "entry_protocol": "https",
          "entry_port": 443,
          "target_protocol": "https",
          "target_port": 443,
          "certificate_id": "",
          "tls_passthrough": true
        }
      ],
      "health_check": {
        "protocol": "http",
        "port": 80,
        "path": "/",
        "check_interval_seconds": 10,
        "response_timeout_seconds": 5,
        "healthy_threshold": 5,
        "unhealthy_threshold": 3
      },
      "sticky_sessions": {
        "type": "none"
      },
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent"
        ],
        "available": true
      },
      "tag": "",
      "droplet_ids": [
        3164444,
        3164445
      ],
      "redirect_http_to_https": false,
      "enable_proxy_protocol": false,
      "enable_backend_keepalive": false,
      "vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b",
      "disable_lets_encrypt_dns_records": false,
      "firewall": {
        "deny": [
          "cidr:1.2.0.0/16",
          "ip:2.3.4.5"
        ],
        "allow": [
          "ip:1.2.3.4",
          "cidr:2.3.4.0/24"
        ]
      }
    },
    {
      "id": "56775c3f-04ab-4fb3-a7ed-40ef9bc8eece",
      "name": "prod-web-lb-01",
      "ip": "45.55.125.24",
      "size": "lb-small",
      "algorithm": "round_robin",
      "status": "active",
      "created_at": "2020-09-08T18:58:04Z",
      "forwarding_rules": [
        {
          "entry_protocol": "https",
          "entry_port": 443,
          "target_protocol": "http",
          "target_port": 8080,
          "certificate_id": "892071a0-bb95-49bc-8021-3afd67a210bf",
          "tls_passthrough": false
        }
      ],
      "health_check": {
        "protocol": "https",
        "port": 443,
        "path": "/",
        "check_interval_seconds": 10,
        "response_timeout_seconds": 5,
        "healthy_threshold": 5,
        "unhealthy_threshold": 3
      },
      "sticky_sessions": {
        "type": "cookies",
        "cookie_name": "DO-LB",
        "cookie_ttl_seconds": 300
      },
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent"
        ],
        "available": true
      },
      "tag": "prod:web",
      "droplet_ids": [
        55806512,
        55806515,
        55806524
      ],
      "redirect_http_to_https": true,
      "enable_proxy_protocol": false,
      "enable_backend_keepalive": false,
      "vpc_uuid": "587d698c-de84-11e8-80bc-3cfdfea9fcd1",
      "disable_lets_encrypt_dns_records": false,
      "project_id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
      "http_idle_timeout_seconds": 60,
      "firewall": {
        "deny": [
          "cidr:1.2.0.0/16",
          "ip:2.3.4.5"
        ],
        "allow": [
          "ip:1.2.3.4",
          "cidr:2.3.4.0/24"
        ]
      }
    }
  ],
  "links": {},
  "meta": {
    "total": 2
  }
}