Skip to content

Cloud vs Self-Hosting

Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Why not self-host using a VPS or dedicated hardware instead of using the cloud? Well, there are a lot of reasons. The cloud isn’t just about scaling; it’s about managed services.

YouTube

Check out my YouTube channel, where I post all kinds of content accompanying my posts, including this video showing everything in this post.

Dissecting the Trend

You’ve probably seen some memes on social media or blog posts pushing back against the cloud, advocating for self-hosting instead. But here’s the thing—everyone’s opinions are shaped by their own context. What works for them might not work for you.

Let’s take a closer look at a popular blog post titled “Stop Going to the Cloud and Getting Scammed: $200 Infrastructure to Serve Your Startup to 100,000 Monthly Users in 15 Minutes.” The article talks about self-hosting PostgreSQL, Caddy server, and Docker Compose. But first, let’s clarify a few things.

The blog mentions startups—are you a startup? Maybe you’re a solo indie developer or just working on a side project. If not, take this with a grain of salt.

The article states that while using the cloud has benefits at certain scales, almost no one is at that scale and never will be. I think there’s some truth to that. We often follow trends blindly, pretending it’s not the reality. This isn’t just about cloud versus self-hosting; it’s about our entire industry. There are countless examples where the herd mentality leads us astray. Take SPAs, for instance; everyone jumped on that bandwagon, regardless of their project’s context.

Cloud vs. Managed Services

When we talk about scaling, we need to distinguish between needing to scale up and down versus the actual reasons many people want to use the cloud. It’s not just about scaling; it’s about managed services.

A significant portion of the article is dedicated to how you can self-host PostgreSQL and Caddy server using Docker Compose in 15 minutes. Let’s break this down quickly to see if it makes sense for you or your team.

Setting Up Your Infrastructure

First, you need to install PostgreSQL and set up your database. Then, you’ll need Docker to run your containers. Here’s a quick outline:

  • Install PostgreSQL on your host.
  • Set up your database and connect to your containers.
  • Run Docker as non-root or rootless.
  • Enable your containers to connect to PostgreSQL.

If you need to scale horizontally, you’ll have to manage multiple instances of your app behind a load balancer. This means configuring Docker Compose further and managing backups and other maintenance tasks. Yes, it can be done in 15 minutes, but maintaining that setup is a whole different ballgame.

Personal Experience with Infrastructure Management

Speaking from experience, managing systems can be a real headache. Years ago, I was responsible for a MySQL system with two primary nodes and multiple read replicas. Managing that was not trivial, especially when it came to backups, migrations, and scaling. In contrast, using something like AWS RDS for SQL is a blessing. I’m willing to pay for managed services because I know the headaches involved in managing it myself.

Cloud Marketing and Self-Hosting

The article claims that AWS marketers have done a great job convincing you that installing and managing a database is a complex task. And while it can be, for the average IT Joe in a startup, it may not be as daunting as it sounds.

For many developers, self-hosting can be a viable option if you have the skill set and context to manage it effectively. But let’s be real—if you lack the experience, the cloud might save you time and headaches, of course, at a cost. If you want to gain that experience, and are in a situation where you can spend that time to do so, then self-hosting is a great way to learn.

Monitoring and Observability

Don’t forget that you might need to add monitoring, alerts, and observability to your self-hosted infrastructure. These tasks can become complex quickly, so consider your skill level and whether you want to spend your time on this.

Cloud vs Self-Hosting

So, should you self-host because the cloud is a marketing scheme? Maybe. But this article isn’t necessarily bad. It makes sense in the author’s context, but your situation might differ. If you have the skill set and are willing to manage your infrastructure, self-hosting could be the way to go. Otherwise, don’t hesitate to leverage managed services.

Ultimately, it all boils down to your skill set, experience, and specific use case. What works for one person may not work for another. Imagine that—context matters.

Join CodeOpinon!
Developer-level members of my Patreon or YouTube channel get access to a private Discord server to chat with other developers about Software Architecture and Design and access to source code for any working demo application I post on my blog or YouTube. Check out my Patreon or YouTube Membership for more info.