A simple scheduler to shut down and start up AWS infrastructure on a recurring scheduler using Serverless framework. Can be used to mitigate running costs on off hours.
Supported types of infrastructure:
- ECS service capacity (i.e. Fargate containers)
- RDS clusters
- Autoscaling group capacity
- Clone/fork the repository
- Add necessary stack configuration in
serverless.yml
(such as VPC/subnet details if you cannot use the default VPC) - Modify cron timer defaults in
serverless.yml
(default: startup at 03 UTC MON-FRI and shutdown 18 UTC MON-FRI) - Rename
infra-config-example.ts
->infra-config.ts
- Configure your infrastructure details in
infra-config.ts
. SetdesiredCount
,DesiredCapacity
andMinSize
as the regular running values - the shutdown is going to set these to zero, and the startup back to the configured values. npm install
- Login into your AWS profile in your shell
sls deploy
If you want to manually start / shutdown the infrastructure (say, for working on something critical on a weekend) you can manually invoke the functions:
Start: sls invoke -f startup
Shutdown: sls invoke -f shutdown