I have an ECS cluster in which I run a task with many container. Three of them need to be reached from the internet. These container are exposed on port 80, 8080 and 8880 of the cluster's ec2 instance. I have a DNS name registered (say example.com), and I can create a CNAME record that points to the ec2 dns name, but if I do so, the app will be reachable as
Instead what I would like to do is to reach the three container like this:
I can't do it with the DNS CNAME because is not possible with CNAME to redirect to specific ports.
I hope the question make sense. Any suggestion from anyone would be appreciate. Thanks in advance!
You will need to place an AWS Application Load Balancer in front of the ECS containers in order to accomplish this. You would have 3 different target groups (one for each container) and configure the Load Balancer to use host-based routing to send the traffic to the appropriate target group/container.