- Bot & Beyond
- Posts
- Deploy n8n on AWS Free Tier
Deploy n8n on AWS Free Tier
One click deployment with Cloudformation

I recorded a video, walking you through deploying n8n on AWS using a CloudFormation template.
Here’s the written instructions, commands and scripts that I used.
The stack includes:
✅ n8n (Docker)
✅ External PostgreSQL (Supabase or RDS)
✅ HTTPS via Nginx + Certbot
✅ Persistent credentials
✅ Free-tier compatibility
🧩 What’s Included in the Setup
✅ EC2 instance (
t2.micro
)✅ Dockerized n8n
✅ External PostgreSQL (Supabase pooler or RDS)
✅ Nginx reverse proxy
✅ Certbot-managed HTTPS
✅ CloudFormation for one-click provisioning
📥 CloudFormation Template
You can get the full YAML template here: https://github.com/DiliniRajapaksha/BotAndBeyondAI/blob/main/n8n-aws
🔑 Parameters You’ll Be Asked For:
Parameter | Description |
---|---|
| Your EC2 SSH Key Pair |
| Your subdomain (e.g. |
| Email for Let's Encrypt SSL |
| PostgreSQL host (e.g. Supabase pooler) |
| PostgreSQL username |
| PostgreSQL password (hidden) |
| Long random string to encrypt credentials |
Generate your encryption key with:
openssl rand -hex 32
🧠 After Stack Is Created
🔧 1. Point Your DNS to the EC2 Instance
Add an A record in Cloudflare or your DNS provider:
Type: A
Name: n8n
Value: <Elastic IP from stack output>
Proxy: DNS Only
🔐 2. SSH into EC2
ssh -i your-key.pem ubuntu@<Elastic-IP>
🔐 3. Run Certbot for SSL
sudo certbot --nginx -d sub.yourdomain.com -m [email protected] --agree-tos --non-interactive --redirect
Then restart Nginx
sudo systemctl restart nginx
This issues your HTTPS certificate via Let’s Encrypt.
🧪 4. Test n8n
Visit:
https://n8n.yourdomain.com
You’ll see the n8n login screen.
🧹 Helpful Commands
🐳 Docker
docker-compose up -d
docker-compose logs n8n
🔗 Watch the Full Video Tutorial
Where do you host n8n for personal use?