load_balancers
Creates, updates, deletes or gets a load_balancer resource or lists load_balancers in a region
Overview
| Name | load_balancers |
| Type | Resource |
| Description | Specifies an Application Load Balancer, a Network Load Balancer, or a Gateway Load Balancer. |
| Id | awscc.elasticloadbalancingv2.load_balancers |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
ip_address_type | string | The IP address type. Internal load balancers must use ``ipv4``.<br />[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).<br />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.<br />[Network Load Balancers and Gateway Load Balancers] The possible values are ``ipv4`` (IPv4 addresses) and ``dualstack`` (IPv4 and IPv6 addresses). |
enable_prefix_for_ipv6_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``. |
security_groups | array | [Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer. |
load_balancer_attributes | array | The load balancer attributes. Attributes that you do not modify retain their current values. |
minimum_load_balancer_capacity | object | The minimum capacity for a 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.<br />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.<br />The default is an Internet-facing load balancer.<br />You can't specify a scheme for a Gateway Load Balancer. |
dns_name | string | |
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-".<br />If you don't specify a name, AWS CloudFormation generates a unique physical ID for the load balancer. If you specify a name, you cannot perform updates that require replacement of this resource, but you can perform other updates. To replace the resource, specify a new name. |
load_balancer_name | string | |
load_balancer_full_name | string | |
subnets | array | 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.<br />[Application Load Balancers] You must specify subnets from at least two Availability Zones.<br />[Application Load Balancers on Outposts] You must specify one Outpost subnet.<br />[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.<br />[Network Load Balancers and Gateway Load Balancers] You can specify subnets from one or more Availability Zones. |
type | string | The type of load balancer. The default is ``application``. |
canonical_hosted_zone_id | string | |
tags | array | The tags to assign to the load balancer. |
load_balancer_arn | string | |
subnet_mappings | array | 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.<br />[Application Load Balancers] You must specify subnets from at least two Availability Zones. You can't specify Elastic IP addresses for your subnets.<br />[Application Load Balancers on Outposts] You must specify one Outpost subnet.<br />[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.<br />[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.<br />[Gateway Load Balancers] You can specify subnets from one or more Availability Zones. You can't specify Elastic IP addresses for your subnets. |
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 privatelink. The default is ``on``.<br />You can't configure this property on a Network Load Balancer unless you associated a security group with the load balancer when you created it. |
ipv4_ipam_pool_id | string | The ID of the IPv4 IPAM pool. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
load_balancer_arn | string | |
region | string | AWS region. |
For more information, see AWS::ElasticLoadBalancingV2::LoadBalancer.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | load_balancers | INSERT | region |
delete_resource | load_balancers | DELETE | Identifier, region |
update_resource | load_balancers | UPDATE | Identifier, PatchDocument, region |
list_resources | load_balancers_list_only | SELECT | region |
get_resource | load_balancers | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual load_balancer.
SELECT
region,
ip_address_type,
enable_prefix_for_ipv6_source_nat,
security_groups,
load_balancer_attributes,
minimum_load_balancer_capacity,
scheme,
dns_name,
name,
load_balancer_name,
load_balancer_full_name,
subnets,
type,
canonical_hosted_zone_id,
tags,
load_balancer_arn,
subnet_mappings,
enforce_security_group_inbound_rules_on_private_link_traffic,
ipv4_ipam_pool_id
FROM awscc.elasticloadbalancingv2.load_balancers
WHERE
region = 'us-east-1' AND
Identifier = '{{ load_balancer_arn }}';
Lists all load_balancers in a region.
SELECT
region,
load_balancer_arn
FROM awscc.elasticloadbalancingv2.load_balancers_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new load_balancer resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.load_balancers (
IpAddressType,
EnablePrefixForIpv6SourceNat,
SecurityGroups,
LoadBalancerAttributes,
MinimumLoadBalancerCapacity,
Scheme,
Name,
Subnets,
Type,
Tags,
SubnetMappings,
EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic,
Ipv4IpamPoolId,
region
)
SELECT
'{{ ip_address_type }}',
'{{ enable_prefix_for_ipv6_source_nat }}',
'{{ security_groups }}',
'{{ load_balancer_attributes }}',
'{{ minimum_load_balancer_capacity }}',
'{{ scheme }}',
'{{ name }}',
'{{ subnets }}',
'{{ type }}',
'{{ tags }}',
'{{ subnet_mappings }}',
'{{ enforce_security_group_inbound_rules_on_private_link_traffic }}',
'{{ ipv4_ipam_pool_id }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.elasticloadbalancingv2.load_balancers (
IpAddressType,
EnablePrefixForIpv6SourceNat,
SecurityGroups,
LoadBalancerAttributes,
MinimumLoadBalancerCapacity,
Scheme,
Name,
Subnets,
Type,
Tags,
SubnetMappings,
EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic,
Ipv4IpamPoolId,
region
)
SELECT
'{{ ip_address_type }}',
'{{ enable_prefix_for_ipv6_source_nat }}',
'{{ security_groups }}',
'{{ load_balancer_attributes }}',
'{{ minimum_load_balancer_capacity }}',
'{{ scheme }}',
'{{ name }}',
'{{ subnets }}',
'{{ type }}',
'{{ tags }}',
'{{ subnet_mappings }}',
'{{ enforce_security_group_inbound_rules_on_private_link_traffic }}',
'{{ ipv4_ipam_pool_id }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: load_balancer
props:
- name: ip_address_type
value: '{{ ip_address_type }}'
- name: enable_prefix_for_ipv6_source_nat
value: '{{ enable_prefix_for_ipv6_source_nat }}'
- name: security_groups
value:
- '{{ security_groups[0] }}'
- name: load_balancer_attributes
value:
- value: '{{ value }}'
key: '{{ key }}'
- name: minimum_load_balancer_capacity
value:
capacity_units: '{{ capacity_units }}'
- name: scheme
value: '{{ scheme }}'
- name: name
value: '{{ name }}'
- name: subnets
value:
- '{{ subnets[0] }}'
- name: type
value: '{{ type }}'
- name: tags
value:
- value: '{{ value }}'
key: '{{ key }}'
- name: subnet_mappings
value:
- subnet_id: '{{ subnet_id }}'
allocation_id: '{{ allocation_id }}'
private_ipv4_address: '{{ private_ipv4_address }}'
ipv6_address: '{{ ipv6_address }}'
source_nat_ipv6_prefix: '{{ source_nat_ipv6_prefix }}'
- name: enforce_security_group_inbound_rules_on_private_link_traffic
value: '{{ enforce_security_group_inbound_rules_on_private_link_traffic }}'
- name: ipv4_ipam_pool_id
value: '{{ ipv4_ipam_pool_id }}'
UPDATE example
Use the following StackQL query and manifest file to update a load_balancer resource, using stack-deploy.
/*+ update */
UPDATE awscc.elasticloadbalancingv2.load_balancers
SET PatchDocument = string('{{ {
"IpAddressType": ip_address_type,
"EnablePrefixForIpv6SourceNat": enable_prefix_for_ipv6_source_nat,
"SecurityGroups": security_groups,
"LoadBalancerAttributes": load_balancer_attributes,
"MinimumLoadBalancerCapacity": minimum_load_balancer_capacity,
"Subnets": subnets,
"Tags": tags,
"SubnetMappings": subnet_mappings,
"EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic": enforce_security_group_inbound_rules_on_private_link_traffic,
"Ipv4IpamPoolId": ipv4_ipam_pool_id
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ load_balancer_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.elasticloadbalancingv2.load_balancers
WHERE
Identifier = '{{ load_balancer_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the load_balancers resource, the following permissions are required:
- Create
- Delete
- List
- Read
- Update
elasticloadbalancing:CreateLoadBalancer,
elasticloadbalancing:DescribeLoadBalancers,
elasticloadbalancing:ModifyLoadBalancerAttributes,
elasticloadbalancing:AddTags,
ec2:DescribeIpamPools
elasticloadbalancing:DescribeLoadBalancers,
elasticloadbalancing:DeleteLoadBalancer
elasticloadbalancing:DescribeLoadBalancers
elasticloadbalancing:DescribeLoadBalancers,
elasticloadbalancing:DescribeLoadBalancerAttributes,
elasticloadbalancing:DescribeCapacityReservation,
elasticloadbalancing:DescribeTags
elasticloadbalancing:ModifyLoadBalancerAttributes,
elasticloadbalancing:ModifyCapacityReservation,
elasticloadbalancing:SetSubnets,
elasticloadbalancing:SetIpAddressType,
elasticloadbalancing:ModifyIpPools,
elasticloadbalancing:SetSecurityGroups,
elasticloadbalancing:AddTags,
elasticloadbalancing:RemoveTags