aws-cdk-lib.aws_elasticloadbalancingv2.IApplicationListener

interface IApplicationListener

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancingV2.IApplicationListener
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#IApplicationListener
Javasoftware.amazon.awscdk.services.elasticloadbalancingv2.IApplicationListener
Pythonaws_cdk.aws_elasticloadbalancingv2.IApplicationListener
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancingv2 » IApplicationListener

Implemented by ApplicationListener

Obtainable from ApplicationListener.fromApplicationListenerAttributes(), ApplicationListener.fromLookup()

Properties to reference an existing listener.

Properties

NameTypeDescription
connectionsConnectionsThe network connections associated with this resource.
envResourceEnvironmentThe environment this resource belongs to.
listenerArnstringARN of the listener.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.

connections

Type: Connections

The network connections associated with this resource.


env

Type: ResourceEnvironment

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.


listenerArn

Type: string

ARN of the listener.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addAction(id, props)Perform the given action on incoming requests.
addCertificates(id, certificates)Add one or more certificates to this listener.
addTargetGroups(id, props)Load balance incoming requests to the given target groups.
addTargets(id, props)Load balance incoming requests to the given load balancing targets.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
registerConnectable(connectable, portRange)Register that a connectable that has been added to this load balancer.

addAction(id, props)

public addAction(id: string, props: AddApplicationActionProps): void

Parameters

  • id string
  • props AddApplicationActionProps

Perform the given action on incoming requests.

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.

It's possible to add routing conditions to the Action added in this way.

It is not possible to add a default action to an imported IApplicationListener. In order to add actions to an imported IApplicationListener a priority must be provided.


addCertificates(id, certificates)

public addCertificates(id: string, certificates: IListenerCertificate[]): void

Parameters

  • id string
  • certificates IListenerCertificate[]

Add one or more certificates to this listener.


addTargetGroups(id, props)

public addTargetGroups(id: string, props: AddApplicationTargetGroupsProps): void

Parameters

  • id string
  • props AddApplicationTargetGroupsProps

Load balance incoming requests to the given target groups.

It's possible to add conditions to the TargetGroups added in this way. At least one TargetGroup must be added without conditions.


addTargets(id, props)

public addTargets(id: string, props: AddApplicationTargetsProps): ApplicationTargetGroup

Parameters

  • id string
  • props AddApplicationTargetsProps

Returns

  • ApplicationTargetGroup

Load balance incoming requests to the given load balancing targets.

This method implicitly creates an ApplicationTargetGroup for the targets involved.

It's possible to add conditions to the targets added in this way. At least one set of targets must be added without conditions.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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


registerConnectable(connectable, portRange)

public registerConnectable(connectable: IConnectable, portRange: Port): void

Parameters

  • connectable IConnectable
  • portRange Port

Register that a connectable that has been added to this load balancer.

Don't call this directly. It is called by ApplicationTargetGroup.