I have a requirement to have an AWS load balancer that listens on a non standard port and routes connections to different ports on the same EC2 instance(s), treating each port as a unique target. The Ec2 instances would be depoloed using Auto Scale Groups.
Example the load balancer listens on port 300 and routes to ports 3001 and 3002 on EC2 instances. While this is a good candidate for usage with containers on ECS, I cannot use containers due to other constraints.
The problem is similar to what is discussed here: AWS ELB when target (backend) applications runs on multiple ports of the same EC2
except that here the use case is for a non standard port and the solution discussed in the above post to register each port as a separate target will not work with auto scaling group. This is because when an ASG brings up instances it cannot register instances in the target groups with multiple ports.
Is there anyway to achieve this using the standard load balancer + target group combination or will this require custom implemenation within the EC2 instance to perform the internal routing?
Tried a combination of single Load Balancer + multiple Auto Scale Groups and\or multiple Target Groups, but all of these require more than one listener on the Load Balancer itself. Usage of ALB is not an option since the traffic is not HTTP(s).