How to communicate between Fargate services on AWS ECS?

Viewed 2026

I have six docker containers all running in their own Tasks (6 tasks), and each task running in a separate Fargate service (6 services) on ECS. I need the services to be able to communicate with each other, and some of them need to be publically accessible. I keep seeing info about using either Service Discovery or a Load Balancer assigned to each service. I would like to try and avoid having to set up 6 load balancers as it's more expensive and more effort to maintain.

This is how I have set up Service Discovery currently:

  • All Tasks are setup to use awsvpc
  • All services have been set up to use Service Discovery (set up from within the Service Creation page)
  • All services are sharing the same Namespace, and they're all using the A DNS Record

When I try to ping <service_discovery_name>.<namespace> from within one of the docker containers I do not get a response. However, I can successfully ping another container when pinging the private IP Address.

Can I achieve what I need to do with Service Discovery? If so, how exactly do the containers communicate with each other?

Thanks heaps! Please let me know if I haven't provided enough info.

EDIT: Recreating the services and setting them up with a new Service Discovery seemed to resolve the issue. No idea why the old discovery didn't work.

1 Answers

Based on the comments, the exact cause of the issue is undetermined. However, the problem was solved by creating a new Service Discovery in ECS.

Related