Scale down AWS resources during non-work hours to save costs. Inspired by the brilliant kube-downscaler.
- Currently supports the following AWS resource types:
- EC2 Auto Scaling Groups
- ECS Services
- Flexible scheduling with timezone support
- Resource exclusion via tags
- Grace periods for newly created resources
- Dry-run mode for testing
Caution
This project is a WIP and is not production ready. Contributions are welcome!
- Install:
pip install .- Configure AWS credentials:
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=your_region- Run the downscaler:
aws-downscaler --default-uptime="Mon-Fri 08:00-18:00 America/New_York"Time definitions accept a comma-separated list of specifications in two formats:
- Recurring specifications:
<WEEKDAY-FROM>-<WEEKDAY-TO-INCLUSIVE> <HH>:<MM>-<HH>:<MM> <TIMEZONE>
Example: Mon-Fri 07:30-20:30 America/New_York
- Absolute specifications:
<YYYY>-<MM>-<DD>T<HH>:<MM>:<SS>[+-]<TZHH>:<TZMM>
Example: 2024-04-01T08:00:00-04:00
Resources can be configured using AWS tags:
downscaler:uptime: Override uptime scheduledownscaler:downtime: Override downtime scheduledownscaler:exclude: Exclude resource from scalingdownscaler:exclude-until: Temporarily exclude until timestampdownscaler:downtime-scale: Override downtime scale factor
--dry-run: Print actions without making changes--debug: Enable debug logging--once: Run once and exit--interval: Loop interval in seconds (default: 60)--default-uptime: Default uptime schedule--default-downtime: Default downtime schedule--grace-period: Grace period for new resources in seconds--include-resources: Resource types to manage (comma-separated)--exclude-resources: Resource patterns to exclude (comma-separated)--downtime-scale: Scale factor during downtime (0-100, default: 0)
Scale down all resources outside work hours:
aws-downscaler --default-uptime="Mon-Fri 08:00-18:00 America/New_York"Scale down specific resource types:
aws-downscaler --include-resources="asg,ecs"Contributions and bug reports are welcome! Feel free to open issues, submit pull requests or contact me if you need any support.
This project is licensed under the MIT License.