AWS Elastic Load Balancing V2 LB
This page shows how to write Terraform and CloudFormation for Elastic Load Balancing V2 LB and write them securely.
aws_lb (Terraform)
The LB in Elastic Load Balancing V2 can be configured in Terraform with the resource name aws_lb. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_lb" "enabled" {
internal = false
load_balancer_type = "network"
name = "nlb"
subnets = var.public_subnet_ids
resource "aws_lb" "enabled" {
internal = false
load_balancer_type = "application"
name = "alb"
subnets = var.public_subnet_ids
resource "aws_lb" "lb_good_1" {
}
resource "aws_lb" "lb_good_2" {
}
resource "aws_lb" "enabled" {
load_balancer_type = "network"
name = "nlb"
subnets = var.public_subnet_ids
access_logs {
resource "aws_lb" "lb1" {
load_balancer_type = "application"
}
resource "aws_alb" "alb1" {
}
Parameters
-
arnoptional computed - string -
arn_suffixoptional computed - string -
customer_owned_ipv4_pooloptional - string -
dns_nameoptional computed - string -
drop_invalid_header_fieldsoptional - bool -
enable_cross_zone_load_balancingoptional - bool -
enable_deletion_protectionoptional - bool -
enable_http2optional - bool -
idoptional computed - string -
idle_timeoutoptional - number -
internaloptional computed - bool -
ip_address_typeoptional computed - string -
load_balancer_typeoptional - string -
nameoptional computed - string -
name_prefixoptional - string -
security_groupsoptional computed - set of string -
subnetsoptional computed - set of string -
tagsoptional - map from string to string -
vpc_idoptional computed - string -
zone_idoptional computed - string -
access_logslist block -
subnet_mappingset block-
allocation_idoptional - string -
ipv6_addressoptional - string -
outpost_idoptional computed - string -
private_ipv4_addressoptional - string -
subnet_idrequired - string
-
-
timeoutssingle block
Explanation in Terraform Registry
Provides a Load Balancer resource.
Note:
aws_albis known asaws_lb. The functionality is identical.
AWS::ElasticLoadBalancingV2::LoadBalancer (CloudFormation)
The LoadBalancer in ElasticLoadBalancingV2 can be configured in CloudFormation with the resource name AWS::ElasticLoadBalancingV2::LoadBalancer. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
-
IpAddressTypeoptional - String -
LoadBalancerAttributesoptional - List of LoadBalancerAttribute -
Nameoptional - String -
Schemeoptional - String -
SecurityGroupsoptional - List -
SubnetMappingsoptional - List of SubnetMapping -
Subnetsoptional - List -
Tagsoptional - List of Tag -
Typeoptional - String
Explanation in CloudFormation Registry
Specifies an Application Load Balancer, a Network Load Balancer, or a Gateway Load Balancer.
Frequently asked questions
What is AWS Elastic Load Balancing V2 LB?
AWS Elastic Load Balancing V2 LB is a resource for Elastic Load Balancing V2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Elastic Load Balancing V2 LB?
For Terraform, the melscoop-test/check, melscoop-test/check and melscoop-test/check source code examples are useful. See the Terraform Example section for further details.