Getting started
This page takes one deployment from an empty directory to a running n8n, then removes it.
Prerequisites
- Python 3.12 or later and
uv. - Node.js, which runs the CDK CLI (
npx aws-cdk@2). - AWS credentials for the target account.
- A bootstrapped account and region:
npx aws-cdk@2 bootstrap. CloudFront needs a certificate inus-east-1, so bootstrap that region too when you use it.
Write the file
$ uvx n8n-on-aws initThe assistant asks a few questions and writes a commented n8n.yaml. It only writes the choices that differ from the profile you pick. Use --offline when you have no AWS credentials yet, and --from nano to start from a sample.
Check the plan and its cost
$ uvx n8n-on-aws validate -f n8n.yaml
$ uvx n8n-on-aws plan -f n8n.yaml --costplan --cost prints the monthly estimate (USD, prices of the AWS Price List API, cached). Three reference points, from the samples:
| Sample | What it builds | Monthly cost |
|---|---|---|
nano | One Fargate Spot task, SQLite on EFS, behind CloudFront | about $4 |
minimal | One Fargate task, Aurora Serverless v2, behind CloudFront | about $72 |
queue-workers | Queue mode, Spot workers, ElastiCache Serverless, S3 binary data | about $187 |
Add finops.max_monthly_usd to stop a deployment whose estimate is above your limit.
Deploy
$ uvx n8n-on-aws deploy -f n8n.yaml --dry-run # synthesize locally, no AWS call
$ uvx n8n-on-aws diff -f n8n.yaml
$ uvx n8n-on-aws deploy -f n8n.yamlAfter the first deployment, open the URL printed as the Url output and create the n8n owner account.
Destroy and clean up
$ uvx n8n-on-aws destroy -f n8n.yaml
$ uvx n8n-on-aws cleanup -f n8n.yaml # hours later, with cloudfront-cognito
$ uvx n8n-on-aws cleanup -f n8n.yaml --purge # also the retained secret and snapshotsdestroy deletes the stacks. The encryption key secret, the database snapshots, the bucket and EFS are retained, except with environment: dev. When the managed database has deletion protection and the environment is not dev, destroy stops with a hint: set environment: dev or database.deletion_protection: false, deploy again, then destroy.
cleanup deletes what outlives destroy: the log groups of the stacks and of the CDK helper functions, the DNS validation record of a certificate the tool created, and the Lambda@Edge function. It asks first, and without a terminal it needs --yes. --purge makes backups unreadable, so it lists what it deletes first.
CDK assets live in the bootstrap stack CDKToolkit, which destroy does not remove.