aws / aws/aws-cdk

ecs_patterns: ApplicationLoadBalancedFargateService does not allow target group port to be set

Open
#24,280 5 comments 7 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs-patterns feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the feature

`ApplicationLoadBalancedFargateService` determines the port (80 or 443) of the ALB target group based on the `targetProtocol` https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancedFargateService.html#targetprotocol

But my ECS containers listen HTTPS on port 5001 and I don't see a way to configure the port used.

### Use Case

I want to use a custom port on my containers.

### Proposed Solution

Support a `targetPort` property on `ApplicationLoadBalancedFargateService` and configure it on the `AddApplicationTargetsProps`
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.AddApplicationTargetsProps.html#port

This can be done here https://github.com/aws/aws-cdk/blob/e47646c0ff317a421b2f042158fcc0c7ae1aa2cf/packages/%40aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts#L496

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

v2.59.0

### Environment details (OS name and version, etc.)

macOS/ubuntu

Contributor guide

Open the contributing guide

Research direction

Start in packages/@aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts around line 496, and read the AddApplicationTargetsProps documentation for its port property. Trace how ApplicationLoadBalancedFargateService derives the target group port from targetProtocol. Done means callers can configure a custom target port, such as 5001, while existing behavior remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.