aws-cdk-lib.aws_elasticloadbalancing.LoadBalancerListener

interface LoadBalancerListener

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancing.LoadBalancerListener
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancing#LoadBalancerListener
Javasoftware.amazon.awscdk.services.elasticloadbalancing.LoadBalancerListener
Pythonaws_cdk.aws_elasticloadbalancing.LoadBalancerListener
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancing » LoadBalancerListener

Add a backend to the load balancer.

Example

declare const vpc: ec2.IVpc;
const lb = new elb.LoadBalancer(this, 'LB', {
  vpc,
  internetFacing: true,
  healthCheck: {
    port: 80,
  },
});

declare const myAutoScalingGroup: autoscaling.AutoScalingGroup;
lb.addTarget(myAutoScalingGroup);
lb.addListener({
  externalPort: 80,
});

Properties

NameTypeDescription
externalPortnumberExternal listening port.
allowConnectionsFrom?IConnectable[]Allow connections to the load balancer from the given set of connection peers.
externalProtocol?LoadBalancingProtocolWhat public protocol to use for load balancing.
internalPort?numberInstance listening port.
internalProtocol?LoadBalancingProtocolWhat public protocol to use for load balancing.
policyNames?string[]SSL policy names.
sslCertificateArn?stringthe ARN of the SSL certificate.

externalPort

Type: number

External listening port.


allowConnectionsFrom?

Type: IConnectable[] (optional, default: Anywhere)

Allow connections to the load balancer from the given set of connection peers.

By default, connections will be allowed from anywhere. Set this to an empty list to deny connections, or supply a custom list of peers to allow connections from (IP ranges or security groups).


externalProtocol?

Type: LoadBalancingProtocol (optional)

What public protocol to use for load balancing.

Either 'tcp', 'ssl', 'http' or 'https'.

May be omitted if the external port is either 80 or 443.


internalPort?

Type: number (optional, default: externalPort)

Instance listening port.

Same as the externalPort if not specified.


internalProtocol?

Type: LoadBalancingProtocol (optional)

What public protocol to use for load balancing.

Either 'tcp', 'ssl', 'http' or 'https'.

May be omitted if the internal port is either 80 or 443.

The instance protocol is 'tcp' if the front-end protocol is 'tcp' or 'ssl', the instance protocol is 'http' if the front-end protocol is 'https'.


policyNames?

Type: string[] (optional)

SSL policy names.


sslCertificateArn?

Type: string (optional, default: none)

the ARN of the SSL certificate.