Skip to content

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 in us-east-1, so bootstrap that region too when you use it.

Write the file ​

shell
$ uvx n8n-on-aws init

The 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 ​

shell
$ uvx n8n-on-aws validate -f n8n.yaml
$ uvx n8n-on-aws plan -f n8n.yaml --cost

plan --cost prints the monthly estimate (USD, prices of the AWS Price List API, cached). Three reference points, from the samples:

SampleWhat it buildsMonthly cost
nanoOne Fargate Spot task, SQLite on EFS, behind CloudFrontabout $4
minimalOne Fargate task, Aurora Serverless v2, behind CloudFrontabout $72
queue-workersQueue mode, Spot workers, ElastiCache Serverless, S3 binary dataabout $187

Add finops.max_monthly_usd to stop a deployment whose estimate is above your limit.

Deploy ​

shell
$ 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.yaml

After the first deployment, open the URL printed as the Url output and create the n8n owner account.

Destroy and clean up ​

shell
$ 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 snapshots

destroy 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.