Search code examples
amazon-web-servicesamazon-ecsamazon-elbaws-application-load-balancer

Load Balancer Needed When AutoScalling and distinctInstance?


Problem: I’ve got a container that requires a lot of CPU resources to complete in a required amount of time, and more than is available from FARGATE. The process would run as a batch job retrieving files from an S3 bucket. I’ve noticed that when using ECS\EC2 that I can select the instance type with the desired amount of CPU resources. Additionally, I would like to have no EC2 instances running when the task is not running and spin up the desired amount when needed, hence the need of autoscalling. At the moment I would be launching the task manually, and might need to launch several of the task simultaneously. Each of the the tasks would run on it’s own instance hence the distinctInstance placement constraint.

Question: In this type of setup would a load balancer be needed?


Solution

  • It really depends what your application is doing. If it's serving traffic (e.g. a web service) than you need a LB to have a single point of entry and sprays load across different tasks. This assumes all tasks are serving the same purpose (e.g. one single web service). Your statement "a container that requires a lot of CPU resources to complete in a required amount of time" makes me think this is more of a batch job than a service service requests (in which case a LB may not be needed).

    From an EC2 instance and ECS task scaling perspective this article may be of interest to you to get started thinking about how this could work.