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, instancesfrom aws_ec2_classic_load_balancer;
select name, instancesfrom 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_enabledfrom aws_ec2_classic_load_balancerwhere access_log_enabled = 'false';
select name, access_log_enabledfrom aws_ec2_classic_load_balancerwhere 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 sgfrom aws_ec2_classic_load_balancer;
select name, json_extract(json_each.value, '$') as sgfrom 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_namesfrom 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_namesfrom 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_thresholdfrom aws_ec2_classic_load_balancer;
select name, healthy_threshold, health_check_interval, health_check_target, health_check_timeout, unhealthy_thresholdfrom aws_ec2_classic_load_balancer;
Query examples
- ec2_classic_load_balancer_az_zone
- ec2_classic_load_balancer_cross_zone_enabled
- ec2_classic_load_balancer_input
- ec2_classic_load_balancer_instances
- ec2_classic_load_balancer_logging_enabled
- ec2_classic_load_balancer_overview
- ec2_classic_load_balancer_scheme
- ec2_classic_load_balancer_tags
- ec2_classic_load_balancers_for_acm_certificate
- ec2_classic_load_balancers_for_ec2_instance
- ec2_classic_load_balancers_for_s3_bucket
- ec2_classic_load_balancers_for_vpc
- ec2_classic_load_balancers_for_vpc_security_group
- ec2_classic_load_balancers_for_vpc_subnet
- ec2_instances_for_ec2_classic_load_balancer
- s3_buckets_for_ec2_classic_load_balancer
- vpc_security_group_assoc
- vpc_security_group_egress_rule_sankey
- vpc_security_group_ingress_rule_sankey
- vpc_security_groups_for_ec2_classic_load_balancer
- vpc_subnets_for_ec2_classic_load_balancer
- vpc_vpcs_for_ec2_classic_load_balancer
Control examples
- All Controls > ELB > Classic Load Balancers should have connection draining enabled
- All Controls > ELB > ELB classic load balancers should have at least one inbound rule
- All Controls > ELB > ELB classic load balancers should have at least one outbound rule
- All Controls > ELB > ELB classic load balancers should have at least one registered instance
- All Controls > ELB > ELB load balancers should prohibit public access
- AWS Foundational Security Best Practices > ELB > 10 Classic Load Balancers should span multiple Availability Zones
- AWS Foundational Security Best Practices > ELB > 14 Classic Load Balancers should be configured with defensive or strictest desync mitigation mode
- AWS Foundational Security Best Practices > ELB > 2 Classic Load Balancers with SSL/HTTPS listeners should use a certificate provided by AWS Certificate Manager
- AWS Foundational Security Best Practices > ELB > 3 Classic Load Balancer listeners should be configured with HTTPS or TLS termination
- AWS Foundational Security Best Practices > ELB > 5 Application and Classic Load Balancers logging should be enabled
- AWS Foundational Security Best Practices > ELB > 7 Classic Load Balancers should have connection draining enabled
- AWS Foundational Security Best Practices > ELB > 9 Classic Load Balancers should have cross-zone load balancing enabled
- ELB application and classic load balancer logging should be enabled
- ELB classic load balancers should be configured with defensive or strictest desync mitigation mode
- ELB classic load balancers should have cross-zone load balancing enabled
- ELB classic load balancers should only use SSL or HTTPS listeners
- ELB classic load balancers should span multiple availability zones
- ELB classic load balancers should use SSL certificates
Schema for aws_ec2_classic_load_balancer
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
access_log_emit_interval | bigint | The interval for publishing the access logs. | |
access_log_enabled | boolean | Specifies whether access logs are enabled for the load balancer. | |
access_log_s3_bucket_name | text | The name of the Amazon S3 bucket where the access logs are stored. | |
access_log_s3_bucket_prefix | text | The logical hierarchy you created for your Amazon S3 bucket. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
additional_attributes | jsonb | A list of additional attributes. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
app_cookie_stickiness_policies | jsonb | A list of the stickiness policies created using CreateAppCookieStickinessPolicy. | |
arn | text | The Amazon Resource Name (ARN) specifying the classic load balancer. | |
availability_zones | jsonb | A list of the Availability Zones for the load balancer. | |
backend_server_descriptions | jsonb | A list of information about your EC2 instances. | |
canonical_hosted_zone_name | text | The name of the Amazon Route 53 hosted zone for the load balancer. | |
canonical_hosted_zone_name_id | text | The ID of the Amazon Route 53 hosted zone for the load balancer. | |
connection_draining_enabled | boolean | Specifies whether connection draining is enabled for the load balancer. | |
connection_draining_timeout | bigint | The maximum time, in seconds, to keep the existing connections open before deregistering the instances. | |
connection_settings_idle_timeout | bigint | The 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_time | timestamp with time zone | The date and time the load balancer was created. | |
cross_zone_load_balancing_enabled | boolean | Specifies whether cross-zone load balancing is enabled for the load balancer. | |
dns_name | text | The DNS name of the load balancer. | |
health_check_interval | bigint | The approximate interval, in seconds, between health checks of an individual instance. | |
health_check_target | text | The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. | |
health_check_timeout | bigint | The amount of time, in seconds, during which no response means a failed health check. | |
healthy_threshold | bigint | The number of consecutive health checks successes required before moving the instance to the Healthy state. | |
instances | jsonb | A list of the IDs of the instances for the load balancer. | |
lb_cookie_stickiness_policies | jsonb | A list of the stickiness policies created using CreateLBCookieStickinessPolicy. | |
listener_descriptions | jsonb | A list of the listeners for the load balancer | |
name | text | = | The friendly name of the Load Balancer. |
other_policies | jsonb | A list of policies other than the stickiness policies. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
region | text | The AWS Region in which the resource is located. | |
scheme | text | The load balancing scheme of load balancer. | |
security_groups | jsonb | A list of the security groups for the load balancer. | |
source_security_group_name | text | The name of the security group. | |
source_security_group_owner_alias | text | The owner of the security group. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
subnets | jsonb | A list of the IDs of the subnets for the load balancer. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | A list of tags attached to the load balancer. | |
title | text | Title of the resource. | |
unhealthy_threshold | bigint | The number of consecutive health check failures required before moving the instance to the Unhealthy state. | |
vpc_id | text | The 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