ecs_patterns: ApplicationLoadBalancedFargateService does not allow target group port to be set
- 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
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