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
-
arn
optional computed - string -
arn_suffix
optional computed - string -
customer_owned_ipv4_pool
optional - string -
dns_name
optional computed - string -
drop_invalid_header_fields
optional - bool -
enable_cross_zone_load_balancing
optional - bool -
enable_deletion_protection
optional - bool -
enable_http2
optional - bool -
id
optional computed - string -
idle_timeout
optional - number -
internal
optional computed - bool -
ip_address_type
optional computed - string -
load_balancer_type
optional - string -
name
optional computed - string -
name_prefix
optional - string -
security_groups
optional computed - set of string -
subnets
optional computed - set of string -
tags
optional - map from string to string -
vpc_id
optional computed - string -
zone_id
optional computed - string -
access_logs
list block -
subnet_mapping
set block-
allocation_id
optional - string -
ipv6_address
optional - string -
outpost_id
optional computed - string -
private_ipv4_address
optional - string -
subnet_id
required - string
-
-
timeouts
single block
Explanation in Terraform Registry
Provides a Load Balancer resource.
Note:
aws_alb
is 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
-
IpAddressType
optional - String -
LoadBalancerAttributes
optional - List of LoadBalancerAttribute -
Name
optional - String -
Scheme
optional - String -
SecurityGroups
optional - List -
SubnetMappings
optional - List of SubnetMapping -
Subnets
optional - List -
Tags
optional - List of Tag -
Type
optional - 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.