Tuesday, August 4, 2026

Host n8n on AWS EC2: Small Business Step-by-Step Guide

Quick Answer: Small businesses can self-host n8n on AWS EC2 by launching a t2.micro or t3.micro instance, installing Docker, and running the official n8n Docker container. This setup costs roughly $8–$15 monthly and provides full control over workflow automation for 350+ integrations.

Why Host n8n on AWS EC2?

Small businesses need reliable automation without subscription creep. Services like Zapier and Make charge per task and lock data in proprietary clouds. n8n—launched in 2019 by Berlin-based n8n GmbH—offers a source-available alternative with a visual node editor and support for JavaScript or Python custom code. As of December 2025, n8n integrates more than 350 applications. Self-hosting on Amazon EC2 gives you complete data sovereignty, predictable costs, and the flexibility to scale as operations grow. AWS EC2, introduced in 2006, lets you rent virtual servers by the second, eliminating upfront hardware expenses while maintaining enterprise-grade reliability.

Prerequisites for AWS EC2 Setup

AWS Account Configuration

Before touching a terminal, create an AWS account at aws.amazon.com. You will need a credit card for verification. Generate an SSH key pair in the AWS EC2 console—this replaces password login with cryptographic key authentication. Choose a region close to your customers to reduce latency; for example, US East (N. Virginia) or EU (Frankfurt).

Security Group Rules

Configure a security group acting as a virtual firewall. Allow inbound traffic on port 22 (SSH) only from your office or home IP. Open port 80 (HTTP) and port 443 (HTTPS) for web UI access, but restrict 443 to specific IPs if possible. Limit outbound traffic to essential services to reduce attack surface.

Domain and SSL (Optional but Recommended)

Point a subdomain like n8n.yourbusiness.com to your EC2 public IP using Route 53 or your registrar’s DNS. AWS Certificate Manager provides free SSL certificates, enabling HTTPS without manual renewal. This step secures credentials and workflow data in transit.

Step-by-Step EC2 Launch

  1. Launch an instance. In the EC2 console, choose “Launch instance.” Select Amazon Linux 2 AMI (HVM), which is optimized for Docker and widely supported. Choose t2.micro or t3.micro for initial small-business workloads—these qualify for the AWS Free Tier, which includes 750 hours per month for 12 months.
  2. Configure instance details. Keep defaults for Auto-assign Public IP, IAM role (none), and termination protection (disabled for testing, enabled after validation). Ensure the security group you created earlier attaches to the instance.
  3. Add storage. The default 8 GB gp2 volume is adequate for code, logs, and small datasets. For heavier database or file storage, attach a 20–30 GB gp3 volume for roughly $2–$4 per month.
  4. Review and launch. Verify your key pair selection and launch. Wait 1–2 minutes for the instance to enter the “running” state.
  5. Connect via SSH. From your terminal: ssh -i /path/to/your-key.pem ec2-user@your-ec2-public-ip

Install Docker and Deploy n8n

Docker Installation

Docker, released in 2013, operates via OS-level virtualization to package applications into containers. On Amazon Linux 2, install Docker Engine with:

  1. Update packages: sudo yum update -y
  2. Install Docker: sudo amazon-linux-extras install docker -y
  3. Start service: sudo service docker start
  4. Enable auto-start on boot: sudo systemctl enable docker
  5. Add user to group: sudo usermod -a -G docker ec2-user

Deploy the n8n Container

Docker containers announced for EC2 in November 2014, and n8n provides an official Docker image. Run:

  1. Pull the image: docker pull n8nio/n8n
  2. Start the container:
    docker run -d --name n8n -p 80:80 -v ~/.n8n:/home/node/.n8n n8nio/n8n
  3. Verify status: docker ps

The container binds host port 80 to the container’s port 80. Data persists in the mounted volume. Access http://your-ec2-ip to complete the n8n setup wizard and create your admin account.

EC2 Instance Comparison for n8n

Choosing the right instance type balances performance and cost. Below is a comparison of common small-business tiers as of 2025.

InstancevCPURAMMonthly Cost (on-demand)Best For
t2.micro11 GB~$8.50Testing, <20 workflows
t3.micro21 GB~$8.50Light production, <50 workflows
t3.small22 GB~$17Medium load, 50–200 workflows
m5.large28 GB~$68Data-heavy, AI nodes, multiple users
c6g.medium1 (Graviton)2 GB~$13CPU-bound integrations, ~30% better price/performance

Common Hosting Mistakes

Using Default Security Settings

Mistake: Leaving port 22 open to 0.0.0.0/0.
Why it hurts: Enables brute-force SSH attacks that can compromise your workflows and customer data.
Fix: Restrict SSH to your IP or use AWS Session Manager for passwordless access.

Neglecting Automated Backups

Mistake: Storing n8n workflow data only on the EC2 root volume.
Why it hurts: If the instance fails, workflows and credentials vanish.
Fix: Use EBS snapshots and the ~/.n8n volume backup to an S3 bucket via cron.

Ignoring Cost Alerts

Mistake: Running a large instance 24/7 for light usage.
Why it hurts: can spike bills to $200+ monthly.
Fix: Start with t2.micro or t3.micro, enable AWS Budgets, and scale up gradually.

Skipping System Updates

Mistake: Treating the EC2 OS as immutable.
Why it hurts: Unpatched kernels expose your machine to known exploits.
Fix: Schedule monthly sudo yum update and use Amazon Linux 2 security notifications.

Pro Tips from DevOps Practitioners

  • Enable EC2 termination protection during business hours to prevent accidental shutdowns.
  • Use an Application Load Balancer with SSL termination if you need high availability; pair two t3.small instances in an Auto Scaling Group.
  • Install htop and docker stats to monitor resource usage before scaling.
  • Forward n8n logs to CloudWatch for centralized troubleshooting and retention.

FAQ

What is n8n and how does it differ from Zapier?

n8n is an open-source, self-hostable workflow automation tool founded in 2019. Unlike Zapier, which is a closed SaaS platform charging per task, n8n allows unlimited tasks on your own server and exposes code nodes for JavaScript or Python.

Which EC2 instance size is best for a 10-person small business?

A t3.small instance (2 vCPU, 2 GB RAM) typically handles 50–100 active workflows and multiple users comfortably, costing around $17 monthly on-demand.

How do I secure my n8n instance on AWS?

Restrict security group ports to known IPs, enforce HTTPS with AWS Certificate Manager, enable AWS CloudTrail for API audit, and regularly rotate your n8n admin password. Use IAM roles instead of root credentials.

What should I do if my EC2 n8n instance runs out of memory?

Check docker logs n8n for OOM errors. If memory pressure persists, upgrade to a larger instance type or add swap space temporarily. For sustained loads, move to a memory-optimized R5 family instance.

Will hosting n8n myself really save money compared to cloud plans?

For teams running more than 2,000 tasks monthly, self-hosting on a t3.small often becomes cheaper than n8n’s Pro plan. AWS pricing is pay-as-you-go, so costs scale directly with usage.

Conclusion

Self-hosting n8n on AWS EC2 empowers small businesses to automate without recurring platform fees. The method is proven: Docker containers have run on EC2 since 2014, and the official n8n image simplifies deployment. Start small with a t2.micro or t3.micro, enforce strict security, and scale as workflow volume grows.

  • Use a micro instance for testing; upgrade to small or medium for production.
  • Always mount a Docker volume to preserve n8n configuration and history.
  • Enable HTTPS via AWS Certificate Manager for secure credential handling.

Sources

Share:

0 comments:

Post a Comment