Skip to content
v2.278.0

ListenersProperty Struct ​

Specifies a listener for your Classic Load Balancer.

Modifying any property replaces the listener.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancing as elb } from 'aws-cdk-lib';
const listenersProperty: elb.CfnLoadBalancer.ListenersProperty = {
  instancePort: 'instancePort',
  loadBalancerPort: 'loadBalancerPort',
  protocol: 'protocol',

  // the properties below are optional
  instanceProtocol: 'instanceProtocol',
  policyNames: ['policyNames'],
  sslCertificateId: 'sslCertificateId',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticloadbalancing as elb

listeners_property = elb.CfnLoadBalancer.ListenersProperty(
    instance_port="instancePort",
    load_balancer_port="loadBalancerPort",
    protocol="protocol",

    # the properties below are optional
    instance_protocol="instanceProtocol",
    policy_names=["policyNames"],
    ssl_certificate_id="sslCertificateId"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticloadbalancing.*;

ListenersProperty listenersProperty = ListenersProperty.builder()
        .instancePort("instancePort")
        .loadBalancerPort("loadBalancerPort")
        .protocol("protocol")

        // the properties below are optional
        .instanceProtocol("instanceProtocol")
        .policyNames(List.of("policyNames"))
        .sslCertificateId("sslCertificateId")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElasticLoadBalancing;

var listenersProperty = new ListenersProperty {
    InstancePort = "instancePort",
    LoadBalancerPort = "loadBalancerPort",
    Protocol = "protocol",

    // the properties below are optional
    InstanceProtocol = "instanceProtocol",
    PolicyNames = new [] { "policyNames" },
    SslCertificateId = "sslCertificateId"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

listenersProperty := &ListenersProperty{
	InstancePort: jsii.String("instancePort"),
	LoadBalancerPort: jsii.String("loadBalancerPort"),
	Protocol: jsii.String("protocol"),

	// the properties below are optional
	InstanceProtocol: jsii.String("instanceProtocol"),
	PolicyNames: []*string{
		jsii.String("policyNames"),
	},
	SslCertificateId: jsii.String("sslCertificateId"),
}

Properties ​

instancePortstringinstance_portstrinstancePortStringInstancePortstringInstancePort*string required #
The port on which the instance is listening.
instanceProtocoloptionalstringinstance_protocoloptionalstrinstanceProtocoloptionalStringInstanceProtocoloptionalstringInstanceProtocoloptional*string #
The protocol to use for routing traffic to instances: HTTP, HTTPS, TCP, or SSL.
notes

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.

loadBalancerPortstringload_balancer_portstrloadBalancerPortStringLoadBalancerPortstringLoadBalancerPort*string required #
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.

policyNamesoptionalstring[]policy_namesoptionaltyping.List[str]policyNamesoptionalList<String>PolicyNamesoptionalstring[]PolicyNamesoptional*[]*string #
The names of the policies to associate with the listener.
protocolstringprotocolstrprotocolStringProtocolstringProtocol*string required #
The load balancer transport protocol to use for routing: HTTP, HTTPS, TCP, or SSL.
sslCertificateIdoptionalstringssl_certificate_idoptionalstrsslCertificateIdoptionalStringSslCertificateIdoptionalstringSslCertificateIdoptional*string #
The Amazon Resource Name (ARN) of the server certificate.