This question feels too obvious to not already have an answer but all of my google searches are coming up with nothing.
In docker (docker-compose) you can easily get the IP of another container by hostname. If you have explicitly created and assigned a network this just works out of the box. So a container foo
can connect to another container bar
simply by looking up the hostname "bar".
I'm trying to achieve something similar in AWS ECS to allow a container from one service to talk to a container in another service. The ECS cluster has multiple hosts so I don't think I can just specify bridge
type networking.
Note that the protocol I need this for is not HTTP so an application load balancer is already out of the question.
Is there a recommended way to let one container discover another on the same cluster via hostname?
Amazon ECS service discovery is integrated in ECS:
The linked blog post contains in deep explanation and sample code.