For a ECS service with launch type "fargate", it is possible to configure a load balancer and auto scaling. I don`t understand, how those two types of scaling work in this case, and how they work together.
My example
I define a task, and set the task size to "0.25 vCPU". I then configure the service to use a load balancer, and auto scaling. I set the auto scaling to a maximum number of 4 tasks.
My questions
- I would expect, that the task is executed with 0.25 vCPU. When the task runs out of CPU, it starts another one, which uses another 0.25 vCPU. This is done until the maximum number of tasks is reached, this means a use and costs of 1vCPU in my example. Is this expectation correct?
- What is the role of the load balancer? As I understand it, it is just needed for routing and https certfificate. Or does it play a role at scaling, too?
- When I want to scale container based, then I need an own task definition for every container, right? And an own load balancer for every service? Is it possible to use one load balancer for multiple services?
In which AWS docs I can read about those topics?