Search code examples
amazon-ecsamazon-route53service-discovery

ECS with Route 53 Service discovery


According to AWS documentation:

You can configure Service Discovery for an ECS Service that is behind a Load Balancer, but Service Discovery traffic is always routed to the Task and not the Load Balancer.

If this the case, how does the load balancing happens here?

Also, without the Load Balancer, how does the service discovery works, will the traffic routed to a random Container Instances?


Solution

  • TL;DR Yes, the traffic will be sent to random instances.

    When you use ECS Service Discovery, you have two options for discovering your services. One is via Route 53 DNS, which in case of ECS Service Discovery leverages Multivalue Routing Policy, so that your client application receives up to eight healthy endpoints, selected at random.

    The other option is to use Cloud Map DiscoverInstances API, which returns up to 100 endpoints for a given service name, selected at random.