LoadBalancerListener

class aws_cdk.aws_elasticloadbalancing.LoadBalancerListener(*, external_port, allow_connections_from=None, external_protocol=None, internal_port=None, internal_protocol=None, policy_names=None, ssl_certificate_arn=None)

Bases: object

Add a backend to the load balancer.

Parameters:
  • external_port (Union[int, float]) – External listening port.

  • allow_connections_from (Optional[Sequence[IConnectable]]) – 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). Default: Anywhere

  • external_protocol (Optional[LoadBalancingProtocol]) – 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.

  • internal_port (Union[int, float, None]) – Instance listening port. Same as the externalPort if not specified. Default: externalPort

  • internal_protocol (Optional[LoadBalancingProtocol]) – 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’.

  • policy_names (Optional[Sequence[str]]) – SSL policy names.

  • ssl_certificate_arn (Optional[str]) – the ARN of the SSL certificate. Default: - none

ExampleMetadata:

infused

Example:

# vpc: ec2.IVpc

# my_auto_scaling_group: autoscaling.AutoScalingGroup

lb = elb.LoadBalancer(self, "LB",
    vpc=vpc,
    internet_facing=True,
    health_check=elb.HealthCheck(
        port=80
    )
)
lb.add_target(my_auto_scaling_group)
lb.add_listener(
    external_port=80
)

Attributes

allow_connections_from

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).

Default:

Anywhere

external_port

External listening port.

external_protocol

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.

internal_port

Instance listening port.

Same as the externalPort if not specified.

Default:

externalPort

internal_protocol

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’.

policy_names

SSL policy names.

ssl_certificate_arn

the ARN of the SSL certificate.

Default:
  • none