Hosting N8N for FREE with Google Cloud

Aug 5, 2025

How to Host n8n on Google Cloud for Free

Looking to self-host n8n — the powerful open-source automation tool — without paying a monthly fee? This guide walks you through the exact steps to deploy n8n using Docker and Traefik on a small VM hosted by Google Cloud.

This setup is extremely cost-effective:

  • Hosting is free if you use Google Cloud's always-free f1-micro or e2-micro VM tier.

  • Outside the U.S.? You may see a small monthly international egress/networking fee (~$1–2 USD/month).

  • Free trial credits: New Google Cloud accounts typically receive $300+ in free credits valid for 90 days — plenty of runway to test and expand your setup.

This tutorial assumes basic familiarity with Linux and SSH. If you're using a different distribution, adjust accordingly using Docker's official docs. Otherwise, follow this step-by-step process below exactly.

1. Update VM & Install Required Dependencies

For Debian 12:

sudo rm -f /etc/apt/sources.list.d/docker.list
sudo apt update

sudo apt install -y ca-certificates curl gnupg

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update

2. Install Docker & Docker-Compose

For Debian 12:

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3. DNS Setup

Add an A Record in your DNS provider to point to your server's IP address:

  • Type: A

  • Name: n8n (or any desired subdomain)

  • Value: Your server’s public IP address

4. Create a Docker Compose File

sudo vi docker-compose.yml

When the file opens:

  • Press i to enter insert mode.

  • Paste the content carefully, preserving indents. YAML is indentation-sensitive.

  • After pasting, press Esc, then type :wq and hit Enter to save and quit.

Paste the following config: (ensure indents are retained)

version: "3.7"

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - traefik_data:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(${SUBDOMAIN}.${DOMAIN_NAME})
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  traefik_data:
    external: true
  n8n_data:
    external: true

5. Create an Environment File

sudo vi .env

When editing:

  • Press i to enter insert mode.

  • Edit the file to match your configuration (domain, email, timezone).

  • Press Esc, then :wq and Enter to save and exit.

# The top level domain to serve from
DOMAIN_NAME=yourdomain.com

# The subdomain to serve from
SUBDOMAIN=n8n

# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.yourdomain.com

# Optional timezone to set which gets used by Cron-Node by default
GENERIC_TIMEZONE=America/Toronto

# The email address to use for the SSL certificate creation
SSL_EMAIL=you@example.com

6. Create Docker Volumes

sudo docker volume create n8n_data
sudo docker volume create traefik_data

7. Start Docker Compose

sudo docker compose up -d

To stop the container:

sudo docker compose stop

8. Setup Credentials

Once the container is running, open https://n8n.yourdomain.com. It may take a few minutes to initialize.

You’ll be prompted to create an account — enter your name, email, and password. This account will be your admin login.

9. Done

You now have a secure, self-hosted n8n instance up and running. From here, you can start building automations using hundreds of integrations — all within your control, and hosted on your own infrastructure.

10. How to Update n8n

Keeping n8n up to date is crucial on small VMs:

  • Why? Large version jumps can crash the app due to memory limits during migrations.

  • Best practice: Update often to avoid big version jumps.

sudo docker pull n8nio/n8n:latest
sudo docker compose down
sudo docker compose up -d

Need Help?

Aurora Designs can help you with:

  • Setting up or managing your self-hosted n8n instance

  • Designing high-impact automations tailored to your business

  • AI-powered workflows, integrations, and data pipelines

  • Optimizing your system for reliability, speed, and clarity

Whether you’re building internal tools, client workflows, or lead generation systems — we help you automate with confidence.

Want help hosting n8n or building automations? Get in touch →

Modernize your business now

Modernize your business now

Modernize your business now