Chapter 14: n8n Cloud vs. Self-Hosted n8n (Docker/AWS EC2)¶
Video: Watch this chapter on YouTube (2:54:14)
Overview¶
This chapter explores deployment options for n8n: the managed n8n Cloud service versus self-hosting using Docker on local machines or AWS EC2 instances. Each approach has distinct advantages and tradeoffs.
Detailed Summary¶
The Deployment Decision¶
When starting with n8n, a key decision is how to deploy it:
- n8n Cloud: Managed service from n8n
- Self-Hosted: Run n8n on your own infrastructure
n8n Cloud: Managed Service¶
Advantages¶
| Benefit | Description |
|---|---|
| Simplicity | Sign up and start building immediately |
| No infrastructure | No servers, Docker, or DevOps required |
| Automatic updates | Always on latest version |
| Security patches | Handled automatically |
| Official support | Access to n8n support team |
| Uptime monitoring | Built-in reliability tracking |
Disadvantages¶
| Drawback | Description |
|---|---|
| Cost | Monthly subscription fees |
| Limited control | Can't customize infrastructure |
| Resource limits | Bound to plan tiers |
| Data location | May not meet compliance needs |
Self-Hosted: Full Control¶
Advantages¶
| Benefit | Description |
|---|---|
| Total freedom | Control resources, location, access |
| Cost efficiency | Can be cheaper with existing infrastructure |
| Internal integration | Connect to internal tools/databases |
| Security compliance | Keep data on-premises |
| No vendor lock-in | Full ownership of deployment |
Disadvantages¶
| Drawback | Description |
|---|---|
| Maintenance burden | You handle updates, patches |
| No safety net | You fix what breaks |
| DevOps required | Need infrastructure skills |
| Uptime responsibility | You ensure availability |
Self-Hosting Option 1: Docker Desktop (Local)¶
Prerequisites¶
- Docker Desktop: Download from docker.com
- Git: For cloning the repository
Installation Steps¶
-
Clone the repository:
-
Set up environment:
-
Run Docker Compose (for Mac/CPU):
The package includes: - n8n - OLLAMA (local LLM) - PostgreSQL (database) - Qdrant (vector database)
Accessing Local n8n¶
- Open browser:
localhost:5678 - Create account (local only, not saved permanently)
- Access dashboard
Demo Workflow¶
The starter kit includes a demo workflow: - Chat trigger connected to OLLAMA - Demonstrates local LLM integration - Add fallback model for error handling
Docker Desktop Management¶
- View running containers
- Start/stop containers
- Check logs
- Configure resources
- Access container terminals
Self-Hosting Option 2: AWS EC2¶
Prerequisites¶
- AWS account
- Basic EC2 knowledge
- SSH client
Using CodeCloud Playground¶
- Go to codecloud.com/playground
- Select AWS Sandbox
- Launch playground
- Copy credentials
Creating EC2 Instance¶
- Navigate to EC2 in AWS Console
- Launch Instance:
- Name: "n8n-demo"
- AMI: Ubuntu
- Instance type: t2.medium (for OLLAMA)
- Storage: 30GB
- Create Key Pair:
- Name: "n8n-demo-key"
- Format: .pem
- Security Group:
- Allow SSH (port 22)
- Allow Custom TCP (port 5678) from anywhere
- Launch
SSH Into Instance¶
Install Docker¶
sudo apt update
sudo apt install -y docker.io
sudo systemctl enable docker
sudo usermod -aG docker ubuntu
Install Docker Compose¶
Clone and Configure¶
git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git
cd self-hosted-ai-starter-kit
cp .env.example .env
Security Configuration¶
Edit .env file to disable secure cookies (for HTTP access):
Add:
Launch n8n¶
Verify Containers¶
Should show: n8n, OLLAMA, PostgreSQL, Qdrant
Access n8n¶
- Get EC2 public IP from AWS console
- Open browser:
http://[PUBLIC_IP]:5678 - Create account
- Start building workflows
Comparison Summary¶
| Factor | n8n Cloud | Self-Hosted |
|---|---|---|
| Setup time | Minutes | Hours |
| Maintenance | None | Ongoing |
| Cost | Subscription | Infrastructure |
| Control | Limited | Full |
| Scaling | Plan-based | Manual |
| Security | Managed | Your responsibility |
| Updates | Automatic | Manual |
| Support | Official | Community |
Recommendation by Use Case¶
Choose n8n Cloud if: - Just learning n8n - Don't want infrastructure burden - Need reliable uptime - Have budget for subscription
Choose Self-Hosted if: - Need data on-premises - Have DevOps resources - Want full customization - Cost-conscious with existing servers - Enterprise security requirements
Key Takeaways¶
-
No wrong answer: Both approaches are valid—choose based on needs.
-
Cloud is easiest start: Sign up and build without infrastructure concerns.
-
Self-hosting offers control: Full access to environment and data.
-
Docker simplifies self-hosting: Container-based deployment is straightforward.
-
Starter kit includes AI tools: OLLAMA, PostgreSQL, Qdrant bundled together.
-
EC2 enables cloud self-hosting: AWS infrastructure with self-managed n8n.
-
Security groups are critical: Must allow port 5678 for n8n access.
-
t2.medium minimum for OLLAMA: Local LLM needs adequate resources.
-
Maintenance is ongoing: Self-hosting means continuous responsibility.
-
Hybrid possible: Some organizations use both for different purposes.
Conclusion¶
The deployment choice between n8n Cloud and self-hosting reflects broader tradeoffs in software operations. n8n Cloud removes operational burden at the cost of monthly fees and some flexibility. Self-hosting provides complete control and potential cost savings but requires DevOps expertise and ongoing maintenance. For learning and prototyping, n8n Cloud's simplicity is valuable. For production workloads with specific compliance or integration requirements, self-hosting may be necessary. Many organizations start with Cloud and migrate to self-hosted as needs evolve, or maintain both for different use cases. The detailed Docker and EC2 setup instructions enable learners to experience self-hosting firsthand and make informed decisions.