The Cost of Self-Hosted Software
By Anthony·January 12, 2021·5 min read
Full disclosure: my opinion will be inevitably biased towards using a hosted service as I run one. That said, I also self-host a lot of my software, and my intention is to paint a more complete picture of the associated costs that come with it, both in time and money.
In this article I’ll be talking about some of the major costs and common pitfalls when deciding between self-hosting and using a hosted service.
I do enjoy managing infrastructure, it’s what I’ve been doing for nearly a decade and I have learned many lessons along the way. Self-hosting might be a great option for you too - but it's not for everyone.
Should you self-host or pay for a SaaS?
There’s lots of debate about whether companies should build and run software in-house, or buy ready-to-use products. There’s good points in favor of each of them, and it’s important to recognize that there is no right answer here. As with most decisions, it comes down to making tradeoffs.
Do you want to maintain your own servers, ensure backups are working, perform security updates, and optimize your setup to ensure you're ready for large traffic spikes when your website suddenly goes viral? Then you’ll likely enjoy self-hosting your software.
Do you just want to focus on your business, or project, and have all these things fully taken care of? Using a SaaS product, might end up saving you plenty of time, and even money (more on that later).
I like managing my own infrastructure, but when it comes to running a business I choose to buy software where it makes sense. That way I can let someone who better understands the topic take care of all the details, and I can focus on using my time to provide value to my customers.
Using a hosted solution, can not only save you valuable time, but it also gives you peace of mind, as there’s one less thing for you to worry about. I'd argue it can even end up saving you money down the line.
How much does it cost to self-host?
Let's use a concrete example: I run an analytics service, so what would it cost to self-host an open-source project like Matomo?
As a bare minimum you could rent a $5/mo DigitalOcean instance with 1 vCPU / 1 GB of RAM. That comes down to $60 per year for one server, which is actually a pretty good deal.
However, that's far from the full picture. For any serious project, it would be wise to invest in a more proper setup. This is not only about reliability or performance, but also because if someone manages to hack into your server at 2AM, and leaks any sensitive data, you might end up losing trust from your customers, and likely get a hefty fine from the data protection authorities.
But hey, let's continue exploring this idea. Matomo's minimum recommended server is actually 2 CPUs and 2 GB of RAM. So in reality you end up paying for the $15/mo instance ($180 per year), instead of the cheapest possible one. Let's remember that's one single server, in reality you might end up needing multiple depending on your needs. But alright, what else do we need?
You probably also want to ensure your data is not lost in case of a server failure. So let's add backups, these can add up to 20% of the server costs every month.
Do you need a separate domain name for your analytics or admin panel? Add another $10/year.
Do you need an email server for the weekly/monthly reports? Add another $5-10/mo.
Do you have visitors from around the world? You might want to add a CDN to avoid slowing down your site. Costs vary.
Once you start handling more traffic, you'll probably want to set up a separate database and multiple servers to handle the load. You will then need a load balancer too, which again, costs money.
But that's not all. You need to factor in the time you’ll need to set it up, secure, maintain, and keep it up-to-date every month.
Soon you may find yourself paying hundreds, if not thousands of dollars on infrastructure each year, when your initial goal was to start a new blog, app, or website. In my opinion, anything you do that is not related to your own project is a distraction, and it’s more likely you’ll succeed if you focus on what truly matters.
If you are fine using your time for those things instead of running your business, then self-hosting can be a wonderful learning experience. But again, it's not for everyone.
Should you worry about security and data protection?
With self-hosting, you are fully in control of every single detail. This can be a good thing, but a bad thing too.
Yes, you have ownership over the server on which the data is stored, and you can export, or destroy the data with the push of a button. But you are also now fully responsible to keep it safe from any threats on the internet. In case of a data breach, there are huge fines under various privacy regulations, which adds yet another thing to worry about.
When you opt for a hosted solution, things like security, compliance, backups, encryption at rest, and many other things should be fully taken care of, so that you can focus on doing what really matters for your business. However, please do review the security practices of the services you make use of, not all vendors may have the same standards.
With self-hosting you get to manage, and control every detail of your infrastructure, mainly at the expense of your own time, and it's not always cheaper. While with SaaS products, you pay a company to use their software, and everything else is taken care of. That way you can save time, and get to focus on your business instead.
I'd just like to finish this article by saying: please don't just blindly follow my advice (or any other random guy on the Internet for that matter). What's best for you highly depends on your own circumstances. Consider what your goals are when choosing between self-hosting and paying for a SaaS in the first place.