Francisco Lucca
Francisco Lucca

Reputation: 3

Containers communications in aws ecs

I have a task definition that contains 4 containers and they need to communicate with each other.

containers

I already tried to use the name of the container (passer by environment variable) to try to get them to communicate, but it didn't work. With that in mind I don't think using the repository name (ECR) will work. What can I do to get the containers to communicate?

OBS: I’m using the aws web interface

Upvotes: 0

Views: 375

Answers (2)

Asri Badlah
Asri Badlah

Reputation: 2123

I think you need to create a specific task definition for each docker image then create ecs service based on each task definition you have been created in the previous step, and to manage the communications between ecs services you have many option like loadbalancer, cloud map, or ecs service discovery with I prefer in term of cost and scalability. the following blog maybe helpful.blog link

Upvotes: 0

mreferre
mreferre

Reputation: 6063

All containers in a task definition can talk to each others via localhost because they share the same network space. So if container1 exposes a service on port 1234 you can call it with localhost:1234 from any other container.

Upvotes: 1

Related Questions