interface IApplicationListener
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancingV2.IApplicationListener |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#IApplicationListener |
Java | software.amazon.awscdk.services.elasticloadbalancingv2.IApplicationListener |
Python | aws_cdk.aws_elasticloadbalancingv2.IApplicationListener |
TypeScript (source) | aws-cdk-lib » aws_elasticloadbalancingv2 » IApplicationListener |
Implemented by
Application
Obtainable from
Application.fromApplicationListenerAttributes(), Application.fromLookup()
Properties to reference an existing listener.
Properties
| Name | Type | Description |
|---|---|---|
| connections | Connections | The network connections associated with this resource. |
| env | Resource | The environment this resource belongs to. |
| is | boolean | Indicates that this is an ALB listener. |
| listener | string | ARN of the listener. |
| listener | Listener | A reference to a Listener resource. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
connections
Type:
Connections
The network connections associated with this resource.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
isApplicationListener
Type:
boolean
Indicates that this is an ALB listener.
Will always return true, but is necessary to prevent accidental structural equality in TypeScript.
listenerArn
Type:
string
ARN of the listener.
listenerRef
Type:
Listener
A reference to a Listener resource.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
| Name | Description |
|---|---|
| add | Perform the given action on incoming requests. |
| add | Add one or more certificates to this listener. |
| add | Load balance incoming requests to the given target groups. |
| add | Load balance incoming requests to the given load balancing targets. |
| apply | Apply the given removal policy to this resource. |
| register | 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
AddApplication Action Props
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
AddApplication Target Groups Props
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
AddApplication Targets Props
Returns
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.

.NET
Go
Java
Python
TypeScript (