AWS Elastic Load Balancing Listener Policy

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

code-icon

Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.

get-started-button

Terraform Example (aws_load_balancer_listener_policy)

Attaches a load balancer policy to an ELB Listener.

Parameters

Example Usage (from GitHub)

github-iconasrkata/SebastianUA-terraform
resource "aws_load_balancer_listener_policy" "load_balancer_listener_policy" {
  count = var.enable_load_balancer_listener_policy ? 1 : 0

  load_balancer_name = var.load_balancer_listener_policy_load_balancer_name != "" ? var.load_balancer_listener_policy_load_balancer_name : (var.enable_elb ? aws_elb.elb[0].name : null)
  load_balancer_port = var.load_balancer_listener_policy_load_balancer_port
  policy_names       = coalescelist(var.load_balancer_listener_policy_policy_names, aws_load_balancer_policy.load_balancer_policy[0].policy_name)
github-iconSebastianUA/terraform
resource "aws_load_balancer_listener_policy" "load_balancer_listener_policy" {
  count = var.enable_load_balancer_listener_policy ? 1 : 0

  load_balancer_name = var.load_balancer_listener_policy_load_balancer_name != "" ? var.load_balancer_listener_policy_load_balancer_name : (var.enable_elb ? aws_elb.elb[0].name : null)
  load_balancer_port = var.load_balancer_listener_policy_load_balancer_port
  policy_names       = coalescelist(var.load_balancer_listener_policy_policy_names, aws_load_balancer_policy.load_balancer_policy[0].policy_name)
github-iconniveklabs/aws
resource "aws_load_balancer_listener_policy" "this" {
  load_balancer_name = var.load_balancer_name
  load_balancer_port = var.load_balancer_port
  policy_names       = var.policy_names
}

github-iconCheckmarx/kics
resource "aws_load_balancer_listener_policy" "negative7" {
  load_balancer_name = aws_elb.wu-tang.name
  load_balancer_port = 443

  policy_names = [
    aws_load_balancer_policy.wu-tang-ssl.policy_name,

CloudFormation Example (AWS::ElasticLoadBalancing::LoadBalancer Listeners)

Specifies a listener for your Classic Load Balancer.

Parameters

InstancePort The port on which the instance is listening.
Required: Yes
Type: String
Minimum: 1
Maximum: 65535
Update requires: No interruption

InstanceProtocol The protocol to use for routing traffic to instances: HTTP, HTTPS, TCP, or SSL.
If the front-end protocol is TCP or SSL, the back-end protocol must be TCP or SSL. If the front-end protocol is HTTP or HTTPS, the back-end protocol must be HTTP or HTTPS.
If there is another listener with the same InstancePort whose InstanceProtocol is secure, (HTTPS or SSL), the listener's InstanceProtocol must also be secure.
If there is another listener with the same InstancePort whose InstanceProtocol is HTTP or TCP, the listener's InstanceProtocol must be HTTP or TCP.
Required: No
Type: String
Update requires: No interruption

LoadBalancerPort The port on which the load balancer is listening. On EC2-VPC, you can specify any port from the range 1-65535. On EC2-Classic, you can specify any port from the following list: 25, 80, 443, 465, 587, 1024-65535.
Required: Yes
Type: String
Update requires: No interruption

PolicyNames The names of the policies to associate with the listener.
Required: No
Type: List of String
Update requires: No interruption

Protocol The load balancer transport protocol to use for routing: HTTP, HTTPS, TCP, or SSL.
Required: Yes
Type: String
Update requires: No interruption

SSLCertificateId The Amazon Resource Name (ARN) of the server certificate.
Required: No
Type: String
Update requires: No interruption

Frequently asked questions

What is AWS Elastic Load Balancing Listener Policy?

AWS Elastic Load Balancing Listener Policy is a resource for Elastic Load Balancing 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 Listener Policy?

For Terraform, the asrkata/SebastianUA-terraform, SebastianUA/terraform and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.