Skip to content

LoadBalancedFargateService Improvements #3270

@chelma-amzn

Description

@chelma-amzn

I'm using the TypeScript version of CDK v0.36.0.

While considering whether I would be able to use the LoadBalancedFargateService instead of making my own combination of manually defined constructs I ran into a number of issues, several of which were blockers for me.

  1. Because the LoadBalancedServiceBase stores its Load Balancer as an elbv2.BaseLoadBalancer, users must typecast the Load Balancer member to access things like the native CloudWatch metrics they provide. This is less than ideal, as it forces the user to pierce the veil of your abstraction. It may also cause problems in the case where one person is vending another person a collection of constructs, and the consumer doesn't know whether the LB is an Application or Network LB.
const loadBalancedService = new ecsPatternsLoadBalancedFargateService(...);

new cloudwatch.Alarm(this, "AlarmHealthyHostsCount", {
    metric: (<elbv2.NetworkLoadBalancer> loadBalancedService.loadBalancer).metricHealthyHostCount(),
    threshold: 1,
    evaluationPeriods: 1,
    period: core.Duration.seconds(60),
    comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,
    statistic: "Average"
});
  1. There does not appear to be a way to access the CloudWatch LogGroup object created by the Service's AwsLogDriver. This means it's not possible to do things like set up MetricFilters on those logs. This is a blocker, as there's also no way to pass in a log group for the driver to use.

  2. There does not appear to be a way to configure the created LoadBalancer's target groups, which means that it isn't possible to configure custom health checks for the LB to send traffic to ECS tasks and instead the default behavior must be relied on. This is another blocker.

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-ecsRelated to Amazon Elastic Containerneeds-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions