I've been running 20+ automated workflows on n8n for the past 8 months without paying a single cent for hosting. No n8n Cloud subscription ($20/month), no server costs, just pure automation freedom powered by Google Cloud's free tier. Here's exactly how I set it up, and how you can too.
Why Self-Host n8n?
n8n Cloud starts at $20/month for basic features. That's $240/year. For a side project or personal automation, that adds up fast. But here's what most developers don't realize: Google Cloud's free tier is incredibly generous and perfect for running n8n 24/7.
What you get with self-hosted n8n:
- Unlimited workflows (Cloud has limits)
- Unlimited executions (Cloud charges per execution)
- Full control over your data
- No vendor lock-in
- Learn infrastructure skills
- Actually free - $0/month
The Free Tier Advantage
The catch? You need to stay within Google Cloud's free tier limits. For n8n, this is surprisingly easy. The free tier includes:
- 1 e2-micro VM instance (enough for n8n)
- 30GB of standard persistent disk
- 1GB of outbound data per month
- Static IP address
For typical automation workflows (API calls, webhooks, data processing), you'll never hit these limits. My Real-World Usage After 8 Months
My Real-World Usage After 8 Months
I'm running these workflows continuously:
- Automated blog publishing (the system that runs ToolShelf.tech)
- GitHub webhook handlers
- API integrations with multiple services
- Daily data sync jobs
- Email automation
- Social media scheduling
Current costs: $0.00. Workflows: 23 active. Average executions: 500-800/month. Uptime: 99.8%. The only time I've come close to the free tier limit was when I accidentally created an infinite loop (rookie mistake - always add error handling!).
Prerequisites
Before we start, make sure you have:
- A Google account
- Basic command line knowledge (copy-paste commands works fine)
- 1-2 hours for initial setup
- (Optional) A domain name - $12/year from any registrar
That's it. No credit card required for the free tier, though Google will ask you to verify your account.
Step 1: Create Google Cloud VM
First, let's create our free VM instance.
- Go to Google Cloud Console: Navigate to
console.cloud.google.comand create a new project (or use an existing one). - Enable Compute Engine API: Go to APIs & Services > Enable APIs and Services > Search for 'Compute Engine API' > Enable.
- Create VM Instance: Go to Compute Engine > VM Instances > Create Instance.
- Name:
n8n-server(or whatever you prefer) - Region: Choose one in your continent (I use
asia-south1in Mumbai) - Zone: Any zone in that region
- Machine configuration: Series: E2, Machine type:
e2-micro(this is the free tier eligible type) - Boot disk: Operating System: Ubuntu, Version: Ubuntu 22.04 LTS, Boot disk type: Standard persistent disk, Size: 30GB (max for free tier)
- Firewall: Check 'Allow HTTP traffic' and 'Allow HTTPS traffic'.
- Name:
- Click Create. Wait about 30 seconds for it to provision.
Step 2: Connect to Your VM
Once created, click the 'SSH' button next to your instance. A browser terminal will open. You're now connected to your new server!
Step 3: Install Docker
n8n runs beautifully in Docker. Let's install it. If you're new to containerization, our Docker for GenAI Developers Guide is a great place to start.
# Update system packages
sudo apt update && sudo apt upgrade -y
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add your user to docker group (so you don't need sudo)
sudo usermod -aG docker $USER
# Install Docker Compose
sudo apt install docker-compose -y
# Verify installation
docker --version
docker-compose --versionImportant: After adding yourself to the docker group, you need to log out and log back in. Close the SSH window and reconnect.
Step 4: Set Up n8n with Docker Compose
Now for the main event - getting n8n running.
- Create n8n directory:
mkdir n8n-data cd n8n-data - Create docker-compose.yml:
nano docker-compose.yml - Paste this configuration:
version: '3.8' services: n8n: image: n8nio/n8n:latest container_name: n8n restart: unless-stopped ports: - "5678:5678" environment: - N8N_BASIC_AUTH_ACTIVE=true - N8N_BASIC_AUTH_USER=admin - N8N_BASIC_AUTH_PASSWORD=ChangeThisPassword123! - N8N_HOST=${EXTERNAL_IP} - N8N_PORT=5678 - N8N_PROTOCOL=http - WEBHOOK_URL=http://${EXTERNAL_IP}:5678/ - GENERIC_TIMEZONE=Asia/Kolkata - N8N_METRICS=true volumes: - ./n8n-data:/home/node/.n8nPress
Ctrl+X, thenY, thenEnterto save.Key things to note:
- Change the password! Seriously, don't use the default.
- We're using basic auth for now (we'll add SSL later if you want).
- Data persists in the
./n8n-datafolder. - Timezone is set to Asia/Kolkata (change to yours).
- Get your VM's external IP:
curl -s ifconfig.meCopy this IP. You'll need it.
- Update the compose file with your IP:
export EXTERNAL_IP=YOUR_IP_HERE - Start n8n:
docker-compose up -d
That's it! n8n is now running.
Step 5: Configure Firewall
Google Cloud blocks most ports by default. Let's open port 5678 for n8n.
- Go to VPC Network > Firewall > Create Firewall Rule.
- Configure:
- Name:
allow-n8n - Direction: Ingress
- Targets: All instances in the network
- Source IP ranges:
0.0.0.0/0(or restrict to your IP for more security) - Protocols and ports: TCP → 5678
- Name:
- Click Create.
Step 6: Access n8n
Open your browser and go to: http://YOUR_VM_IP:5678
You should see the n8n login screen! Username: admin, Password: Whatever you set in docker-compose.yml.
Step 7: Make It Production-Ready
Right now, n8n works but it's not secure because it lacks HTTPS. Let's fix that.
Option A: Use with IP (Quick & Simple)
If you just want to use n8n personally and are okay with HTTP, the current setup works. Just be sure to change the basic auth password to something strong and only access from trusted networks.
Option B: Add Custom Domain + SSL (Recommended)
If you have a domain, we can add proper HTTPS for free.
- Point domain to your VM IP: Go to your domain registrar and add an A record:
n8n.yourdomain.com → YOUR_VM_IP. - Install Caddy (simplest SSL setup):
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddy - Create Caddyfile:
sudo nano /etc/caddy/Caddyfile - Add this configuration:
n8n.yourdomain.com { reverse_proxy localhost:5678 } - Restart Caddy:
sudo systemctl restart caddy
Caddy automatically gets and renews SSL certificates. You now have a secure https://n8n.yourdomain.com!
Monitoring & Maintenance
- Check if n8n is running:
docker ps - View logs:
docker logs n8n -f - Restart n8n:
cd ~/n8n-data && docker-compose restart - Update n8n:
docker-compose pull && docker-compose up -d - Backup your workflows: Your workflow data is in
./n8n-data. Copy this somewhere safe regularly.# Create a compressed archive of your n8n data tar -czf n8n-backup-$(date +%Y%m%d).tar.gz n8n-data/
I have a simple cron job that backs this up to Google Drive every week.
Free Tier Limits & How to Stay Within Them
- VM Instance: The
e2-microis free (1 per account). If you need more power, you'll pay (~$7/month for e2-small), but for n8n, e2-micro is plenty. - Storage: 30GB standard persistent disk is free. n8n typically uses 1-2GB, leaving plenty of room.
- Network: 1GB egress per month (outbound data) is free. Most API calls are tiny. The only risk is if your workflows download or upload large files.
Pro tip: Set up billing alerts in the Google Cloud Console. Get notified if you accidentally exceed the free tier.
Real-World Workflows I'm Running
This isn't theory - here's what I actually use this setup for:
- Automated Blog Publishing: GitHub webhooks trigger on commits, AI agents process content, and it's auto-published to our website. This very blog runs on it! This kind of setup is a perfect foundation for building more complex CI/CD pipelines, a topic we cover in our CI/CD Showdown.
- API Monitoring: Health checks run every 5 minutes, sending alerts to Discord when services go down and tracking response times.
- Data Aggregation: Daily pulls from multiple APIs transform and combine data, pushing it to Google Sheets for analysis.
- Social Media Automation: We schedule posts across platforms, auto-cross-post content, and track engagement.
All of this costs me $0/month in hosting.
Troubleshooting Common Issues
- Port 5678 not accessible: Check firewall rules in Google Cloud, verify docker is running with
docker ps, and ensure your VM external IP hasn't changed. - n8n won't start: Run
docker logs n8n. It's usually a configuration error indocker-compose.yml. - Out of memory: The
e2-microhas limited RAM. Check usage withfree -h. If workflows are complex, consider upgrading to ane2-small($7/month). - Workflows timing out: Check your free tier network limits, increase the timeout in n8n settings, or optimize workflow complexity.
When You Might Need to Upgrade
The free tier works great, but you might need to upgrade if you are:
- Running 50+ workflows concurrently
- Processing large files (100MB+)
- Needing guaranteed uptime for production services
- Exceeding 1GB of monthly data egress
Even then, upgrading to an e2-small instance (~$7/month) is still way cheaper than n8n Cloud.
The Bottom Line
I've saved over $240/year by self-hosting n8n on Google Cloud's free tier. The setup took 2 hours initially, and I spend maybe 10 minutes per month on maintenance. More importantly: I learned Docker, cloud infrastructure, and have complete control over my automation. Those skills are worth way more than $240.
If you're a developer who wants to automate things without vendor lock-in or subscription fees, this is the way.
Building powerful automation shouldn't cost a fortune. At ToolShelf, we believe in giving developers tools and knowledge to build without unnecessary costs. Your data, your infrastructure, your rules.
Try our developer tools - all work offline and respect your privacy: Hash Generator, JSON Formatter, and more.
Stay secure & happy coding,
— ToolShelf Team