How to Run Moltbot on VPS ($5/month)

There is nothing more frustrating than waking up to find your 'autonomous' AI agent died six hours ago just because your MacBook went to sleep. I’ve been there—opening my lid to find timed-out WhatsApp connections and half-finished tasks. It became clear that for Moltbot (now OpenClaw) to truly be an AI teammate, it couldn't live on my laptop.

I’m Hanks, and I spent the last three weeks migrating my workflows to a VPS environment to see if a $5/month setup could actually handle a 24/7 workload. I broke a few configurations so you don't have to; here is my honest breakdown of the migration process.

Why Use a VPS

I started this experiment because my MacBook kept going to sleep mid-conversation. The agent would just... stop. I'd open my laptop the next morning to find half-finished tasks and a WhatsApp connection that had timed out.

That's when I realized: if this thing is supposed to be an always-on assistant, it can't live on hardware that shuts down when I close the lid.

Here's what actually changed when I moved to a VPS:

The agent stayed alive. Sounds obvious, but this was huge. Email monitoring, calendar updates, Telegram responses — they all kept running whether I was online or not. The persistence thing isn't just convenient; it's what makes the whole "AI teammate" concept actually work.

My personal machine stayed clean. I got nervous giving an AI deep system access on the same laptop where I have tax documents and client files. A VPS creates what the security folks call a "blast radius" — if something goes wrong, it's contained to that one server. Nothing on my local machine gets touched.

I could scale without buying hardware. When I needed more RAM for heavier tasks, I just upgraded the plan. No physical setup, no waiting for parts.

But here's what surprised me: the real benefit wasn't technical. It was psychological. Once the agent lived on a server I didn't have to think about, I actually started trusting it with more tasks. That shift only happened when it wasn't competing with my daily computing resources.

The privacy angle matters too. Everything runs on infrastructure I control. No cloud AI service logging my data. For anyone privacy-conscious, this self-hosted approach makes sense — assuming you're willing to do the setup work.

Provider Comparison

I tested three providers over three weeks. Not demo testing — I mean running real workflows, breaking things, checking costs, timing how long it took to get from zero to working.

Here's what I actually found.

Hetzner Setup

The numbers first: €3.49/month ($4.09) for 2 vCPU, 4GB RAM, 40GB storage. That's the CX23 plan. Stupid cheap for what you get.

I picked Hetzner because the price was almost too good to believe. The tradeoff: no hand-holding. No one-click deploy, no marketplace template. You're building from scratch.

Here's what I did:

  1. Spun up an Ubuntu 22.04 server
  2. SSH'd in as root (yeah, I know, we fix that later)
  3. Installed Node.js 22: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - then sudo apt-get install -y nodejs
  4. Grabbed the OpenClaw installer: curl -fsSL https://openclaw.ai/install.sh | bash

  1. Ran onboarding: openclaw onboard --install-daemon
  2. Started the gateway: openclaw gateway --port 18789

Total time: about 20 minutes. But that's after I already knew what I was doing. First attempt took me 45 minutes because I forgot to configure the firewall and couldn't access the dashboard.

What went wrong:

The firewall thing. I had to manually set up UFW to allow SSH and port 18789. The official documentation doesn't emphasize this enough. Also, European data centers meant slightly higher latency for me in Asia — not a dealbreaker, but noticeable during live testing.

What went right:

Once it was running, it just... ran. Hetzner's infrastructure is solid. No random downtime, no weird networking issues. And that price — I'm still shocked it works this well for under $5/month.

Who this fits: If you're comfortable with terminal work and want the absolute lowest cost, go Hetzner. If you need things to "just work" without SSH debugging, keep reading.

For a detailed walkthrough, check out my step-by-step installation guide.

DigitalOcean Setup

The numbers: $6-8/month for a usable setup. I went with the $8 Premium plan (2 vCPU, 2GB RAM, 40GB SSD) because the $4 option doesn't have enough RAM for OpenClaw.

DigitalOcean has a marketplace template for OpenClaw. This changes everything.

Here's what I did:

  1. Logged into DigitalOcean
  2. Searched marketplace for "OpenClaw"
  3. Picked the $8 plan, chose a region
  4. Created the Droplet
  5. SSH'd in, ran openclaw onboard
  6. Accessed the dashboard at the Droplet's IP

Total time: under 10 minutes.

The template auto-installs OpenClaw in Docker, which gives you isolation by default. I didn't have to think about dependencies or runtime conflicts. It just worked.

If you prefer Docker environments, I've written a comprehensive Docker setup tutorial that covers best practices.

What surprised me:

The speed. Not server speed — setup speed. I went from "I should test DigitalOcean" to "I'm sending test messages through my agent" in less time than it took to make coffee.

Also, their global data centers meant I could pick Singapore and get way better latency than Hetzner's European servers.

The cost thing:

It's $2-4/month more than Hetzner. For some people, that's irrelevant. For others running multiple projects, it adds up. I justified it because the marketplace template saved me debugging time, which is worth money.

Who this fits: Beginners, or anyone who wants to get running fast without manual Linux setup. The extra cost buys you convenience and speed.

Railway One-Click

The numbers: $5/month gets you $5 in credits. After that, it's usage-based: $20/vCPU, $10/GB RAM per month. This is not a VPS — it's PaaS (Platform as a Service).

I tested Railway last because I was skeptical. "One-click deploy" usually means "works great in the demo, breaks in production."

Here's what I did:

  1. Went to Railway dashboard
  2. Used their OpenClaw template: railway.com/deploy/openclaw-railway-template

  1. Added a persistent volume mounted at /data
  2. Clicked deploy
  3. Opened the web UI, went through the setup wizard
  4. Configured API keys and Telegram token in the browser

Total time: 5-7 minutes. No SSH. No terminal commands. Just clicking.

What actually happened:

It worked. Like, really worked. The setup wizard is password-protected, guides you through auth configuration, and handles the gateway automatically. I added my Anthropic API key, pasted my Telegram bot token, and started sending messages.

The catch: those credits burned faster than I expected. Heavy testing ate through the $5 in about four days. After that, costs became variable. One day I used $1.20, another day $0.30. It depends entirely on how much the agent runs.

The real insight:

Railway isn't for long-term production unless you're okay with unpredictable costs. But for testing? For spinning up a quick proof-of-concept before committing to a full VPS? It's perfect.

I used Railway to validate my workflows before I moved to Hetzner for the long haul.

Who this fits: People who want to test fast, don't want to touch SSH, and can afford variable costs. Also great if you're exploring the open-source AI agent that's been making headlines before deciding whether to self-host seriously.

For newcomers, I recommend starting with my quick start guide to understand the basics before diving into VPS deployment.

Security Hardening

This is where I made my biggest mistakes initially.

I set up my first VPS, got the agent running, and felt proud. Then I realized: I'd left root login enabled, password auth active, and the gateway port wide open to the internet.

That's... not great. Especially when you're running an AI agent with file system access.

Here's what I learned to lock down:

SSH first. Disable root login entirely. I edited /etc/ssh/sshd_config, set PermitRootLogin no, and restarted SSH. Then I generated SSH keys locally (ssh-keygen), copied them to the server (ssh-copy-id), and disabled password authentication completely.

This means: no one can brute-force their way in. You need the key file.

Firewall next. I installed UFW, allowed only SSH (port 22) and the gateway port (18789), then enabled it with ufw enable. Everything else gets blocked by default.

Automatic updates. I set up unattended-upgrades for security patches. The server now updates itself for critical vulnerabilities without me having to remember.

Non-root user. I created a dedicated user for OpenClaw instead of running everything as root. If something breaks, the damage is limited.

The OpenClaw-specific stuff: I enabled sandboxing in the config, set up manual tool approval, and made sure the gateway wasn't publicly exposed. I use Tailscale VPN to access the dashboard instead of opening it to the internet.

One thing I didn't expect: Fail2Ban. This tool watches login attempts and bans IP addresses after too many failures. I installed it after seeing weird login attempts in my logs. Now those attempts get blocked automatically.

What I still worry about:

The agent has file manipulation access. Even with sandboxing, that's powerful. I monitor logs regularly and run openclaw security audit --deep weekly to catch anything weird.

Security isn't "set it and forget it." It's ongoing. But these steps made me feel way more confident about running this 24/7.

Cost Optimization

Let me be honest: I overpaid for the first two weeks.

I started with a 4 vCPU, 8GB RAM server because I thought "more is safer." Then I actually checked resource usage with htop. The agent was using about 15% CPU and 2.5GB RAM.

I was paying for resources I didn't need.

Here's how I cut costs without breaking anything:

Right-sized the server. Downgraded to 2 vCPU, 4GB RAM. The agent runs exactly the same, but I'm paying half as much. Lesson: don't guess, measure.

Cleaned up storage regularly. The workspace folder (~/.openclaw) grows over time with conversation logs and cached data. I set up a cron job to archive old files monthly. Saved about 8GB over three weeks.

Picked the right billing model. Hetzner's hourly billing with monthly caps meant I could test without committing. DigitalOcean's per-second billing (60-second minimum) works the same way.

Used free credits smartly. Railway's $5 credits let me validate the entire setup before spending real money on a VPS. DigitalOcean sometimes offers trial credits — I used those to test their marketplace template.

Monitored API usage separately. Moltbot's LLM costs (Anthropic API) are separate from server costs. I was spending $2-5/day on API calls during heavy testing. That's not VPS cost, but it's real money. I learned to use cheaper models for simple tasks.

The thing that surprised me:

Turning off the server during low-usage periods saves money, but it defeats the whole point of "always-on." I tried it once — scheduled the server to shut down overnight — and woke up to missed Telegram messages and broken workflows.

So I stopped optimizing that way. The $4-8/month server cost is worth the persistence.

What actually saves money long-term:

Choosing a provider that matches your usage pattern. Steady, predictable load? Hetzner's flat rate wins. Variable testing? Railway's credits work. Need global reach with fast setup? DigitalOcean justifies the extra cost.

I ended up on Hetzner for production and keep Railway around for quick experiments. Total monthly cost: about $6.


The Real Takeaway

Running OpenClaw on a VPS isn't just about picking a provider. It's about understanding what you actually need, testing in controlled bursts, and not over-engineering.

I went from "this seems complicated" to "I have a stable, secure, always-on AI agent" in about three weeks. The first week was messy. The second week was debugging. The third week, it just worked.

If you're thinking about doing this: start with Railway to test fast. If it sticks, move to Hetzner or DigitalOcean for long-term stability. Lock down security from day one. Right-size after measuring real usage.

That's the path that worked for me. Your mileage may vary, but at least you won't make the same mistakes I did.

We've shared the step-by-step realities of running OpenClaw reliably on a $5/month VPS, including the pitfalls we hit along the way. If you're ready to skip the terminal commands and debugging, Macaron turns your ideas into working tools instantly. Get started on macaron.im and run your first personal automation in minutes.

Hey, I’m Hanks — a workflow tinkerer and AI tool obsessive with over a decade of hands-on experience in automation, SaaS, and content creation. I spend my days testing tools so you don’t have to, breaking down complex processes into simple, actionable steps, and digging into the numbers behind “what actually works.”

Apply to become Macaron's first friends