class ListenerConfig
| Language | Type name | 
|---|---|
|  .NET | Amazon.CDK.AWS.ECS.ListenerConfig | 
|  Java | software.amazon.awscdk.services.ecs.ListenerConfig | 
|  Python | aws_cdk.aws_ecs.ListenerConfig | 
|  TypeScript (source) | @aws-cdk/aws-ecs»ListenerConfig | 
Base class for configuring listener when registering targets.
Example
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const vpc: ec2.Vpc;
const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition });
const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true });
const listener = lb.addListener('Listener', { port: 80 });
service.registerLoadBalancerTargets(
  {
    containerName: 'web',
    containerPort: 80,
    newTargetGroupId: 'ECS',
    listener: ecs.ListenerConfig.applicationListener(listener, {
      protocol: elbv2.ApplicationProtocol.HTTPS
    }),
  },
);
Initializer
new ListenerConfig()
Methods
| Name | Description | 
|---|---|
| add | Create and attach a target group to listener. | 
| static application | Create a config for adding target group to ALB listener. | 
| static network | Create a config for adding target group to NLB listener. | 
addTargets(id, target, service) 
public addTargets(id: string, target: LoadBalancerTargetOptions, service: BaseService): void
Parameters
- id string
- target LoadBalancer Target Options 
- service BaseService 
Create and attach a target group to listener.
static applicationListener(listener, props?) 
public static applicationListener(listener: ApplicationListener, props?: AddApplicationTargetsProps): ListenerConfig
Parameters
- listener ApplicationListener 
- props AddApplication Targets Props 
Returns
Create a config for adding target group to ALB listener.
static networkListener(listener, props?) 
public static networkListener(listener: NetworkListener, props?: AddNetworkTargetsProps): ListenerConfig
Parameters
- listener NetworkListener 
- props AddNetwork Targets Props 
Returns
Create a config for adding target group to NLB listener.
