IApplicationLoadBalancer

class aws_cdk.aws_elasticloadbalancingv2.IApplicationLoadBalancer(*args, **kwargs)

Bases: ILoadBalancerV2, IConnectable, Protocol

An application load balancer.

Methods

add_listener(id, *, certificates=None, default_action=None, default_target_groups=None, open=None, port=None, protocol=None, ssl_policy=None)

Add a new listener to this load balancer.

Parameters:
  • id (str) –

  • certificates (Optional[Sequence[IListenerCertificate]]) – Certificate list of ACM cert ARNs. You must provide exactly one certificate if the listener protocol is HTTPS or TLS. Default: - No certificates.

  • default_action (Optional[ListenerAction]) – Default action to take for requests to this listener. This allows full control of the default action of the load balancer, including Action chaining, fixed responses and redirect responses. See the ListenerAction class for all options. Cannot be specified together with defaultTargetGroups. Default: - None.

  • default_target_groups (Optional[Sequence[IApplicationTargetGroup]]) – Default target groups to load balance to. All target groups will be load balanced to with equal weight and without stickiness. For a more complex configuration than that, use either defaultAction or addAction(). Cannot be specified together with defaultAction. Default: - None.

  • open (Optional[bool]) – Allow anyone to connect to the load balancer on the listener port. If this is specified, the load balancer will be opened up to anyone who can reach it. For internal load balancers this is anyone in the same VPC. For public load balancers, this is anyone on the internet. If you want to be more selective about who can access this load balancer, set this to false and use the listener’s connections object to selectively grant access to the load balancer on the listener port. Default: true

  • port (Union[int, float, None]) – The port on which the listener listens for requests. Default: - Determined from protocol if known.

  • protocol (Optional[ApplicationProtocol]) – The protocol to use. Default: - Determined from port if known.

  • ssl_policy (Optional[SslPolicy]) – The security policy that defines which ciphers and protocols are supported. Default: - The current predefined security policy.

Return type:

ApplicationListener

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

Attributes

connections

The network connections associated with this resource.

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

ip_address_type

The IP Address Type for this load balancer.

Default:

IpAddressType.IPV4

listeners

A list of listeners that have been added to the load balancer.

This list is only valid for owned constructs.

load_balancer_arn

The ARN of this load balancer.

load_balancer_canonical_hosted_zone_id

The canonical hosted zone ID of this load balancer.

Example value: Z2P70J7EXAMPLE

Attribute:

true

load_balancer_dns_name

The DNS name of this load balancer.

Example value: my-load-balancer-424835706.us-west-2.elb.amazonaws.com

Attribute:

true

metrics

All metrics available for this load balancer.

node

The tree node.

stack

The stack in which this resource is defined.

vpc

The VPC this load balancer has been created in (if available).

If this interface is the result of an import call to fromApplicationLoadBalancerAttributes, the vpc attribute will be undefined unless specified in the optional properties of that method.