Deploy Syncthing to AWS EC2 with Terraform

(Reto Kaiser) #1

Here’s some Terraform code to deploy Syncthing to an EC2 instance on AWS. It provisions these resources:

  • EC2 instance running Debian with Syncthing installed
  • EBS volume for storing the data, with regular snapshots taken by a Lambda function
  • VPC, Subnet, Firewall, etc. for networking
  • Route53 zone and records for DNS resolution

Using EBS is nice, because the volume’s size can be increased if needed, and regular snapshots can serve as a backup.

It’s defaulting to use a t2.medium instance (~ $35 per month) and an EBS volume of 100GB with hourly snapshots (~ $15 per month, if files change ranged). All of that can be changed with Terraform variables.

Hope it helps someone!

It could be nice to provide even simpler steps to provision Syncthing to the cloud for users who just want an always-on Syncthing node. Probably it would be possible using a Docker image with AWS Elastic Beanstalk or with