load_balancers
Creates, updates, deletes, gets or lists a load_balancers resource.
Overview
| Name | load_balancers |
| Type | Resource |
| Id | aws.elbv2.load_balancers |
Fields
The following fields are returned by SELECT queries:
- describe_load_balancers
| Name | Datatype | Description |
|---|---|---|
availability_zones | string | The subnets for the load balancer. |
canonical_hosted_zone_id | string | The ID of the Amazon Route 53 hosted zone associated with the load balancer. |
created_time | string | The date and time the load balancer was created. |
customer_owned_ipv_4_pool | string | [Application Load Balancers on Outposts] The ID of the customer-owned address pool. |
dns_name | string | The public DNS name of the load balancer. |
enable_prefix_for_ipv_6_source_nat | string | [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_traffic | string | Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through Amazon Web Services PrivateLink. |
ip_address_type | string | The 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_pools | string | [Application Load Balancers] The IPAM pool in use by the load balancer, if configured. |
load_balancer_arn | string | The Amazon Resource Name (ARN) of the load balancer. |
load_balancer_name | string | The name of the load balancer. |
scheme | string | The 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_groups | string | The IDs of the security groups for the load balancer. |
state | string | The state of the load balancer. |
type | string | The type of load balancer. |
vpc_id | string | The ID of the VPC for the load balancer. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_load_balancers | select | region | LoadBalancerArns, Names, Marker, PageSize | Describes the specified load balancers or all of your load balancers. |
create_load_balancer | insert | region | Name, Subnets, SubnetMappings, SecurityGroups, Scheme, Tags, Type, IpAddressType, CustomerOwnedIpv4Pool, EnablePrefixForIpv6SourceNat, IpamPools | 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. |
set_ip_address_type | update | LoadBalancerArn, IpAddressType, region | Sets the type of IP addresses used by the subnets of the specified load balancer. | |
set_security_groups | update | LoadBalancerArn, SecurityGroups, region | EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic | Associates 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_pools | update | LoadBalancerArn, region | IpamPools, RemoveIpamPools | [Application Load Balancers] Modify the IP pool associated to a load balancer. |
delete_load_balancer | delete | LoadBalancerArn, region | 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. | |
set_subnets | exec | LoadBalancerArn, region | Subnets, SubnetMappings, IpAddressType, EnablePrefixForIpv6SourceNat | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
IpAddressType | string | The 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). |
LoadBalancerArn | string | The Amazon Resource Name (ARN) of the load balancer. |
SecurityGroups | array | The IDs of the security groups. |
region | string | AWS region (default: us-east-1) |
CustomerOwnedIpv4Pool | string | [Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool). |
EnablePrefixForIpv6SourceNat | string | [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. |
EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic | string | Indicates 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. |
IpAddressType | string | The 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). |
IpamPools | object | The IPAM pools to be modified. |
LoadBalancerArns | array | The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call. |
Marker | string | The marker for the next set of results. (You received this marker from a previous call.) |
Name | string | The 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-". |
Names | array | The names of the load balancers. |
PageSize | integer | The maximum number of results to return with this call. |
RemoveIpamPools | array | Remove the IP pools in use by the load balancer. |
Scheme | string | The 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. |
SecurityGroups | array | [Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer. |
SubnetMappings | array | The 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. |
Subnets | array | The 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. |
Tags | array | The tags to assign to the load balancer. |
Type | string | The type of load balancer. The default is application. |
SELECT examples
- describe_load_balancers
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
- create_load_balancer
- Manifest
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
;
# Description fields are for documentation purposes
- name: load_balancers
props:
- name: region
value: "{{ region }}"
description: Required parameter for the load_balancers resource.
- name: Name
value: "{{ Name }}"
description: The 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-".
description: The 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-".
- name: Subnets
value: "{{ Subnets }}"
description: The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets. [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 and Gateway Load Balancers] You can specify subnets from one or more Availability Zones.
description: The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets. [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 and Gateway Load Balancers] You can specify subnets from one or more Availability Zones.
- name: SubnetMappings
value: "{{ SubnetMappings }}"
description: The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. [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. You can't specify Elastic IP addresses for your subnets.
description: The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. [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. You can't specify Elastic IP addresses for your subnets.
- name: SecurityGroups
value: "{{ SecurityGroups }}"
description: [Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer.
description: [Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer.
- name: Scheme
value: "{{ Scheme }}"
description: The 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.
description: The 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.
- name: Tags
value: "{{ Tags }}"
description: The tags to assign to the load balancer.
description: The tags to assign to the load balancer.
- name: Type
value: "{{ Type }}"
description: The type of load balancer. The default is application.
description: The type of load balancer. The default is application.
- name: IpAddressType
value: "{{ IpAddressType }}"
description: The 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). [Network Load Balancers and Gateway Load Balancers] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).
description: The 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). [Network Load Balancers and Gateway Load Balancers] The possible values are ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses).
- name: CustomerOwnedIpv4Pool
value: "{{ CustomerOwnedIpv4Pool }}"
description: [Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).
description: [Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).
- name: EnablePrefixForIpv6SourceNat
value: "{{ EnablePrefixForIpv6SourceNat }}"
description: [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.
description: [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.
- name: IpamPools
value: "{{ IpamPools }}"
description: [Application Load Balancers] The IPAM pools to use with the load balancer.
description: [Application Load Balancers] The IPAM pools to use with the load balancer.
UPDATE examples
- set_ip_address_type
- set_security_groups
- modify_ip_pools
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;
Associates 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.
UPDATE aws.elbv2.load_balancers
SET
-- No updatable properties
WHERE
LoadBalancerArn = '{{ LoadBalancerArn }}' --required
AND SecurityGroups = '{{ SecurityGroups }}' --required
AND region = '{{ region }}' --required
AND EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic = '{{ EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic}}'
RETURNING
line_items;
[Application Load Balancers] Modify the IP pool associated to a load balancer.
UPDATE aws.elbv2.load_balancers
SET
-- No updatable properties
WHERE
LoadBalancerArn = '{{ LoadBalancerArn }}' --required
AND region = '{{ region }}' --required
AND IpamPools = '{{ IpamPools}}'
AND RemoveIpamPools = '{{ RemoveIpamPools}}'
RETURNING
ipv_4_ipam_pool_id;
DELETE examples
- delete_load_balancer
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
- set_subnets
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 }}'
;