Search code examples
terraformamazon-ecsterraform-provider-awsaws-fargateaws-auto-scaling

ECS cluster scale in / out tasks based on CPU/memory


I have a problem statement. Can anyone answer it for me.

You have a Microservice running in your ECS cluster.
How would you manage below tasks. (Use terraform)
   a. You want to scale in/out the tasks based on CPU/Memory utilisation
   b. You want to scale in/out the tasks based on the requests made to the service


Solution

  • Scaling of ECS services on Fargate is explained in:

    a.You want to scale in/out the tasks based on CPU/Memory utilisation

    You use ECSServiceAverageCPUUtilization or ECSServiceAverageMemoryUtilization.

    b.You want to scale in/out the tasks based on the requests made to the service

    You use ALBRequestCountPerTarget.