We were using Jenkins (the old traditional way) to build and deploy our code to AWS. We’re currently building multiple React App projects, and we’d taken an xlarge (16BG RAM, 4 CPU) instance on AWS. We had these servers running 24×7 to give the developers the flexibility to get in the zone and code at their call. For this convenience, you can imagine the massive AWS bill we had.
So what’s the problem?
The big Jenkins servers (development and production) were running 24×7. This was causing us a big monthly cost burn. We were looking for a lasting solution to:
- Reduce the huge monthly cloud hosting Bill
- Use the resources (ec2 instance) optimally
We needed something a bit more versatile and that allowed us to build our multiple projects simultaneously. What’s that? Bitbucket Pipeline instead of AWS? Pay by usage? Free unlimited repositories?
Why Bitbucket Pipeline ?
We were already using Bitbucket for our code repository with a Standard Plan, which grants 2,500 FREE build minutes.
This was immensely promising as a solution because it was:
- Cost Efficient: Even in the rare occasion that we do exceed our 2,500 free build minutes, the additional cost would be far less than running AWS 24×7
- It’s Dockerized : It will run only when needed to build and deploy – saving fincity the moolah and the planet earth, one power cycle at a time. All adding up to some good Karma.
- Able to run N number of projects : Since they are not running on a single machine, our team can build all our projects simultaneously, if needed.
How did we do it ?
A small file (bitbucket-pipelines.yml) at the repo root level, is all it takes to start bitbucket pipeline.
Below is an example of starting a build on dev branch.
– npm install
How much did we save ?
Our initial assessment (of using the ec2 instance inefficiently), it so turned out, was correct. AWS is cheaper in many cases, but we were able to save ~15% on the cost of our previous AWS system, and as a startup – that’s a huge saving for us. As I mentioned earlier, moving to Bitbucket pipeline not only helped us save money but also time and resources. How? Read on, fellow traveler.
Why did it make sense ?
Our Jenkins server was behind a VPN, so developers had to connect to the VPN to check logs. This was a bit of a hassle but nothing too annoying – the real problem was because some developers didn’t have access to VPNs (especially the production VPN). So it transpired that people (like me) who had access to production VPN were becoming a bottleneck in the system, constantly unlocking doors.
With the Bitbucket pipeline, all the developers that can commit code in a repo can also see all the logs for each build. Removing this bottleneck from the system saved a huge amount of time for the company.
We not only use Bitbucket pipeline for our Development, Staging, and Production environments, but any developer can use it to build their own feature branch changes. Also, each developer doesn’t need to have a heavy computing machine to build their project.
Developers are able to build their feature branch using Bitbucket pipeline and it won’t even slow down their machine by being resource-heavy. This means that they can continue working on other tasks, massively increasing productivity and eventual savings, cutting the burn rate.
Although Bitbucket pipelines are great, there are few limitations to them:
- Maximum 8GB RAM: If you have a requirement of more than 8GB RAM, you can’t use the bit bucket pipeline. It comes only with 4GB and 8GB(2X) options.
- Building Windows, MacOS or iOS Applications Not Supported: And this is a big deal. Maybe the devs will read our blog and implement build support soon. “One good deed begets another”
- Chargeable for usage > 2,500 Minutes: If you have a requirement to run multiple builds in a day or week, which easily exceed 2,500 minutes in a month, bitbucket pipeline might not be cost effective. It depends on your individual use-case scenario.
If your specific usage requires more than 8GB of RAM, building specifically for Win, MasOS, iOS apps, or running multiple builds – using Jenkins may be a better option for you.
Bitbucket Pipeline helped us:
- Save a big bag of dollars
- Free up developer resources and increase individual contributions
- Eliminate all bottlenecks in the system, hugely increasing productivity
- More efficient system with multiple contributors
- Finish at least 1 kilogram of coffee 🙂