How I exited the cloud

Oct 2, 2024  ·  8 min read

I recently posted on X about how I saved 10x in monthly infrastructure costs by getting off the cloud and migrating all my infrastructure away from AWS and into a few self-managed servers.

My monthly bill went down from $1,400 a month to just under $120 a month.

That’s over $15k a year in savings. $150k over 10 years. How many things can you buy with $150k?

The tweet got some attention, and many people started reporting similar cost savings by migrating off the cloud. Lots of similar success stories: [1] [2] [3] [4] [5] [6] [7]

I also wrote about why the cloud is a bad idea.

Many other folks were interested in doing the same, but were concerned about three main things:

  • How much time did it take to migrate?
  • How much time does it take to maintain self-maintained infra vs hosted services?
  • What does it actually take to migrate off AWS and exit the cloud?

And that’s exactly why I’m writing this blogpost.

How much time did it take to migrate off the cloud?

The quick answer is that I migrated production in under an hour, once I had everything figured out.

The long answer is it took me several days, if not weeks, worth of testing and figuring things out until I found the exact steps I needed to take.

But don’t worry, you don’t have to go through that. I documented everything and made scripts to automate all the work, so you don’t have to waste that time. You can find everything here: ☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner.

It’s a deeply technical guide with step-to-step instructions. Assuming you’re starting from scratch and need some time to read it and understand it first, it should take a developer 1-2 days to go through it and implement it. You can either stop reading this now and get straight to it, or keep reading this blogpost for more context on what we’re dealing with here.

How much time does it take to maintain self-maintained infrastructure vs hosted services?

People keep making the argument that managing your own servers is almost a full-time job – but I’ve been managing production servers for the past ~10 years and couldn’t disagree more.

Running my own servers has always been the default for me. I rented my first hobby server in 2006 (under my mom’s name, in fact, because I was just a teenager and legally unable to get it myself at the time), and then started running and managing servers professionally circa 2012-2013. I started out with OVH iirc, then went through a bunch of white-label providers, then tried Heroku for a couple years, then moved into Digital Ocean and stayed there for the most part.

I only made the move to AWS last year, when I got tricked into it with promises of infinite flexibility, scalability, reliability and availability. All those cloud buzzwords that mean close to nothing to small business owners, like me, that at the end of the day just see their bank accounts getting depleted month after month. Dollars going from my pocket to Amazon shareholders, getting nothing in return.

As for time spent managing your own servers vs the cloud – the reality is I don’t see much difference, honestly. It’s all machines you ssh into. I had to do server admin work in my AWS servers too. Things would break, or the server would get an update and would need a restart, or something along those lines.

I consider this admin work to be part of my job, and I’ve never managed to not do it – despise deeply wanting to avoid it, and despise having used AWS, Heroku, and some other PaaS providers.

Why are servers so cheap and why is the cloud so expensive? What’s the trick?

The quick answer is: servers are just cheap. You’ve been tricked into thinking they’re expensive.

Technology has evolved a lot, especially over the last 10-15 years, and many things have been commoditized. Everything, from storage (you can get tons of storage for cheap) to compute, is a commodity now. In fact, you can buy your own entire server for under $1k:

There’s just no trick.

It’s not that servers are expensive – it’s that services like AWS and Vercel are charging you a 10x – 100x markup.

Why?

Well, first of all because it’s a great business. Buy cheap, sell expensive, pocket the profits. But the real answer is: all these platforms were designed for the enterprise, not for you.

AWS is complex. It’s meant to be complex. Enterprises have strict requirements. They need to comply with many regulations, they need to ensure uptime and reliability to comply with their SLAs, they need to distribute their huge workloads, etc.

That’s just not the case for small to medium businesses. Much less for hobby projects.

But let’s make sure we’re on the same page here when I say “small businesses”. I’m not talking about websites serving 10 or 20 users. I’m talking about web applications, like mine, processing and serving millions of requests a day for millions of monthly visitors. That’s small in the grand scheme of things, but it’s a significant amount of traffic that needs to be managed.

The cloud only makes sense for extremely large projects, say millions of requests per minute, or for very compute-heavy workloads like transcoding / streaming video and such. If you don’t have such requirements, you’re probably getting nothing out of the cloud.

The problem with the cloud started circa 10 years ago. AWS and other companies started a big marketing and psyops campaign dedicated to convince small developers they definitely needed the cloud for their little businesses. Scaring the shit out of developers, telling them that if they didn’t have things like “automated failovers with automated replica recovery” their whole business would be in danger of being automatically nuked out of existence. Convincing them that running your own servers was somehow more dangerous than using AWS’s servers. They shilled the same thing for the last ~10 years, and in the process they managed to convince many small startups and makers, who like me, fell in the trap.

But the reality is AWS is unnecessarily complex for 99% of users. 99% of users are overpaying for something they don’t need and they’re not even using. You’re better off just renting a beefy Hetzer server.

Ok, so, what does it actually take to migrate off AWS and exit the cloud?

In a nutshell: you need to replicate whatever you had on AWS.

For me, that meant:

  • RDS for the PostgreSQL database (my biggest monthly cost, in fact)
  • EC2 for the web server (my 2nd biggest monthly cost)
  • Elasticache for Redis

But most apps don’t need different servers for each service. In fact, unless you’re getting crazy amounts of traffic or you actually know you’ll need to support heavy production loads, you can get away with having everything in one single server. It’s not only cheaper, but more desirable to do. It reduces complexity, config, time, risk surface, and just about everyhting else you can think about.

If you start growing, you can just scale vertically, meaning you can just upgrade the specs of your server. You can get pretty beefy servers on Hetzner for cheap. For example, you can get a 48-vCPU, 192GB RAM, 960GB NVMe for under $300/mo. That’s more than enough to run 99% of the apps I’ve ever come across.

Me, personally, I went for a two-server setup:

  • A web server to run Rails, nginx, Redis, etc.
  • A dedicated server to PostgreSQL

Why?

I have tested it with my own production workloads, and having PostgreSQL running in the same machine as my Rails server tends to take up too many resources and makes the app slow. Separating the DB into its own beefy server solved the problem. But again, this is only required if you can’t manage to get everything running smoothly in the same server (which should be the case for 99% of the apps)

To get started, you just need to spin up a new server:

Choose your preferred location (always better close to your users), and choose Ubuntu Server as your base image.

Make sure you create a ed25519 ssh key and configure your new Hetzner server to use it – we won’t be accessing the server with any password, only ssh for security purposes.

You can also add automatic backups for cheap.

Finish configuring it and click “Create and buy”, the server will spin up in under a minute.

Once you have ssh access to the server, we’ll need to configure it:

You can just ssh as root into the machine wget the script, chmod +x it to make it runnable, and run it.

Both scripts try to follow best security practices to harden the instance and make it actually production-ready. But I recommend you do your due dilligence and read through them carefully and/or ask Claude or ChatGPT to read them for you and explain what they do. Never run scripts from random people on the internet (like me) without checking them first and making sure they do exactly what you want, and nothing more.

Just those two scripts should get you 90% of the way. They get you machines ready to deploy apps to and support production workloads. It takes an hour or so to get both machines set up.

If you happen to also use Ruby on Rails like me, I made a much more detailed technical guide with step-by-step explanations on how to migrate all your data off the cloud and into a server: ☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

Once you have your production machine(s) set up, you should be able to get all data migrated in a couple hours just by following the steps and running the PostgreSQL commands described to dump and re-import the data.

And that’s it. There’s not much more to it.


All of this works for me and is exactly how I do things for my own businesses. This is the current iteration of everything I’ve learned on how to run production apps over the years.

But I don’t have everything figured out.

People have been raising claims about reliability, recovering from disasters, automating backups, that kind of stuff. I think those are valid claims, I just don’t think they’re worth paying 10x more in monthly costs. I do backups; and if things out of my control break (like datacenter failures, which are pretty rare but I agree they can happen once every… few years?) then I guess can assume a little downtime to fix things up and restore a backup. I’m okay with that and I think it’s worth the savings.

But in any case, I’m sure there’s better ways of doing things, and I’m sure there things I’m not even considering that I should look into. I could always benefit from good feedback, so if you have any good ideas or constructive criticism on how to do things better, please comment or reach out on X.

P.S.: Follow me on Twitter to stay in the loop. I'm writing a book called Bold Hackers on making successful digital products as an indie hacker. Read other stories I've written. Subscribe below to get an alert when I publish a new post:

No spam ever, unsubscribe with one single click.