Skip to content
Twelve deployments

What 50 shades of n8n on AWS taught me ​

A robot holding an n8n.yaml file paints a house in shades of blue, next to a fan of color swatches labeled from nano to EKS.

n8n is a workflow automation tool that teams use to build AI agents, and some of them want it inside their own AWS account. The reasons are concrete: data stays in the account, workflows can reach Amazon Bedrock, S3 or RDS with IAM, and the bill follows the usage. The usual path is to pick a template on GitHub and deploy it. Each template I looked at picks one architecture: one Fargate task with EFS, or queue mode with a fixed shape, or EKS for an Enterprise license. Then the template works for the demo, and the trouble starts later, at runtime, on details that no template mentions.

I maintain n8n-on-aws, a CLI that turns one YAML file into these deployments. I wanted to know what it really takes, so I described the deployment options of n8n as one YAML grammar, compiled it to AWS CDK, and deployed about a dozen shapes to my own AWS account in eu-west-3, between November 18 and November 30, 2026, destroying each of them before the next.

In short:

  • the AWS building blocks were never the problem, n8n's own constraints were
  • Aurora Serverless will not pause while n8n runs: it pings the database every two seconds
  • the smallest Fargate task is too small for n8n
  • the runner is a second image, on another registry, that must share the n8n version
  • your first destroy will leave Aurora, a secret, a snapshot, a DNS record and a log group behind

One file, many shades ​

The "50 shades" are the combinations of a handful of axes:

AxisOptions
runtimeECS on Fargate, ECS on EC2 hosts, EKS
topologyone process, queue mode, split webhooks, multi-main
databaseSQLite on EFS, Aurora Serverless v2, provisioned Aurora, external PostgreSQL
queuenone, ElastiCache Serverless, provisioned ElastiCache, external Redis
binary dataEFS, S3
login wallnone, Cognito at the edge, ALB OIDC, n8n single sign-on
networkpublic or private subnets, NAT none, single or per-AZ, VPC created or reused
provisioningcreate, reuse

I counted more than 50 valid combinations, and many more invalid ones. Then I deployed a dozen of them.

The smallest file that deploys fits in six lines, once its comments are removed:

yaml
apiVersion: n8n-on-aws/v1
name: n8n-minimal
n8n:
  version: "2.37.1"
  license:
    usage: {purpose: internal-business, accept_sustainable_use_license: true}

Everything else comes from a profile, from nano to xlarge. The largest sample, multi-main with a provisioned Aurora cluster, a KMS key and single sign-on, is 72 lines. n8n-on-aws reads both files, and prints the monthly cost before anything is created:

shell
$ n8n-on-aws plan -f nano.yaml --cost
Monthly cost estimate (USD, us-east-1, prices of 2026-11-19)
  ...
  total               3.70      0.61   = 4.31 a month
  note: n8n runs 238 of 730 hours a month (office hours)

The nano shape is one Fargate Spot task with SQLite on EFS, behind CloudFront, with a Cognito login wall at the edge, stopped outside office hours. The ladder costs this much per month, from plan --cost in us-east-1 with the prices of 2026-11-19:

ShapeRuntimeTopologyCost per month
nanoECS on Fargate Spotone process$4
minimalECS on Fargateone process, Aurora Serverless$72
queue-workersECS on Fargate, workers on Spotqueue$187
split-webhooksECS on Fargatesplit webhooks$993
enterprise-haECS on Fargatemulti-main, Aurora Multi-AZ$1,758
eks (new cluster)EKSofficial Helm chart$186

These are estimates from the AWS Price List API, not invoices. The shapes page keeps the same table with the smoke-test status of each shape. Note that enterprise-ha is the exception there: I never smoke-tested it, because multi-main needs an n8n Enterprise license.

What only a real deployment showed ​

Every shape synthesized and passed its tests long before its first deployment. Then the account had its say. Five lessons came out of these deployments, each with what happened and what I changed. The AWS console evidence is not reproduced here, because each test account was destroyed.

The task runner is a second image with its own address ​

Since n8n 2.0, the Code node runs in a separate task runner. In production, every n8n container that executes workflows gets a sidecar from the n8nio/runners image, pinned to the same version as n8n. The first deployment of minimal could not pull the sidecar from docker.n8n.io, because that registry, which serves the n8n image, does not serve the runners image. It is on Docker Hub. In other terms, the two images that must share a version do not share a registry. I now pin both from the same n8n.version, and validate warns when that version is a moving tag such as stable. The n8n 2.0 changelog documents the split: the runner left the main image, and the two tags must match.

n8n needs more memory than the smallest Fargate task ​

My first nano shape used 0.25 vCPU and 0.5 GiB, the smallest Fargate task. n8n and its runner were killed with exit code 137, which means Out-Of-Memory, and restarted in a loop. I raised the default to 0.5 vCPU and 1 GiB, which adds about $0.70 a month to nano, and validate now warns for any n8n process under 1 GiB. Of course, the cheapest task is the one that stays up.

Aurora Serverless never pauses while n8n runs ​

Aurora Serverless v2 can scale down to 0 capacity units and pause, which looks perfect for a quiet n8n. I measured it, and the database never paused. The reason is in n8n's source: DB_PING_INTERVAL_SECONDS defaults to 2, so n8n keeps a connection open and pings it every 2 seconds. Therefore, scale-to-zero saves money only when the n8n services themselves are stopped, for example outside office hours. I turned that into a warning in plan:

text
· info    F3   database.min_acu: Aurora never pauses while n8n runs: n8n keeps a connection open and pings the database every 2 seconds
                    → min_acu: 0 saves money only when finops.schedule stops the services

ElastiCache Serverless wants the plain Redis client ​

Queue mode needs Redis, and ElastiCache Serverless is the frugal choice. n8n offers a cluster client for Redis clusters, so I picked that one first. Over TLS, with ElastiCache Serverless, workers exited with "Failed to refresh slots cache". The plain client works. I made it the default, and smoke-tested the queue shapes with workers scaling from 0 to 3 and back on the depth of the queue.

Lambda@Edge logs where your users are ​

The login wall at the edge is a Lambda@Edge function that checks a Cognito session on every editor request. I looked for its logs in eu-west-3, the region of the deployment, and found none. Lambda@Edge reports in the region of the edge cache that served the request, and for my users near Paris, the test showed eu-central-1 and eu-west-2. I graph the function in the edge regions of the deployment's continent. Note that a CloudWatch alarm cannot read a metric from another region, so there is no alarm on these errors, and the dashboard says so.

Leaving nothing behind ​

A test deployment is useful only if it costs nothing afterwards. My first rounds of destroy did not meet that bar. A smoke test needed about five manual AWS calls to get back to a clean account:

  • destroy stopped on the deletion protection of Aurora, with no hint
  • the encryption key secret and the final snapshot are retained on purpose, and had no command to delete them
  • the DNS record that validated the certificate stayed in the hosted zone
  • a log group came back after destroy, because a custom resource wrote to it on its Delete event

In addition, a stray secret or DNS record blocked the next deployment of the same name. Now destroy stops with a hint on a protected database, and cleanup deletes the log groups in every region involved, the validation record and the Lambda@Edge function. cleanup --purge also deletes the retained secret and snapshots, after listing them, because it makes backups unreadable. The last smoke test of a production shape ended with no log group, secret, snapshot or DNS record left in the account.

From lessons to rules ​

None of these lessons would help the next person if they stayed in my notes. I turned each one into a rule with a stable code, run by validate, plan and deploy --dry-run before any AWS call. Some rules carry n8n's license terms as well. For example, multi-main needs the Enterprise edition, so a community file that asks for it fails early:

shell
$ n8n-on-aws validate -f minimal.yaml --set topology.mode=multi-main
minimal.yaml: invalid (1 errors, 1 warnings)
  ✗ error   L7   topology.mode: multi-main setup needs the enterprise edition (configured: community)

At the end of the day, this is the boring part of the work, and the part that matters. A template encodes one architecture. A rule encodes a fact about n8n that holds for every architecture. The finding codes reference lists them all.

What to take away ​

If you plan to run n8n in your own AWS account, then expect the AWS side to be the easy part, and budget your time for n8n's constraints: the runner sidecar, memory, database connections, the Redis client, and where logs go. Deploy for real, measure what happens, then destroy. Do not skip the last step.

If you run a handful of workflows and do not need the data in your own account, then n8n Cloud is the shorter path. The ladder in this post pays off when workflows must reach your VPC, your RDS or Bedrock with IAM.

n8n-on-aws is open source, if you want to try these shapes:

shell
$ uvx n8n-on-aws init                      # questions, then a commented n8n.yaml
$ uvx n8n-on-aws plan -f n8n.yaml --cost
$ uvx n8n-on-aws deploy -f n8n.yaml
$ uvx n8n-on-aws destroy -f n8n.yaml
$ uvx n8n-on-aws cleanup -f n8n.yaml

Start with nano, and do not forget the last two commands. This will save money.

Further reading ​

Last updated: