Save money of my EKS cluster
The goal was to save money in a dev EKS cluster by scaling down the cluster when it is not being used.
How to do it
- Create an EKS cluster
- Create an IAM role for the Lambda function
- Create the Lambda function and give it the role
- Test the Lambda function (in this case i use the console)
I use IaC to up all the infraestructure. Link of the 👉code
The cluster in normal state
i took this picture to check the normal status of the eks test.

What happens
When the Lambda function is triggered, it will scale down the EKS cluster to 0 nodes.

Important notes
- The scaling process takes a few seconds or minutes. It depends of your cluster, so if you trigger the Lambda function multiple times in a short period of time, it may not scale down correctly.
- You can adjust the period of time between triggers to fit your needs.
Future improvements
- Find another way to trigger the lambda function(maybe EventBridge).
Resources
🔗Read the full tutorial i changed some parts for my case
Offtopic
Lastly, if you have a dog, please remember to take good care of them.🐶