DEV Community

anjan-dutta
anjan-dutta

Posted on • Originally published at Medium

My side project is costing me too much

Image description

I run a side project https://freecodecompiler.com. As the domain states, it is an online code compiler for multiple programming languages. Recently it has completed it’s month anniversary and so did the AWS billing. To be honest, while setting up the infra, I was expecting a cost like this. Though it’s not too high but for a side project of this scale, where there is no business value attached, it is a bit high.

Majority of this cost is coming from the API server that runs on t2 micro instance and has a load balancer associated with it. Also the load balancer was costing more than the ec2 instance cost. Last month the load balancer costed around $16 alone where as the instance cost was around $9.

I hate to acknowledge that the load balancer was only being used to route the https traffic to a specific port. Since ACM certificates do not support EC2 instances so I had to use LB to enable SSL on ec2 instance.

But there was always a “what if” in my mind. And I took a shot last weekend. The load balancer was enforcing SSL on the EC2 instance from outside but since it (LB) accounted for majority of the billing amount so I thought of cutting it off completely.

I chose the traditional way of installing SSL instead of enforcing it. Installed letsencrypt cert directly on the ec2 instance and bingo! Of course I had to install the apache proxy and a few tweaks but overall it did the job. Now I am expecting it should reduce the cost by one third of what it was previously. And I will look forward to reduce it more.

Also I have to periodically update the cert on server, not sure how I can automate it. But I am satisfied with this solution.

Do you guys have similar experience? Please suggest if you have any tips to reduce AWS ec2 billing and how to automate updating of letsencrypt cert expiry date. It will be a big help!

Until then, I will come up with some new update next week!

Top comments (0)