Skip to main content

Deploying n8n to AWS with Defang

· 5 min read
Defang Team

Introduction

n8n is a powerful open-source workflow automation tool that allows you to connect various applications and services together. Defang is your DevOps agent that can deploy any app to any cloud in a single step. In this guide, we'll walk through the process of deploying n8n to your AWS account using Defang.

Prerequisites

Before getting started, make sure you have:

  • A Defang account (sign up at defang.io)
  • An AWS account
  • Basic knowledge of command-line interface

Step 1: Install Defang CLI

First, install the Defang CLI tool on your system:

eval "$(curl -fsSL s.defang.io/install)"

Verify the installation:

defang version

Step 2: Clone the n8n Sample on Defang

Clone the n8n sample to your directory:

defang new n8n
cd n8n

Once you choose the n8n sample, it'll create the n8n sample for you.

Step 3: Setup Defang for AWS

Please follow step #1 and step#2 in the guide to setup your environment so defang can use your AWS credentials.

Step 4: Configure your Credentials

For this sample, you will need to provide the following configuration. Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.

POSTGRES_PASSWORD

The password for your Postgres database. You need to set this before deploying for the first time.

You can easily set this to a random string using defang config set POSTGRES_PASSWORD --random -Paws

N8N_ENCRYPTION_KEY

The encryption key for your n8n instance. This is used to encrypt sensitive data in the database.

You can easily set this to a random string using defang config set N8N_ENCRYPTION_KEY --random -Paws

DB_POSTGRESDB_SSL_ENABLED

Set to true to enable SSL. Set to false to disable SSL.

It is recommended that you deploy your N8N instance with SSL enabled so it would be a managed version of Postgres.

Please enable SSL by using defang config set DB_POSTGRESDB_SSL_ENABLED=true -Paws

DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED

Set to true to reject unauthorized certificates. Set to false to accept unauthorized certificates. Counterintuitive, but leave this as false to allow managed Postgres to work.

It is recommended that you deploy your N8N instance to accept unauthorized certificates so it would allow managed version of Postgres to work. Please accept unauthorized certificates by using defang config set DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=false -Paws

Step 5: Deploy with Defang

Deploy your n8n instance using Defang:

defang compose up -Paws

Defang will:

  • Build and package your application
  • Create the necessary cloud resources
  • Deploy your n8n instance
  • Provide you with a public URL

Step 6: Configure n8n Settings

Once deployed, Defang will provide you with a URL where your n8n instance is running. Access it through your browser:

https://your-n8n-instance.defang.app

Log in using the credentials you set in the environment variables:

  • Username: admin
  • Password: changeme (remember to change this!)

Step 7: Set Up Your First Workflow

After logging in:

  1. Click on "Create Workflow" to start building your automation
  2. Add nodes by clicking the "+" button
  3. Connect various applications and services
  4. Test your workflow using the "Execute Workflow" button
  5. Activate your workflow when ready

Post-Deployment Steps

Security Configuration

  • Change Default Credentials: Update your basic auth password immediately
  • Enable SSL: Defang automatically provides SSL certificates

Monitoring and Maintenance

View Logs: View application logs using:

defang logs

Monitor Performance: Access Defang dashboard to monitor resource usage

Update n8n: To update to the latest version:

defang compose up

Integration Best Practices

  • Use Webhooks: Configure webhook URLs for external service integrations
  • Set Up Credentials: Store API keys and credentials securely in n8n
  • Test Workflows: Always test workflows in a staging environment first
  • Enable Notifications: Set up error notifications for workflow failures

Backup Configuration

Ensure your n8n data is backed up regularly:

  • Use Defang's volume backup features
  • Export important workflows regularly from the n8n UI
  • Store workflow JSON files in version control

Troubleshooting

Common Issues

Connection failures: Examine logs:

defang logs --follow

Port Issues: Ensure port 5678 is properly exposed in your compose file

Auth errors: Double-check your environment variables

Where to Get Help

Conclusion

Deploying n8n using Defang lets you bring up a robust, production-grade workflow automation system on AWS with minimal effort. You benefit from built-in SSL, scalable infrastructure, and a simple one-command deployment, while Defang handles provisioning and configuring AWS resources behind the scenes. This integration shifts your focus from managing servers, networking, and security to creating automations and business logic. The combination of n8n's versatile workflow engine, Defang's deployment automation, and AWS's reliable cloud platform forms a powerful and efficient automation stack. Happy automating!

Beyond Heroku: Owning Your Deployments

· 7 min read
Defang Team
Defang Team

When you launch a new app, convenience rules. Platforms like Heroku offer a beautifully simple way to push code and see it live in minutes. You don’t need to think about servers, networks or databases. You just deploy. That’s why so many of us start there.

But convenience has a cost. As your product grows, you want more control over performance and security. You want to integrate your own services, tune the infrastructure and optimize your spend. Heroku’s dyno‑based pricing, which starts around $25/month for a modest dyno and climbs to hundreds of dollars for high‑performance dynos, can become prohibitive for serious production workloads. And while Heroku abstracts away the underlying cloud, that abstraction also means you can’t fine‑tune the way your application runs.

This trade‑off eventually becomes untenable. Teams need the simplicity of a platform like Heroku and the power and trust of running inside their own AWS account. This post unpacks why migrating off Heroku matters, highlights the friction points when you try to move to AWS yourself, and shows how the Defang CLI bridges the gap.

Deployments in the Agentic Era

· 4 min read
Defang Team
Defang Team

If you want people to adopt your AI product, the deployment story has to be as strong as the features.

Over the past few decades, the software industry has gone through multiple major transitions. Each one reshaped not only how products are delivered, but also how they are trusted.

  • In the Client-Server Era (circa 2000), apps like SAP and PeopleSoft were purchased and deployed by the customer in their own "on-prem" environment. The customer was in control, but also took on the operational complexity of everything from procuring and deploying hardware to the system software and the apps themselves.
  • In the SaaS Era (circa 2010s), apps such as Salesforce and Workday ran in the provider's cloud and were delivered through the browser. While this simplified operations for the customer, it also meant that the customer data was trapped in these applications, with sometimes ambiguous data ownership and usage rules.
  • Today, we are entering the Agentic Era. Agentic apps promise to deliver an unprecedented productivity boost, but to do so, they need access to the most sensitive business data: conversations, documents, decisions. Customers do not want to transfer such data to an unknown and untrusted external provider's environment. Instead, they expect these products to run inside their cloud accounts (whether it be AWS, GCP, or any other), with their compliance, and under their security controls.

Agentic Era

This is not a small adjustment. It is the foundation of how the next generation of software will be trusted and adopted.

August 2025 Defang Compose Update

· 4 min read
Defang Team
Defang Team

Defang Compose Update

August was about making migrations smoother and showing how you can already use Defang to deploy agentic apps at scale. We expanded our sample projects for popular multi-agent frameworks like CrewAI, LangGraph, Autogen, and Strands, validating them on Playground, AWS, and GCP so you can run multi-agent workloads in production without extra DevOps. Our new Heroku migration flow inspects dynos and add-ons, generates a clean Compose file, provisions managed equivalents like Postgres and Redis, and ships to your own cloud in one command. This cuts costs and removes lock-in. We also introduced MCP BYOC prompts so you can deploy to AWS and GCP straight from your IDE. Railpack on GCP now delivers faster, more reliable no-Dockerfile builds with clearer logs and closer parity with AWS.

Deploying Agentic Apps to the Cloud Shouldn’t Be This Hard…

· 3 min read
Defang Team
Defang Team

Agentic Apps

Deploying Agentic Apps to the Cloud Shouldn’t Be This Hard…

Agentic apps are redefining how software is built: multi-agent workflows, persistent memory, tool-using LLMs, and orchestrated autonomy. But deploying them to the cloud is still painful - for example, your agentic app typically needs to provision:

  • Managed databases like Postgres or MongoDB
  • Fast, scalable caching (hello Redis)
  • Containerized compute that scales
  • Secure networking and service discovery
  • Managed LLMs like AWS Bedrock or GCP Vertex AI

And for many teams, these apps must run inside the customer’s cloud, where sensitive data lives and compliance rules apply. That means you cannot just spin up your own environment and call it a day. Instead, you are deploying across AWS, GCP, DigitalOcean, or whichever stack your customers demand, each with its own APIs, quirks, and limitations.

Now you are not just building agents; you are picking the right infrastructure, rewriting IaC templates for every provider, and untangling the edge cases of each cloud.

The result: weeks of DevOps headaches, lost momentum, and engineers stuck wiring infrastructure instead of shipping agents.

July 2025 Defang Compose Update

· 3 min read
Defang Team
Defang Team

Defang Compose Update

July was all about making cloud deployments even smoother and smarter. We focused on removing friction from deployments and giving you better visibility into costs. Railpack now builds production-ready images automatically when no Dockerfile is present, and our real-time cost estimation feature now supports Google Cloud alongside AWS. We also added managed MongoDB on GCP, introduced an Agentic LangGraph sample, and connected with builders at Bière & Code & Beer MTL. Here’s what’s new.

Defang: Your AI DevOps Agent

· 4 min read
Defang Team
Defang Team

Defang Agent

From Vibe-Coding to Production… Without a DevOps Team

Building apps has never been easier. Tools like Cursor, Windsurf, Lovable, V0, and Bolt have ushered in a new era of coding called vibe coding, rapid, AI-assisted app development where developers can go from idea to prototype in hours, bringing ideas to life faster than ever before.

And with the recently released AWS Kiro, we have now entered a new phase of AI-assisted development called "spec-driven development" where the AI breaks down the app development task even further. You can think of a "PM agent" that goes from prompt to a requirements document, and then an "Architect agent" that goes from the requirements document to a design document, which is then used by "Dev", "Test" and "Docs" agents to generate app code, tests, and documentation respectively. This approach is much more aligned with enterprise use cases and produces higher quality output.

The Hard Part Isn’t Building. It’s Shipping.

However, cloud app deployment remains a major challenge! As Andrej Karpathy shared during his recent YC talk:

"I vibe-coded the app in four hours… and spent the rest of the week deploying it."

While AI-powered tools make building apps a breeze, deploying them to the cloud is still frustratingly complex. Kubernetes, Terraform, IAM policies, load balancers, DNS, CI/CD all add layers of difficulty. This complexity continues to be a significant bottleneck that AI tools have yet to fully address, making deployment a critical challenge for developers.

The bottleneck is no longer the code. It's the infrastructure.

Simple, Secure, and Scalable GCP Deployments from Docker Compose

· 2 min read
Defang Team
Defang Team

Introducing Our New Whitepaper: Simple, Secure, and Scalable GCP Deployments from Docker Compose

We’re excited to share our latest whitepaper, Defang + GCP: Simple, Secure, and Scalable Deployments from Docker Compose.

Want to skip the blog?

Deploying to Google Cloud Platform (GCP) doesn’t have to be complicated. Docker Compose made defining local apps simple, and Defang makes cloud deployments just as easy.

With Defang, you can:

  • Deploy to GCP with a single command. Go from Compose to Cloud Run, Cloud SQL, and more with just defang compose up --provider=gcp.
  • Skip the DevOps overhead. No need for Terraform, Pulumi, or custom scripts. Defang maps your Compose services to the right GCP resources — compute, storage, networking, and even managed LLMs.
  • Enjoy built-in security and scalability. Defang automates GCP best practices, handling service accounts, secret management, HTTPS, auto-scaling, and more.
  • Integrate with your workflow. Deploy from your terminal, GitHub Actions, or even natural language prompts in VS Code, Cursor, or Windsurf.
  • Save costs and avoid surprises. Choose from affordable, balanced, or high-availability modes with built-in cost estimation coming soon.

Our whitepaper walks through how Defang integrates with GCP, including how it:

Sample: Starter Kit for RAG + Agents with CrewAI

· 7 min read
Defang Team
Defang Team

Why Build a Starter Kit for RAG + Agents?

Let’s be honest: every developer who’s played with LLMs gets that rush of “wow” from the first working demo. But the real headaches show up when you need to stitch LLMs into something production-grade: an app that can pull in real data, coordinate multi-step logic, and more. Suddenly, you’re not just writing single prompts. You’re coordinating between multiple prompts, managing queues, adding vector databases, orchestrating workers, and trying to get things back to the user in real-time. We've found that CrewAI (coordinating prompts, agents, tools) + Django (building an api, managing data), with a bit of Celery (orchestrating workers/async tasks), is a really nice set of tools for this. We're also going to use Django Channels (real-time updates) to push updates back to the user. And of course, we'll use Defang to deploy all that to the cloud.

If this sounds familiar (or if you're dreading the prospect of dealing with it), you’re the target audience for this sample. Instead of slogging through weeks of configuration and permissions hell, you get a ready-made template that runs on your laptop, then scales—unchanged—to Defang’s Playground, and finally to your own AWS or GCP account. All the gnarly infra is abstracted, so you can focus on getting as much value as possible out of that magical combo of CrewAI and Django.

Just want the sample?

You can find it here.