Easily self-host n8n β the powerful workflow automation tool β on an AWS EC2 Ubuntu instance using Docker, Docker Compose, and Caddy for HTTPS.
- β One-command install script
- β Docker + Docker Compose-based deployment
- β Secure HTTPS via Caddy and Let's Encrypt
- β Automatic reverse proxy setup
- β
Works with subdomains like
n8n.yourdomain.com
- β Lightweight & production-ready
Before running the script, make sure your subdomain (e.g. n8n.yourdomain.com) is correctly pointed to your EC2's public IP:
- Go to your domain registrar's DNS settings
- Add an A record:
- Host: n8n
- Points to: your EC2 public IP
- TTL: Auto or 600
Wait a few minutes for propagation, then proceed below.
git clone https://github.com/<your-username>/n8n-selfhost-aws-setup.git
cd n8n-selfhost-aws-setup
Edit the top variables in setup-n8n.sh
:
DOMAIN="n8n.yourdomain.com"
USERNAME="admin"
PASSWORD="strongpassword"
TIMEZONE="Asia/Kolkata"
chmod +x setup-n8n.sh
./setup-n8n.sh
Once complete, visit:
https://n8n.yourdomain.com
- An AWS EC2 Ubuntu instance (20.04 or 22.04 recommended)
- A subdomain (e.g.
n8n.pixxmo.com
) pointed via A record to your EC2 IP - Domain should allow HTTPS provisioning via Let's Encrypt
- Set a strong username and password
- Never expose port
5678
directly β use reverse proxy only - Use a firewall to block all unused ports (e.g., only allow 22, 80, 443)
- Optional: use PostgreSQL for persistence (instead of default SQLite)
.
βββ setup-n8n.sh # Main installation script
βββ README.md # This file
βββ LICENSE # MIT License
This script is maintained by Pixxmo to help developers and indie founders launch their own workflow automation on their infrastructure.
Follow along as I build automation tools and SaaS products at Pixxmo.
MIT License β free for personal or commercial use.