Skip to main content
search

Stonehenge Case Study: Cloud Migration from Azure to Hetzner for Cost Optimization

By March 21, 2025Infra
Stonehenge case study

Most companies don’t question their cloud bill. They pick a provider, scale their infrastructure, and assume rising costs are just part of the game.

But what if that’s not true? What if you could cut your cloud spend in half while making your system faster, more secure, and more scalable?

That’s exactly what we did with Stonehenge.

Stonehenge started on Microsoft Azure – a solid platform, but one that locked us into expensive managed services and unpredictable costs. Every performance tweak meant paying more, not optimizing better.

So we made a decision: move to Hetzner Cloud, take control of our infrastructure, and rethink the entire system.

The result?

Faster performance. No compromises.

Here’s how we did it.

The Problem: Rising Costs, Performance Bottlenecks, and Limited Control

Stonehenge is a powerful web application that helps businesses track Amazon marketplace performance, optimize advertising, and make data-driven decisions. It empowers managers and users to monitor key performance metrics, identify issues, and make informed decisions efficiently.

It started on Microsoft Azure – big, reliable, but expensive.

The application stack included:

  • A managed PostgreSQL database
  • Azure Redis Cache for performance optimization
  • Frontend and backend services running on Azure App Services
  • Scraper and consumer instances for data collection
  • File storage solutions
  • Monitoring and logging services

As the platform grew, so did the cloud bill. Managing PostgreSQL, Redis, scrapers, monitoring, and file storage on Azure became a financial and operational bottleneck.

Beyond cost, the system also faced challenges with performance bottlenecks in caching and database layers, security vulnerabilities due to public-facing infrastructure, and limited control over system configurations.

Azure’s pay-as-you-go pricing model, combined with high costs for compute and database services, was unsustainable.

The business faced a critical challenge:

  • Cloud costs were growing faster than the business
  • Infrastructure was locked into Azure’s ecosystem with limited flexibility
  • Performance optimizations were constrained by pricing
  • Security risks from public-facing infrastructure components
  • Complex system architecture with restricted control over configurations

Every optimization meant a higher bill. Every “scale up” button was an extra charge. We weren’t optimizing infrastructure. We were optimizing our budget around Azure’s pricing model. That’s not how it should be.

The key goal was to reduce cloud hosting costs while maintaining or improving system performance, reliability, and security. To achieve this, the DevOps team at Stonehenge initiated a strategic migration to Hetzner Cloud.

This move resulted in significant cost savings, improved system efficiency, enhanced security, and greater control over infrastructure.

The Decision: Move to a Leaner, More Efficient Cloud

Something had to change. The goal wasn’t just to cut costs. It was to build a more efficient, scalable, and secure infrastructure without compromising reliability. It was about owning the architecture, increasing flexibility, and maximizing performance.

After a thorough evaluation, the DevOps team identified Hetzner Cloud as the ideal alternative, offering high-performance infrastructure at a fraction of Azure’s cost.

The migration strategy prioritized infrastructure optimization, enhanced security, high availability, and automated deployment, ensuring a leaner, more efficient, and future-ready system.

Rather than making costly optimizations within Azure’s constraints, Bitcot’s DevOps team took a smarter approach: migrating to Hetzner Cloud.

Here’s why it was the right move:

  • Drastically lower costs: A fraction of Azure’s pricing.
  • More control: No more managed services black boxes.
  • Better performance: Optimized infrastructure tailored to actual needs.

The Execution: More Power, Less Cost

Instead of a simple lift-and-shift, the team used the migration as an opportunity to rethink and optimize every part of the system.

Optimizing Infrastructure

Cloud infrastructure should work for you, not against you. Our move to Hetzner was about efficiency, control, and performance, not just cost-cutting.

To optimize the infrastructure, the team introduced self-managed resources for better performance and cost control:

  • Compute: We replaced Azure’s managed services with dedicated Hetzner servers running Docker containers, improving resource efficiency, scalability, and cost control.
  • Database: We migrated from Azure PostgreSQL to a self-managed PostgreSQL instance on Hetzner, giving us full control over performance tuning. To ensure data safety, 7-day rolling backups were implemented and off-site backups were securely stored on Backblaze for disaster recovery.
  • Caching: Rather than paying a premium for Azure Redis Cache, we deployed a self-managed Redis cluster, optimizing it with fine-tuned configurations for speed and efficiency along with monitoring and alerting to ensure optimal performance.

Security

Security often takes a hit in cost-cutting exercises. Not here. We enhanced security while reducing expenses.

  • Private Networking: All sensitive components were isolated from the public internet, minimizing exposure.
  • Firewall Everything: Strict UFW firewall policies were configured to control inbound/outbound traffic. Databases and cache servers were completely restricted from public IPv4 access.
  • Secure Access with a Bastion Host: To prevent unauthorized database access, we deployed a bastion host, ensuring controlled, logged, and encrypted access.
  • Encryption, Always On: SSL/TLS certificates with automatic renewal were implemented across the system.

High Availability

Reliability shouldn’t come with a massive price tag. We ensured high availability and proactive monitoring while keeping costs low.

  • Load Balancers for Stability: We deployed an NGINX-based load balancer with round-robin traffic distribution, ensuring smooth load management across servers.
  • Real-Time Monitoring & Alerting: Prometheus & Grafana now track system health with live dashboards. Automated Slack alerts notify the team about performance issues before they escalate.
  • Zero-Downtime Deployments: Blue-Green deployment ensures seamless updates by rolling out changes to an inactive environment before switching live traffic.

DevOps

We didn’t just improve infrastructure. We also redefined how we deploy and manage applications.

CI/CD Pipeline: Speed with Safety

A revamped CI/CD pipeline using GitHub Actions now ensures:

  • Trigger: Deployments start manually or on a push to bitcot-master.
  • Build & Push: Docker images are tagged and stored in DockerHub.
  • Deployment: The update is pushed to the inactive (blue/green) environment.
  • Health Checks: Automated tests ensure stability before switching live traffic.
  • Rollback: If a health check fails, the system automatically rolls back.
  • Slack Notifications: Real-time alerts keep the team updated on deployment status.

Security & Secrets Management

  • HashiCorp Vault now securely manages credentials.
  • DockerHub vulnerability scanning ensures container security.

The Architecture: High-Performance, Cost-Optimized System

The Stonehenge platform now runs on a scalable, secure infrastructure built for performance.

The Tech Stack

Every system is built on trade-offs. For Stonehenge, we optimized for performance, scalability, and cost efficiency.

  • Frontend: React.js for a fast, dynamic user experience.
  • Backend: Node.js, built for speed, handling API requests and business logic.
  • Scraper: Also Node.js, ensuring efficient data collection and processing.
  • Database: PostgreSQL for structured data and MongoDB for flexible, unstructured data storage.
  • Caching: Redis, speeding up response times by reducing database load.

Hosting & Network

Instead of relying on managed services, we built a self-sufficient infrastructure on Hetzner that’s faster, cheaper, and easier to optimize.

  • Servers: Dedicated Hetzner servers hosting all application components.
  • Load Balancing: NGINX using round-robin traffic distribution for even load management.
  • Object Storage: Backblaze for cost-effective report and file storage.
  • Real-Time Monitoring: Prometheus and Grafana, providing deep visibility into system health.
  • Firewall Protection: UFW (Uncomplicated Firewall), ensuring strict access control and security.

Deployment

A robust CI/CD pipeline is the backbone of fast, safe, and reliable updates.

  • Trigger: Manually or automatically triggered on push to the bitcot-master branch.
  • Build & Push: Docker images are tagged and stored in DockerHub.
  • Blue-Green Deployment: New updates deploy to an inactive environment (blue or green) before traffic is switched after a successful health check.
  • Automated Rollbacks: If a deployment fails the health check, it rolls back automatically.
  • Slack Alerts: Real-time notifications for deployment status, failures, and rollbacks.

Google Looker Studio: Turning Data into Insights

A powerful system is only as good as the insights it provides. Data without visibility is useless. Stonehenge needed a seamless way to analyze performance metrics and marketplace data in real time.

That’s why we integrated Google Looker Studio, turning raw data into real-time, actionable insights for Stonehenge.

Here’s how we integrated Looker Studio:

  • Real-Time Data Visualization: Looker Studio pulls live data from Stonehenge’s backend, providing up-to-the-minute analytics.
  • Secure Database Connection: A Bastion Host is used to securely access the private PostgreSQL instance, preventing unauthorized access.
  • Traffic Redirection with Socat: Socat redirects traffic from external port 5432 to internal port 5432, ensuring smooth database connectivity.
  • SSL/TLS Encryption: All connections are fully encrypted, maintaining data integrity and security.

With Google Looker Studio, Stonehenge users get instant access to critical business metrics, allowing them to make faster, data-driven decisions without compromising security.

Performance and Monitoring Enhancements

Performance monitoring isn’t just about tracking metrics. It’s about preventing failures before they happen. To ensure system reliability, we integrated Prometheus and Grafana, providing real-time insights into Stonehenge’s infrastructure health.

Here are the key enhancements.

  • Real-Time Performance Tracking: Prometheus collects system metrics, while Grafana visualizes them, making it easy to spot trends and bottlenecks.
  • Automated Alerts: Instant notifications are sent to the team whenever critical issues arise, allowing for rapid response and resolution.
  • Resource Utilization Monitoring: CPU, memory, and network usage are continuously tracked to prevent overload and optimize system efficiency.

By proactively monitoring system performance, Stonehenge ensures high availability, faster issue resolution, and a seamless user experience, all while reducing downtime risks.

The Results: More for Less

The migration to Hetzner Cloud delivered massive improvements in cost, performance, security, and control. By optimizing infrastructure and leveraging self-managed solutions, Stonehenge achieved significant gains across the board.

  • Cost Reduction: 55-60% lower infrastructure costs, leading to an 83% decrease in overall monthly cloud expenses, freeing up resources for growth.
  • Improved Performance: Faster data processing, better caching, and higher throughput, resulting in a more responsive application.
  • Enhanced Security: Firewall policies, secure network isolation, and restricted public access protect sensitive data and prevent unauthorized access.
  • High Availability: Blue-green deployment with load balancing ensures zero downtime during updates.
  • Better Monitoring: Real-time tracking through Grafana and Prometheus provides instant visibility into system health and resource usage.
  • Increased Control: Direct access to infrastructure allows for fine-tuned optimizations, giving the team full control over performance and scalability.

By switching to Hetzner Cloud, Stonehenge not only cut infrastructure costs by over half but also enhanced performance, security, and operational efficiency – a clear win across all critical areas.

Most companies overpay for cloud because it’s easy to stick with what works. But cloud should be a tool, not a cost center.

By making one bold decision, we cut costs and built something better, faster, and completely under our control.

If you’re scaling and feeling trapped by cloud costs, ask yourself:

Are you paying for performance, or just paying for convenience?

Lessons for Anyone Running on the Cloud

Cloud pricing is designed to be invisible. You pay for the ease of managed services, and before you know it, your infrastructure is burning cash without delivering proportional value.

However, too many companies accept high cloud costs as inevitable. We didn’t.

Our approach to cloud optimization was guided by a few critical decisions:

  • Strategic selection of a cost-effective cloud provider: Choosing Hetzner over Azure significantly reduced costs while maintaining performance.
  • Self-managed infrastructure for better performance and control: Owning our stack allowed for deeper customization and efficiency.
  • Blue-green deployment and real-time monitoring ensured zero downtime: Seamless updates with instant rollbacks kept our services running smoothly.
  • Automated CI/CD and rollback strategy reduced deployment risks: Faster, safer releases with minimal manual intervention.
  • Enhanced security through strict access controls and encrypted connections: Proactive security measures ensured data integrity and protection.

Cloud costs aren’t just a number. They impact everything. Managed services are great, but owning your stack gives you leverage.

Switching clouds isn’t as scary as it sounds if you do it strategically. Big companies keep burning money on expensive cloud solutions they don’t need. Stonehenge made the switch and proved you can save big and scale smarter. If you’re overpaying for cloud, maybe it’s time to rethink your infrastructure.

Technology is only as good as the decisions behind it. Make the right ones, and they keep paying off.

If you’re looking to cut costs, improve performance, and take full control of your cloud architecture, let’s talk. Get in touch and see how we can help you build a smarter, more scalable system.

If you’re looking to cut costs, improve performance, and take full control of your cloud architecture, let’s talk. Get in touch and see how we can help you build a smarter, more scalable system.

 

Raj Sanghvi

Raj Sanghvi is a technologist and founder of Bitcot, a full-service award-winning software development company. With over 15 years of innovative coding experience creating complex technology solutions for businesses like IBM, Sony, Nissan, Micron, Dicks Sporting Goods, HDSupply, Bombardier and more, Sanghvi helps build for both major brands and entrepreneurs to launch their own technologies platforms. Visit Raj Sanghvi on LinkedIn and follow him on Twitter. View Full Bio