Skip to content

elasticscale/terraform-aws-n8n

Repository files navigation

Description

This sets up a N8n cluster with two Fargate Spot instances and a ALB. It is backed by an EFS file system to store the state. The total costs are around 3 USD per month (provided your ALB is in the free tier). It does not come with SSL (optionally it can listen for SSL connections), but this would raise the cost. You can also use a service like Cloudflare to run the SSL for you.

Note: This module has been setup as a cheap and easy way to run N8n. Data is stored on a EFS volume (you must back this up yourself). We use a single instance (Fargate Spot) so it might be replaced every now and then. N8n is not ment to run stateless behind a load balancer (you will get issues with webhooks).

Check out or blog post about it here: Run n8n on AWS for less than a cup of coffee per month

About ElasticScale

Discover ES Foundation, the smart digital infrastructure for SaaS companies that want to grow and thrive.

Check out our website for more information.

ElasticScale banner

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

Name Source Version
vpc terraform-aws-modules/vpc/aws n/a

Resources

Name Type
aws_cloudwatch_log_group.logs resource
aws_ecs_cluster.ecs resource
aws_ecs_cluster_capacity_providers.main resource
aws_ecs_service.service resource
aws_ecs_task_definition.taskdef resource
aws_efs_access_point.access resource
aws_efs_file_system.main resource
aws_efs_mount_target.mount resource
aws_iam_role.executionrole resource
aws_iam_role.taskrole resource
aws_lb.main resource
aws_lb_listener.http resource
aws_lb_listener.https resource
aws_lb_target_group.ip resource
aws_security_group.alb resource
aws_security_group.efs resource
aws_security_group.n8n resource
aws_availability_zones.available data source
aws_caller_identity.current data source
aws_region.current data source

Inputs

Name Description Type Default Required
certificate_arn Certificate ARN for HTTPS support string null no
container_image Container image to use for n8n string "n8nio/n8n:1.4.0" no
desired_count Desired count of n8n tasks, be careful with this to make it more than 1 as it can cause issues with webhooks not registering properly number 1 no
fargate_type Fargate type to use for n8n (either FARGATE or FARGATE_SPOT)) string "FARGATE_SPOT" no
prefix Prefix to add to all resources string "n8n" no
url URL for n8n (default is LB url), needs a trailing slash if you specify it string null no

Outputs

Name Description
lb_dns_name Load balancer DNS name