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_balancerwhere id = 'fad76135-48bb-49c8-a274-a9db584e1dc3';
select *from digitalocean_load_balancerwhere 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_protocolfrom digitalocean_load_balancerwhere health_check_protocol != 'https';
select name, health_check_protocolfrom digitalocean_load_balancerwhere 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_rangefrom digitalocean_load_balancer as lb, digitalocean_vpc as vpcwhere lb.vpc_uuid = vpc.id;
select lb.name, vpc.name, vpc.ip_rangefrom digitalocean_load_balancer as lb, digitalocean_vpc as vpcwhere lb.vpc_uuid = vpc.id;
Query examples
Schema for digitalocean_load_balancer
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
algorithm | text | The 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_at | timestamp with time zone | Time when the load balancer was created. | |
droplet_ids | jsonb | An array containing the IDs of the Droplets assigned to the load balancer. | |
enable_backend_keepalive | boolean | A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. | |
enable_proxy_protocol | boolean | A boolean value indicating whether PROXY Protocol is in use. | |
forwarding_rules | jsonb | An object specifying the forwarding rules for a load balancer. | |
health_check_healthy_threshold | bigint | The 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_seconds | bigint | The number of seconds between between two consecutive health checks. | |
health_check_path | text | The path on the backend Droplets to which the load balancer instance will send a request. | |
health_check_port | bigint | An integer representing the port on the backend Droplets on which the health check will attempt a connection. | |
health_check_protocol | text | The protocol used for health checks sent to the backend Droplets. The possible values are "http", "https", or "tcp". | |
health_check_response_timeout_seconds | bigint | The number of seconds the load balancer instance will wait for a response until marking a health check as failed. | |
health_check_unhealthy_threshold | bigint | The number of times a health check must fail for a backend Droplet to be marked "unhealthy" and be removed from the pool. | |
id | text | = | A unique ID that can be used to identify and reference a load balancer. |
ip | inet | An attribute containing the public-facing IP address of the load balancer. | |
name | text | A human-readable name for a load balancer instance. | |
redirect_http_to_https | boolean | A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443. | |
region_name | text | The name of the region the load balancer is deployed in. | |
region_slug | text | The unique slug identifier for the region the load balancer is deployed in. | |
size_slug | text | The size of the load balancer. The available sizes are "lb-small", "lb-medium", or "lb-large". | |
status | text | A status string indicating the current state of the load balancer. This can be "new", "active", or "errored". | |
sticky_sessions_cookie_name | text | The 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_seconds | bigint | The 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_type | text | 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". | |
tag | text | The name of a Droplet tag corresponding to Droplets assigned to the load balancer. | |
tags | jsonb | A map of tags for the resource. | |
title | text | Title of the resource. | |
urn | text | The uniform resource name (URN) for the load balancer. | |
vpc_uuid | text | A string specifying the UUID of the VPC to which the load balancer is assigned. |