【问题标题】:Configure ECS to scale to zero when not in useConfigure ECS to scale to zero when not in use
【发布时间】:2023-01-06 21:29:48
【问题描述】:

I'm running Superset in AWS ECS using Fargate. This instance of Superset is for internal use only. I want to be able to configure ECS to scale to zero tasks when not in use. I am aware that it will take time (Possibly minutes) to come back up, the end-users of this application are content with waiting a few minutes.

Situation:

  • AWS ECS deployed using Fargate
  • Autoscaling set to a max of 2 and a min of 0
  • Want to scale to 0 when not in use (after, say, an hour)

【问题讨论】:

  • This isn't something ECS supports. It has nowhere to store the new "requests" that come in while it spins up new instances. If there are 0 instances then the requests would simply be discarded. You would need to look into AppRunner for this functionality.

标签: amazon-ecs aws-fargate aws-application-load-balancer


【解决方案1】:

Scaling ECS down to zero when not in use is not possible. ECS is designed to run continuously, unlike Lambda functions that can be turned on and off as requests arrive.


However, if your internal users only access the application during known hours (say business hours), then you can use scheduled scaling to scale to zero during specific hours.

You can use put-scheduled-action for that.

aws application-autoscaling put-scheduled-action --service-namespace ecs 
    --schedule "cron(15 12 * * ? *)"  
    ...

This AWS Blog post explains it in more detail: https://aws.amazon.com/blogs/containers/optimizing-amazon-elastic-container-service-for-cost-using-scheduled-scaling/

【讨论】:

    猜你喜欢
    • 2022-12-27
    • 2022-12-02
    • 2022-12-18
    • 2016-10-11
    • 2014-11-08
    • 1970-01-01
    • 2022-12-02
    • 2022-12-27
    • 2018-01-20
    相关资源
    最近更新 更多