This project is a poor man's attempt to reduce cost with running clusters. The idea behind it is to automatically scale up/down the number of worker nodes. It is assumed that the clusters are used within certain time frames, thus not being needed outside them, e.g. evenings,weekends...etc
The downscaler is a lambda function triggered at specific times. There are two available schedules to be set, one for upscaling and another for downscaling.
Run the following in the repository's root directory:
$ make
This will build the lambda source code under src/
and create a source.zip
file.
The terraform code associated with the entire infra is found in the terraform
directory.
Make sure you have the correct AWS credentials in place, fill in the variables as needed and proceed to apply
.
Name | Version |
---|---|
terraform | ~> 1.1.5 |
aws | 4.18.0 |
Name | Version |
---|---|
aws | 4.18.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster_name | Name of the cluster used for detecting the attached autoscaling-groups. | string |
n/a | yes |
lambda_file | Path to the zip file containing the lambda function. (see scaler.zip) | string |
n/a | yes |
scale_down_max_size | Max capacity after a scale down. | number |
1 |
no |
scale_down_schedule | Set the down scaling schedule. (expressed in UTC) | string |
"cron(0 15 ? * MON-FRI *)" |
no |
scale_in_protection | Enable scale-in protection for new nodes after scale up. | bool |
false |
no |
scale_up_max_size | Max capacity after a scale up. | number |
10 |
no |
scale_up_schedule | Set the up scaling schedule. (expressed in UTC) | string |
"cron(0 6 ? * MON-FRI *)" |
no |