aws / copilot-cli

The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.
https://aws.github.io/copilot-cli/
Apache License 2.0
3.42k stars 398 forks source link

Support scheduled autoscaling #4249

Open Lou1415926 opened 1 year ago

Lou1415926 commented 1 year ago

Today Copilot supports autoscaling by target tracking: it scales up/down depending on the usage of CPU/memory or response time , number of requests, and etc.

It'd be great if Copilot also supports scheduled autoscaling. For example, scaling to X at 9AM to 18PM every Saturday.

Related: https://github.com/aws/copilot-cli/issues/4233#issuecomment-1334731025

biokraft commented 1 year ago

Bumping this as I think this would be a great addition.

icruwrks commented 7 months ago

If scaling has already been set in the manifest file, it can be set using YAML Patch Overrides.

cfn.patches.yml

- op: add
  path: /Resources/AutoScalingTarget/Properties/ScheduledActions
  value:
    - ScalableTargetAction:
        MinCapacity: 10 # Scale to 10
        MaxCapacity: 10
      Schedule: "cron(0 9 ? * SAT *)"
      ScheduledActionName: ScaleTo10EverySaturdayFrom9
      Timezone: Asia/Tokyo # If you need to set the time zone
    - ScalableTargetAction:
        MinCapacity: 1 # Scale to 1
        MaxCapacity: 10
      Schedule: "cron(0 18 ? * SAT *)"
      ScheduledActionName: ScaleTo1EverySaturdayFrom18
      Timezone: Asia/Tokyo # If you need to set the time zone

I look forward to your formal support!