ListenerRuleConfiguration Class
Represents a listener configuration for advanced load balancer settings.
Example
ts
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const blueTargetGroup: elbv2.ApplicationTargetGroup;
declare const greenTargetGroup: elbv2.ApplicationTargetGroup;
declare const prodListenerRule: elbv2.ApplicationListenerRule;
const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
deploymentStrategy: ecs.DeploymentStrategy.LINEAR,
linearConfiguration: {
stepPercent: 10.0,
stepBakeTime: Duration.minutes(5),
},
});
const target = service.loadBalancerTarget({
containerName: 'web',
containerPort: 80,
alternateTarget: new ecs.AlternateTarget('AlternateTarget', {
alternateTargetGroup: greenTargetGroup,
productionListener: ecs.ListenerRuleConfiguration.applicationListenerRule(prodListenerRule),
}),
});
target.attachToApplicationTargetGroup(blueTargetGroup);
Initializer
ts
new ListenerRuleConfiguration()
python
ListenerRuleConfiguration()
java
new ListenerRuleConfiguration()
csharp
new ListenerRuleConfiguration()
go
NewListenerRuleConfiguration()
Methods
applicationListenerRule(rule: ApplicationListenerRule): ListenerRuleConfiguration // chainable@staticmethod def application_listener_rule(rule: ApplicationListenerRule) -> ListenerRuleConfigurationpublic static ListenerRuleConfiguration applicationListenerRule(ApplicationListenerRule rule)public static ListenerRuleConfiguration ApplicationListenerRule(ApplicationListenerRule rule)func ApplicationListenerRule(Rule ApplicationListenerRule) ListenerRuleConfigurationstatic#Use an Application Load Balancer listener rule.
networkListener(listener: NetworkListener): ListenerRuleConfiguration // chainable@staticmethod def network_listener(listener: NetworkListener) -> ListenerRuleConfigurationpublic static ListenerRuleConfiguration networkListener(NetworkListener listener)public static ListenerRuleConfiguration NetworkListener(NetworkListener listener)func NetworkListener(Listener NetworkListener) ListenerRuleConfigurationstatic#Use a Network Load Balancer listener.