# ListenersProperty

Specifies a listener for your Classic Load Balancer.

Modifying any property replaces the listener.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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"
};
```

Golang:

```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

- `instancePort`: string (required) — The port on which the instance is listening.

- `instanceProtocol`: string — 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.

- `loadBalancerPort`: 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.

- `policyNames`: string[] — The names of the policies to associate with the listener.

- `protocol`: string (required) — The load balancer transport protocol to use for routing: HTTP, HTTPS, TCP, or SSL.

- `sslCertificateId`: string — The Amazon Resource Name (ARN) of the server certificate.
