← Back to Blog
AI Automation

How to Setup n8n on AWS EC2: A Step-by-Step Guide

March 14, 2026
Armor Tech Engineering
5 min read

Workflow automation is becoming a critical component of modern infrastructure. While cloud-hosted options exist, running n8n on your own AWS EC2 instance gives you complete data privacy, unlimited executions, and the ability to integrate securely with your internal VPC resources.

Prerequisites

  • An active AWS account
  • Basic knowledge of the terminal and SSH
  • A registered domain name (optional, but recommended for SSL)

Step 1: Launch an EC2 Instance

Head over to the AWS Management Console, navigate to EC2, and click Launch Instance. We recommend an t3.micro or t3.small instance running Ubuntu 22.04 LTS.

AWS EC2 Dashboard with n8n instance
AWS Management Console showcasing the provisioned n8n-server instance

Step 2: Install Docker and Docker Compose

SSH into your new instance and update your packages. Then, install Docker:

sudo apt update && sudo apt upgrade -y
sudo apt install docker.io docker-compose -y
sudo systemctl enable docker
sudo systemctl start docker

Step 3: Setup the n8n Docker Compose File

Create a new directory for n8n, and inside it, create a docker-compose.yml file:

version: '3.8'

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=your-domain.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://your-domain.com/
      - GENERIC_TIMEZONE=UTC
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

Step 4: Start n8n

With your configuration ready, start the n8n container in the background:

sudo docker-compose up -d

Once started, you can verify it's running with sudo docker ps. Ensure that your AWS Security Group allows inbound traffic on port 5678 (or 80/443 if using a reverse proxy like Nginx or Traefik).

Step 5: Access the Dashboard

Navigate to http://your-ec2-ip:5678 in your browser. You will be greeted by the n8n setup screen where you can create your owner account and start building out your automated workflows!

Need help scaling your automation?

At Armor Tech, we specialize in building robust, high-availability architecture for Agentic AI and complex workflows. If you need help architecting your automation layer, we are a message away.

Contact Our Engineering Team