I have a little architecture with two services running on a EC2 cluster of AWS ECS, they're healthy and I can access them via browser through two ALBs, pointing to frontend and backend respectively. My frontend container can configure its backend base url so I want to connect it to the backend with a proper namespace with Route 53 Service Discovery (and not using ALB dns name).
My problem is I configured the tasks with awspvc mode and pointed them to the unique port I want to expose, but the EC2 instances (and the containers when I access via ssh) can't reach the short namespace, I have to add the name of the container and its port, but I can't abstract them (I think they're the original containers because the names does not match in pictures 2 and 3 but they're still accesable). When I used Fargate I could reach the containers only providing the service name and namespace, but now I can't with EC2.
I'll attach some pictures I believe they're useful (red is the same name for all texts):