steampipe plugin install aws

Table: aws_ec2_classic_load_balancer - Query AWS EC2 Classic Load Balancer using SQL

The AWS EC2 Classic Load Balancer automatically distributes incoming application traffic across multiple Amazon EC2 instances in the cloud. It enables you to achieve greater levels of fault tolerance in your applications, seamlessly providing the required amount of load balancing capacity needed to distribute application traffic. This service offers a highly available, scalable, and predictable performance to distribute the workload evenly to the backend servers.

Table Usage Guide

The aws_ec2_classic_load_balancer table in Steampipe provides you with information about Classic Load Balancers within Amazon Elastic Compute Cloud (EC2). This table allows you, as a cloud engineer, developer, or administrator, to query load balancer-specific details, including its availability zones, security groups, backend server descriptions, and listener descriptions. You can utilize this table to gather insights on load balancers, such as their configurations, attached instances, health checks, and more. The schema outlines the various attributes of the Classic Load Balancer for you, including the load balancer name, DNS name, created time, and associated tags.

Examples

Instances associated with classic load balancers

Identify the instances that are linked with classic load balancers to effectively manage and balance network traffic.

select
name,
instances
from
aws_ec2_classic_load_balancer;
select
name,
instances
from
aws_ec2_classic_load_balancer;

List of classic load balancers whose logging is not enabled

Determine the areas in which classic load balancers are operating without logging enabled. This is useful for identifying potential security gaps, as logging provides a record of all requests handled by the load balancer.

select
name,
access_log_enabled
from
aws_ec2_classic_load_balancer
where
access_log_enabled = 'false';
select
name,
access_log_enabled
from
aws_ec2_classic_load_balancer
where
access_log_enabled = 'false';

Security groups attached to each classic load balancer

Identify the security groups associated with each classic load balancer to ensure proper access control and minimize potential security risks.

select
name,
jsonb_array_elements_text(security_groups) as sg
from
aws_ec2_classic_load_balancer;
select
name,
json_extract(json_each.value, '$') as sg
from
aws_ec2_classic_load_balancer,
json_each(security_groups);

Classic load balancers listener info

Uncover the details of your classic load balancer's listeners to understand how each instance is configured, including the protocols used, port numbers, SSL certificates, and any associated policy names. This information can help you manage and optimize your load balancing strategy.

select
name,
listener_description -> 'Listener' ->> 'InstancePort' as instance_port,
listener_description -> 'Listener' ->> 'InstanceProtocol' as instance_protocol,
listener_description -> 'Listener' ->> 'LoadBalancerPort' as load_balancer_port,
listener_description -> 'Listener' ->> 'Protocol' as load_balancer_protocol,
listener_description -> 'SSLCertificateId' ->> 'SSLCertificateId' as ssl_certificate,
listener_description -> 'Listener' ->> 'PolicyNames' as policy_names
from
aws_ec2_classic_load_balancer
cross join jsonb_array_elements(listener_descriptions) as listener_description;
select
name,
json_extract(
listener_description.value,
'$.Listener.InstancePort'
) as instance_port,
json_extract(
listener_description.value,
'$.Listener.InstanceProtocol'
) as instance_protocol,
json_extract(
listener_description.value,
'$.Listener.LoadBalancerPort'
) as load_balancer_port,
json_extract(listener_description.value, '$.Listener.Protocol') as load_balancer_protocol,
json_extract(
listener_description.value,
'$.SSLCertificateId.SSLCertificateId'
) as ssl_certificate,
json_extract(
listener_description.value,
'$.Listener.PolicyNames'
) as policy_names
from
aws_ec2_classic_load_balancer,
json_each(listener_descriptions) as listener_description;

Health check info

Explore the health status of your classic load balancers in AWS EC2 by analyzing parameters such as threshold values, check intervals, and timeouts. This information can be crucial for maintaining optimal server performance and minimizing downtime.

select
name,
healthy_threshold,
health_check_interval,
health_check_target,
health_check_timeout,
unhealthy_threshold
from
aws_ec2_classic_load_balancer;
select
name,
healthy_threshold,
health_check_interval,
health_check_target,
health_check_timeout,
unhealthy_threshold
from
aws_ec2_classic_load_balancer;

Control examples

Schema for aws_ec2_classic_load_balancer

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
access_log_emit_intervalbigintThe interval for publishing the access logs.
access_log_enabledbooleanSpecifies whether access logs are enabled for the load balancer.
access_log_s3_bucket_nametextThe name of the Amazon S3 bucket where the access logs are stored.
access_log_s3_bucket_prefixtextThe logical hierarchy you created for your Amazon S3 bucket.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
additional_attributesjsonbA list of additional attributes.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
app_cookie_stickiness_policiesjsonbA list of the stickiness policies created using CreateAppCookieStickinessPolicy.
arntextThe Amazon Resource Name (ARN) specifying the classic load balancer.
availability_zonesjsonbA list of the Availability Zones for the load balancer.
backend_server_descriptionsjsonbA list of information about your EC2 instances.
canonical_hosted_zone_nametextThe name of the Amazon Route 53 hosted zone for the load balancer.
canonical_hosted_zone_name_idtextThe ID of the Amazon Route 53 hosted zone for the load balancer.
connection_draining_enabledbooleanSpecifies whether connection draining is enabled for the load balancer.
connection_draining_timeoutbigintThe maximum time, in seconds, to keep the existing connections open before deregistering the instances.
connection_settings_idle_timeoutbigintThe time, in seconds, that the connection is allowed to be idle (no data has been sent over the connection) before it is closed by the load balancer.
created_timetimestamp with time zoneThe date and time the load balancer was created.
cross_zone_load_balancing_enabledbooleanSpecifies whether cross-zone load balancing is enabled for the load balancer.
dns_nametextThe DNS name of the load balancer.
health_check_intervalbigintThe approximate interval, in seconds, between health checks of an individual instance.
health_check_targettextThe instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.
health_check_timeoutbigintThe amount of time, in seconds, during which no response means a failed health check.
healthy_thresholdbigintThe number of consecutive health checks successes required before moving the instance to the Healthy state.
instancesjsonbA list of the IDs of the instances for the load balancer.
lb_cookie_stickiness_policiesjsonbA list of the stickiness policies created using CreateLBCookieStickinessPolicy.
listener_descriptionsjsonbA list of the listeners for the load balancer
nametext=The friendly name of the Load Balancer.
other_policiesjsonbA list of policies other than the stickiness policies.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
regiontextThe AWS Region in which the resource is located.
schemetextThe load balancing scheme of load balancer.
security_groupsjsonbA list of the security groups for the load balancer.
source_security_group_nametextThe name of the security group.
source_security_group_owner_aliastextThe owner of the security group.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
subnetsjsonbA list of the IDs of the subnets for the load balancer.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags attached to the load balancer.
titletextTitle of the resource.
unhealthy_thresholdbigintThe number of consecutive health check failures required before moving the instance to the Unhealthy state.
vpc_idtextThe ID of the VPC for the load balancer.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws

You can pass the configuration to the command with the --config argument:

steampipe_export_aws --config '<your_config>' aws_ec2_classic_load_balancer