turbot/digitalocean
steampipe plugin install digitalocean

Table: digitalocean_load_balancer - Query DigitalOcean Load Balancers using SQL

DigitalOcean Load Balancers are a fully-managed, highly available network load balancing service. They distribute incoming traffic across your infrastructure to increase your application's availability. Load Balancers are protocol agnostic and route traffic to backend Droplets by using a health check to ensure only healthy Droplets receive traffic.

Table Usage Guide

The digitalocean_load_balancer table provides insights into Load Balancers within DigitalOcean. As a DevOps engineer, you can explore load balancer-specific details through this table, including configuration, status, and associated resources. Utilize it to manage and monitor the health and performance of your load balancers, ensuring optimal distribution of network traffic across your infrastructure.

Examples

List all load balancers

Explore all the load balancers in your DigitalOcean account to manage your applications' traffic, ensuring high availability and reliability. This overview can help in assessing the performance of your applications and in identifying any potential bottlenecks.

select
*
from
digitalocean_load_balancer;
select
*
from
digitalocean_load_balancer;

Get load balancer by ID

Explore which load balancers are associated with a specific ID to manage network traffic more effectively. This is useful in pinpointing the exact load balancer that needs to be modified or troubleshooted.

select
*
from
digitalocean_load_balancer
where
id = 'fad76135-48bb-49c8-a274-a9db584e1dc3';
select
*
from
digitalocean_load_balancer
where
id = 'fad76135-48bb-49c8-a274-a9db584e1dc3';

List load balancers and their rules

Discover the segments that associate load balancers with their rules, providing a comprehensive view of how traffic is directed within your DigitalOcean environment. This can help in analyzing the distribution of network loads and optimizing performance.

select
lb.name,
rule.*
from
digitalocean_load_balancer as lb,
jsonb_array_elements(forwarding_rules) as rule
select
lb.name,
rule.*
from
digitalocean_load_balancer as lb,
json_each(lb.forwarding_rules) as rule

Ensure HTTPS is used as the health check protocol

Analyze the settings to understand if your load balancers are using HTTPS for health checks. This is crucial for maintaining secure and encrypted communication in your digitalocean infrastructure.

select
name,
health_check_protocol
from
digitalocean_load_balancer
where
health_check_protocol != 'https';
select
name,
health_check_protocol
from
digitalocean_load_balancer
where
health_check_protocol != 'https';

Get Load Balancer and VPC information

Explore the association between your load balancer and virtual private cloud (VPC) within the DigitalOcean platform. This query helps you understand the network settings of your load balancer, including the VPC it is linked to and the IP range of that VPC.

select
lb.name,
vpc.name,
vpc.ip_range
from
digitalocean_load_balancer as lb,
digitalocean_vpc as vpc
where
lb.vpc_uuid = vpc.id;
select
lb.name,
vpc.name,
vpc.ip_range
from
digitalocean_load_balancer as lb,
digitalocean_vpc as vpc
where
lb.vpc_uuid = vpc.id;

Schema for digitalocean_load_balancer

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
algorithmtextThe load balancing algorithm used to determine which backend Droplet will be selected by a client. It must be either "round_robin" or "least_connections".
created_attimestamp with time zoneTime when the load balancer was created.
droplet_idsjsonbAn 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.
forwarding_rulesjsonbAn object specifying the forwarding rules for a load balancer.
health_check_healthy_thresholdbigintThe number of times a health check must pass for a backend Droplet to be marked "healthy" and be re-added to the pool.
health_check_interval_secondsbigintThe number of seconds between between two consecutive health checks.
health_check_pathtextThe path on the backend Droplets to which the load balancer instance will send a request.
health_check_portbigintAn integer representing the port on the backend Droplets on which the health check will attempt a connection.
health_check_protocoltextThe protocol used for health checks sent to the backend Droplets. The possible values are "http", "https", or "tcp".
health_check_response_timeout_secondsbigintThe number of seconds the load balancer instance will wait for a response until marking a health check as failed.
health_check_unhealthy_thresholdbigintThe number of times a health check must fail for a backend Droplet to be marked "unhealthy" and be removed from the pool.
idtext=A unique ID that can be used to identify and reference a load balancer.
ipinetAn attribute containing the public-facing IP address of the load balancer.
nametextA human-readable name for a load balancer instance.
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.
region_nametextThe name of the region the load balancer is deployed in.
region_slugtextThe unique slug identifier for the region the load balancer is deployed in.
size_slugtextThe size of the load balancer. The available sizes are "lb-small", "lb-medium", or "lb-large".
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statustextA status string indicating the current state of the load balancer. This can be "new", "active", or "errored".
sticky_sessions_cookie_nametextThe name of the cookie sent to the client. This attribute is only returned when using "cookies" for the sticky sessions type.
sticky_sessions_cookie_ttl_secondsbigintThe number of seconds until the cookie set by the load balancer expires. This attribute is only returned when using "cookies" for the sticky sessions type.
sticky_sessions_typetextAn 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".
tagtextThe name of a Droplet tag corresponding to Droplets assigned to the load balancer.
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.
urntextThe uniform resource name (URN) for the load balancer.
vpc_uuidtextA string specifying the UUID of the VPC to which the load balancer is assigned.