AWS ECS handles DNS subdomains across multiple instances

So, I am trying to configure my AWS system to work with DNS.

I have 2 instances (currently). I have 4 task definitions. 3 of them need to be run on port 80/443, but all on separate subdomains.

ECS container scheme

Currently, if I stop / start the task, it could end up in any of my instances. This causes problems with the DNS subdomain potentially being listed in the wrong places.

I feel like I need to configure some kind of load balancer to point the DNS, but not sure how to do this to route the correct tasks.

Load balancing scheme

So my questions are:

  • Do I need one load balancer or one per "task / subdomain"?
  • How to handle ports going from a set source port to one of any number of destination ports (if I end up with multiple containers doing the same task).
  • Am I overcomplicating this, or is there an easier way to achieve this?
+3


source to share


1 answer


  • Do I need one load balancer or one per "task / subdomain"?

You can have one application load balancer and three target groups for Api, Site and Web App. Then you can route the Rule Base in the load balancer listener as shown in the following screenshot.

enter image description here

Link: http://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-update-rules.html



Then you can map your www.domain.com and app.domain.com domains to the load balancer

  1. How to handle ports going from a set source port to one of any number of destination ports (if I end up with multiple containers doing the same task).

When creating services for task definitions in ECS, you can configure load balancing using target groups that you create.

Ref: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service.html (check "Configuring Service to Use Load Balancing")

+3


source







All Articles