Example configurations for deploying the Electric sync service to AWS ECS, in two flavours:
terraform/— Terraform (>= 1.3)pulumi/— Pulumi (TypeScript)
Both provision the same stack: a VPC, an RDS Postgres with logical replication enabled, an ECS cluster running the electricsql/electric container, and an application load balancer in front.
| Storage | Best for | |
|---|---|---|
| Fargate (default) | Ephemeral | Trying Electric out; light workloads |
EC2 + NVMe instance store (i4i/m6id types) |
Local NVMe, fastest | Disk-intensive production workloads |
EC2 + gp3 EBS data volume (m6a/m6i/m7a/m7i types) |
Attached EBS, tunable IOPS/throughput | Production workloads at lower cost |
Electric treats its on-disk shape logs as a rebuildable cache, so losing the disk on host replacement is safe — but disk speed directly drives sync performance. See the deployment guide and the AWS integration docs for details.
On EC2, the instance's boot script
(shared/user-data.sh.tpl) discovers every
non-root NVMe device — local instance store or attached EBS (both appear
as /dev/nvme* on Nitro hosts) — RAID0s multiples, formats XFS and
mounts at /mnt/nvme, then joins the ECS cluster. The Electric task
bind-mounts the resulting directory as its storage dir.
See terraform/README.md (start from
terraform.tfvars.example) or pulumi/README.md
(start from Pulumi.example.yaml).
The load balancer serves HTTPS using an AWS ACM certificate:
- Request a public certificate in ACM, in the same region you deploy to.
- Validate it via DNS by creating the CNAME record ACM shows you.
- Pass its ARN as
tls_certificate_arn(Terraform) orelectric-aws:tlsCertificateArn(Pulumi).
In the Terraform config the certificate is required. In the Pulumi config it is optional — omit it to serve plain HTTP only.
This repo was previously
electric-sql/terraform-aws; old links redirect here.