Skip to main content

load_balancers

Creates, updates, deletes, gets or lists a load_balancers resource.

Overview

Nameload_balancers
TypeResource
Idaws.elbv2.load_balancers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
availability_zonesstringThe subnets for the load balancer.
canonical_hosted_zone_idstringThe ID of the Amazon Route 53 hosted zone associated with the load balancer.
created_timestringThe date and time the load balancer was created.
customer_owned_ipv_4_poolstring[Application Load Balancers on Outposts] The ID of the customer-owned address pool.
dns_namestringThe public DNS name of the load balancer.
enable_prefix_for_ipv_6_source_natstring[Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be dualstack. The default value is off.
enforce_security_group_inbound_rules_on_private_link_trafficstringIndicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through Amazon Web Services PrivateLink.
ip_address_typestringThe type of IP addresses used for public or private connections by the subnets attached to your load balancer. [Application Load Balancers] The possible values are ipv4 (IPv4 addresses), dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public IPv6 addresses and private IPv4 and IPv6 addresses). [Network Load Balancers and Gateway Load Balancers] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).
ipam_poolsstring[Application Load Balancers] The IPAM pool in use by the load balancer, if configured.
load_balancer_arnstringThe Amazon Resource Name (ARN) of the load balancer.
load_balancer_namestringThe name of the load balancer.
schemestringThe nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet. The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.
security_groupsstringThe IDs of the security groups for the load balancer.
statestringThe state of the load balancer.
typestringThe type of load balancer.
vpc_idstringThe ID of the VPC for the load balancer.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_load_balancersselectregionLoadBalancerArns, Names, Marker, PageSizeDescribes the specified load balancers or all of your load balancers.
create_load_balancerinsertregionName, Subnets, SubnetMappings, SecurityGroups, Scheme, Tags, Type, IpAddressType, CustomerOwnedIpv4Pool, EnablePrefixForIpv6SourceNat, IpamPoolsCreates an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. For more information, see the following: Application Load Balancers Network Load Balancers Gateway Load Balancers This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.
set_ip_address_typeupdateLoadBalancerArn, IpAddressType, regionSets the type of IP addresses used by the subnets of the specified load balancer.
set_security_groupsupdateLoadBalancerArn, SecurityGroups, regionEnforceSecurityGroupInboundRulesOnPrivateLinkTrafficAssociates the specified security groups with the specified Application Load Balancer or Network Load Balancer. The specified security groups override the previously associated security groups. You can't perform this operation on a Network Load Balancer unless you specified a security group for the load balancer when you created it. You can't associate a security group with a Gateway Load Balancer.
modify_ip_poolsupdateLoadBalancerArn, regionIpamPools, RemoveIpamPools[Application Load Balancers] Modify the IP pool associated to a load balancer.
delete_load_balancerdeleteLoadBalancerArn, regionDeletes the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. Deleting a load balancer also deletes its listeners. You can't delete a load balancer if deletion protection is enabled. If the load balancer does not exist or has already been deleted, the call succeeds. Deleting a load balancer does not affect its registered targets. For example, your EC2 instances continue to run and are still registered to their target groups. If you no longer need these EC2 instances, you can stop or terminate them.
set_subnetsexecLoadBalancerArn, regionSubnets, SubnetMappings, IpAddressType, EnablePrefixForIpv6SourceNatEnables the Availability Zones for the specified public subnets for the specified Application Load Balancer, Network Load Balancer or Gateway Load Balancer. The specified subnets replace the previously enabled subnets.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
IpAddressTypestringThe IP address type. Internal load balancers must use ipv4. [Application Load Balancers] The possible values are ipv4 (IPv4 addresses), dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public IPv6 addresses and private IPv4 and IPv6 addresses). Application Load Balancer authentication supports IPv4 addresses only when connecting to an Identity Provider (IdP) or Amazon Cognito endpoint. Without a public IPv4 address the load balancer can't complete the authentication process, resulting in HTTP 500 errors. [Network Load Balancers and Gateway Load Balancers] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).
LoadBalancerArnstringThe Amazon Resource Name (ARN) of the load balancer.
SecurityGroupsarrayThe IDs of the security groups.
regionstringAWS region (default: us-east-1)
CustomerOwnedIpv4Poolstring[Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).
EnablePrefixForIpv6SourceNatstring[Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be dualstack. The default value is off.
EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficstringIndicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through Amazon Web Services PrivateLink. Applies only if the load balancer has an associated security group. The default is on.
IpAddressTypestringThe IP address type. [Application Load Balancers] The possible values are ipv4 (IPv4 addresses), dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public IPv6 addresses and private IPv4 and IPv6 addresses). [Network Load Balancers and Gateway Load Balancers] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).
IpamPoolsobjectThe IPAM pools to be modified.
LoadBalancerArnsarrayThe Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.
MarkerstringThe marker for the next set of results. (You received this marker from a previous call.)
NamestringThe name of the load balancer. This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with "internal-".
NamesarrayThe names of the load balancers.
PageSizeintegerThe maximum number of results to return with this call.
RemoveIpamPoolsarrayRemove the IP pools in use by the load balancer.
SchemestringThe nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet. The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer. The default is an Internet-facing load balancer. You can't specify a scheme for a Gateway Load Balancer.
SecurityGroupsarray[Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer.
SubnetMappingsarrayThe IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings. [Application Load Balancers] You must specify subnets from at least two Availability Zones. You can't specify Elastic IP addresses for your subnets. [Application Load Balancers on Outposts] You must specify one Outpost subnet. [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones. [Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet. [Gateway Load Balancers] You can specify subnets from one or more Availability Zones.
SubnetsarrayThe IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings. [Application Load Balancers] You must specify subnets from at least two Availability Zones. [Application Load Balancers on Outposts] You must specify one Outpost subnet. [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones. [Network Load Balancers] You can specify subnets from one or more Availability Zones. [Gateway Load Balancers] You can specify subnets from one or more Availability Zones. You must include all subnets that were enabled previously, with their existing configurations, plus any additional subnets.
TagsarrayThe tags to assign to the load balancer.
TypestringThe type of load balancer. The default is application.

SELECT examples

Describes the specified load balancers or all of your load balancers.

SELECT
availability_zones,
canonical_hosted_zone_id,
created_time,
customer_owned_ipv_4_pool,
dns_name,
enable_prefix_for_ipv_6_source_nat,
enforce_security_group_inbound_rules_on_private_link_traffic,
ip_address_type,
ipam_pools,
load_balancer_arn,
load_balancer_name,
scheme,
security_groups,
state,
type,
vpc_id
FROM aws.elbv2.load_balancers
WHERE region = '{{ region }}' -- required
AND LoadBalancerArns = '{{ LoadBalancerArns }}'
AND Names = '{{ Names }}'
AND Marker = '{{ Marker }}'
AND PageSize = '{{ PageSize }}'
;

INSERT examples

Creates an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. For more information, see the following: Application Load Balancers Network Load Balancers Gateway Load Balancers This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.

INSERT INTO aws.elbv2.load_balancers (
region,
Name,
Subnets,
SubnetMappings,
SecurityGroups,
Scheme,
Tags,
Type,
IpAddressType,
CustomerOwnedIpv4Pool,
EnablePrefixForIpv6SourceNat,
IpamPools
)
SELECT
'{{ region }}',
'{{ Name }}',
'{{ Subnets }}',
'{{ SubnetMappings }}',
'{{ SecurityGroups }}',
'{{ Scheme }}',
'{{ Tags }}',
'{{ Type }}',
'{{ IpAddressType }}',
'{{ CustomerOwnedIpv4Pool }}',
'{{ EnablePrefixForIpv6SourceNat }}',
'{{ IpamPools }}'
RETURNING
line_items
;

UPDATE examples

Sets the type of IP addresses used by the subnets of the specified load balancer.

UPDATE aws.elbv2.load_balancers
SET
-- No updatable properties
WHERE
LoadBalancerArn = '{{ LoadBalancerArn }}' --required
AND IpAddressType = '{{ IpAddressType }}' --required
AND region = '{{ region }}' --required
RETURNING
line_items;

DELETE examples

Deletes the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. Deleting a load balancer also deletes its listeners. You can't delete a load balancer if deletion protection is enabled. If the load balancer does not exist or has already been deleted, the call succeeds. Deleting a load balancer does not affect its registered targets. For example, your EC2 instances continue to run and are still registered to their target groups. If you no longer need these EC2 instances, you can stop or terminate them.

DELETE FROM aws.elbv2.load_balancers
WHERE LoadBalancerArn = '{{ LoadBalancerArn }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Enables the Availability Zones for the specified public subnets for the specified Application Load Balancer, Network Load Balancer or Gateway Load Balancer. The specified subnets replace the previously enabled subnets.

EXEC aws.elbv2.load_balancers.set_subnets
@LoadBalancerArn='{{ LoadBalancerArn }}' --required,
@region='{{ region }}' --required,
@Subnets='{{ Subnets }}',
@SubnetMappings='{{ SubnetMappings }}',
@IpAddressType='{{ IpAddressType }}',
@EnablePrefixForIpv6SourceNat='{{ EnablePrefixForIpv6SourceNat }}'
;