Private n8n server on AWS, rebuildable from code
A marketing agency's own private server for its n8n automations, on AWS for about US$12 to 14 a month. The whole setup is written as code, so it can be rebuilt exactly, every change is checked automatically, and the server backs itself up every night to a second location.
- Client
- Digital marketing agency
- My role
- Designed and built it, with the whole setup written as code (Terraform)
- Period
- Oct to Nov 2026
- Status
- Live, runs the agency's automations
- +AWS server running n8n
- +Nightly backup to a second region, kept 30 days
- +Safety lock: a copy starts with workflows off
- +Spending alert at US$20 a month
Illustration of the real setup, simplified
- US$12 to 14
- a month to run
- 30 days
- of off-site backups, in a second region
- 94
- automatic tests run on every change
- 38
- tests on the server setup
The problem
The agency was moving its automations onto n8n: first one that asks a client's newly paid customers for a review, then the publishing for its 13 client blogs, which until then ran on Zapier. Those automations needed one small server of the agency's own to run on, kept cheap, private and backed up. The agency also asked for the whole setup to be written as code rather than clicked together by hand. That way the server can be rebuilt exactly, and nothing about it depends on one person remembering how it was set up.
The main workflow
From an empty AWS account to a running server (set up with Terraform and scripts, not n8n)
From the project's setup guide and design notes.
- Create storage for the setup records
- Preview and apply the plan
- First start-up
- Install the apps and secrets
- Create the owner login with 2-step sign-in
- Nightly backup to S3
- Practise updates on a copy
What I built
- The whole server is written as code with Terraform (a tool that describes servers in files), in three reusable parts and two setups. 38 tests check the plan without touching the real AWS account.
- n8n and its helper programs run in Docker (a way of packaging apps), behind Caddy, which handles the secure web address.
- Backups: a full copy of the server every day, kept for 7 days, plus a nightly backup to AWS storage (S3) in a second region, kept for 30 days. The backup account can only add files, never delete them, and an alert goes out if a backup stops arriving.
- A copy guard: if the server is ever copied, the copy stays paused with its workflows switched off, so a copy can never run the live automations by mistake.
- The programs on the server cannot read the server's own AWS account details.
- Costs about US$12 to 14 a month to run, with a spending alert at US$20.
- Every change is checked automatically: formatting, validation, scans for security mistakes and leaked passwords (Checkov and Gitleaks), and 94 scripted tests.
Tools used
- Terraform
- AWS Lightsail, S3, IAM, SSM Parameter Store and Budgets
- Docker Compose
- Caddy
- n8n
- Cloudflare DNS
- GitHub Actions
- Healthchecks.io
- UptimeRobot