Subhash Choudhary, the co-founder and CTO of the Indian e-commerce startup Dukaan, revealed how the company transitioned from cloud services to bare metal servers in the interest of cost savings.
Choudhary, in his book titled ‘The Accidental CTO’, stated that Dukaan drastically reduced its $80,000 per month bill by migrating from Amazon Web Services (AWS) to bare metal.
Choudhary noted that using bare metal could save 10 to 20 times more for the same resources compared to cloud solutions. “That $80,000 AWS bill could become a $5,000 bare-metal bill,” he added.
While he stated that AWS provided the company with ease of maintenance, power, and speed, it came at a significant cost. “At every layer of our stack, we were paying a ‘convenience tax.’ We were paying AWS for the privilege of not having to manage the underlying hardware,” Choudhary said in the book.
“In the early days, this tax was worth it. It allowed us to move incredibly fast. But now, that convenience was threatening to bankrupt us,” he added.
The company carried out ‘Strangler Fig Pattern’ migration, which involved gradually shifting traffic from AWS to self-hosted infrastructure without downtime.
He revealed that Dukaan was able to complete a ‘zero-downtime migration’ because the startup owned its own IP address space.
“This IP address was our permanent, portable address on the internet. We could move house, but our address would stay the same. This was the key that unlocked our ability to migrate without our users ever knowing,” he said.
Dukaan then utilised the Strangler Fig Pattern, which involves gradually replacing a legacy system rather than performing a complete migration in one go.
The startup chose Hetzner, the German-based bare-metal provider, and rented physical servers in data centres that were geographically close to their existing AWS regions. Choudhary, in an example, explained how the company chose a data centre in Helsinki, Finland, to replace their AWS cluster in Frankfurt, Germany.
He also revealed that they utilised tools like k3s, a lightweight and powerful Kubernetes distribution, to simplify the process. “Over several weeks, we painstakingly built and tested our new, self-hosted Kubernetes clusters in nine new data centres around the world,” said Choudhary.
Initially, the company shifted just 1% of its European traffic away from AWS to their bare metal cluster in Helsinki, and the remaining 99% continued to be served by the stable AWS infrastructure.
After extensive monitoring of the system, the company gradually increased the traffic shifted to their bare metal servers, first to 10%, then to 25%, and eventually shifted 100% away from AWS.
“Each step was carefully monitored. If we saw any issues, we could instantly shift all the traffic back to AWS with zero downtime,” Choudhary said.
“We then repeated this incredibly careful and deliberate process, region by region, over the next two months, until our entire global application was running on our own self-hosted, bare-metal infrastructure,” he added.
Choudhary published his book openly on GitHub, sharing his experiences as Dukaan’s CTO along with several case studies related to the company’s tech stack.
In addition to Dukaan, various companies over the years have reported significant cost savings by switching to bare metal servers.
For example, OneUptime, the observability platform, estimated annual savings of $230,000 after moving to bare metal servers. In 2022, Basecamp projected total savings of $10 million over five years following the exit from cloud servers.
The post Dukaan Moved to Bare Metal to Prevent $80,000 a Monthly Cloud Bills appeared first on Analytics India Magazine.