try.directtry.direct

Deploy n8n to Your Cloud with Stack Builder

n8n is a powerful workflow automation tool that enables developers to connect apps, APIs, and services without code. Deploying n8n to your cloud infrastructure can be streamlined using Stack Builder, a platform designed to simplify the setup of self-hosted applications. In this guide, you’ll learn how to deploy n8n automatically to your cloud account (AWS, Google Cloud, Azure, etc.) using Stack Builder’s preconfigured template.


Prerequisites

  • A cloud account (AWS, GCP, Azure, etc.) with permissions to deploy resources.
  • A Stack Builder account.

Step-by-Step Deployment Guide


1. Create a New Project in Stack Builder

  1. Log in to your Stack Builder account.
  2. Click Create New Project and select your preferred cloud provider.

2. Add services

2.1 Click "Add from template" button

2.2. Select "PostgreSQL" from the dropdown list

2.3 Fill up the "Environment" variables in the settings form, for example:


POSTGRES_DB: n8n
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Changeme!!!

Shell


2.4 Click "Add from template" button

2.5 Search for n8n in the template library and select it. This will preconfigure the service with recommended settings.

2.6 Configure the n8n Service

After selecting the template, you’ll see a basic configuration form. Customize the following fields:

Basic Configuration

  • Service Name: Assign a unique name for your n8n instance (e.g., n8n-prod).
  • Instance Type: Choose a cloud instance size based on your workload (e.g., 2 vCPUs, 4GB RAM).
  • Storage: Specify the storage size for persistent data (minimum 10GB recommended).

Network Configuration

  • Public Access: Enable this to expose n8n via a public URL (required for external access).
  • Port: Default is 5678; ensure this port is open in your firewall rules.

Database Configuration

  • We used PostgreSQL database for scalability.

Environment Variables

N8N_BASIC_AUTH_ACTIVE: Set to true to enable password protection.
N8N_BASIC_AUTH_USER: Define a username for the n8n UI.
N8N_BASIC_AUTH_PASSWORD: Set a secure password.
DB_TYPE: postgresdb
DB_POSTGRESDB_DATABASE: n8n
DB_POSTGRESDB_HOST: db
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_USER: postgres
DB_POSTGRESDB_PASSWORD: Changeme!!!

Shell


3. Deploy n8n project

  1. Review all settings and click Deploy.
  2. Stack Builder will automatically provision the cloud resources and deploy n8n. This process typically takes 5-10 minutes.

Post-Deployment Steps


Accessing n8n

  1. Once deployment completes, navigate to the Services tab in Stack Builder.
  2. Copy the n8n instance’s public IP or URL (e.g., http://<your-instance-ip>:5678).
  3. Log in using the credentials defined in the environment variables.

Security Best Practices

  • Change Default Credentials: Immediately update the default username and password.
  • Enable HTTPS: Use a reverse proxy (e.g., Nginx) or cloud load balancer to add SSL/TLS encryption.
  • Restrict Access: Limit inbound traffic to trusted IP addresses using firewall rules.

Managing Your n8n Instance

  • Scaling: Adjust the instance size in Stack Builder if workloads increase.
  • Updates: Use the platform’s built-in tools to update n8n to the latest version.
  • Backups: Regularly back up your database and workflow data.

Why Use Stack Builder?

Stack Builder eliminates the complexity of manual cloud configuration, allowing you to focus on building automations. By using the preconfigured n8n template, you avoid time-consuming tasks like server setup, dependency installation, and security hardening.


Final Thoughts

Deploying n8n with Stack Builder is a fast, efficient way to harness the power of workflow automation in your cloud environment. Explore other templates in Stack Builder’s library to deploy additional tools like MySQL, PostgreSQL, or Redis alongside n8n for a complete ecosystem.

Ready to start? Visit Stack Builder’s n8n template page to deploy your instance today!