AWS Elastic Load Balancing V2 Listener

This page shows how to write Terraform and CloudFormation for Elastic Load Balancing V2 Listener and write them securely.

aws_lb_listener (Terraform)

The Listener in Elastic Load Balancing V2 can be configured in Terraform with the resource name aws_lb_listener. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

github-iconmelscoop-test/check
resource "aws_lb_listener" "http_redirect" {
  load_balancer_arn = var.aws_lb_arn
  protocol          = "HTTP"
  port              = "80"

  default_action {
github-iconmelscoop-test/check
resource "aws_lb_listener" "listener_good_1" {
  load_balancer_arn = aws_lb.lb_good_1.arn
  port = "443"
  protocol = "HTTPS"

  default_action {
github-iconreturntocorp/semgrep-rules
resource "aws_lb_listener" "http_redirect" {
  load_balancer_arn = var.aws_lb_arn
  # ok: insecure-load-balancer-tls-version
  protocol          = "HTTP"
  port              = "80"

github-iconSnidermanIndustries/checkov-fork
resource "aws_lb_listener" "http_redirect" {
  load_balancer_arn = var.aws_lb_arn
  protocol          = "HTTP"
  port              = "80"

  default_action {

Parameters

Explanation in Terraform Registry

Provides a Load Balancer Listener resource.

Note: aws_alb_listener is known as aws_lb_listener. The functionality is identical.

AWS::ElasticLoadBalancingV2::Listener (CloudFormation)

The Listener in ElasticLoadBalancingV2 can be configured in CloudFormation with the resource name AWS::ElasticLoadBalancingV2::Listener. The following sections describe how to use the resource and its parameters.

Parameters

Explanation in CloudFormation Registry

Specifies a listener for an Application Load Balancer or Network Load Balancer.

Frequently asked questions

What is AWS Elastic Load Balancing V2 Listener?

AWS Elastic Load Balancing V2 Listener 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 Listener?

For Terraform, the melscoop-test/check, melscoop-test/check and returntocorp/semgrep-rules source code examples are useful. See the Terraform Example section for further details.