3.1 KiB
3.1 KiB
Documenso on AWS
This Terraform stack deploys Documenso to AWS in ca-central-1 using:
- ECS Fargate for the application tier
- RDS PostgreSQL for the database tier
- S3 for document uploads and signed PDFs
- Application Load Balancer with ACM-managed TLS
- Route53 DNS for
esignature.imex.online - SES domain identity and DKIM records for outbound email
- Secrets Manager for generated application secrets, SMTP credentials, and the optional Documenso signing certificate
- AWS WAF with a basic managed rule set and rate limiting
- CloudWatch alarms for ALB, ECS, and RDS health indicators
Why this shape
This is the most practical fit for your Docker Compose workload if you want a balance of cost efficiency, managed operations, and scaling:
- Fargate gives you horizontal scaling without managing EC2 hosts.
- RDS PostgreSQL is simpler and cheaper than Aurora for a single Documenso workload.
- S3-backed uploads are better for production scale and keep document growth out of PostgreSQL.
- The database stays private; the ALB is public.
- The ECS tasks run in public subnets to avoid a NAT gateway charge. Inbound access is still restricted to the ALB security group.
- HTTPS is terminated by the ALB using ACM. The Documenso self-signed
.p12certificate is separate and is used for document signing, not browser TLS.
Files
main.tf: core infrastructurevariables.tf: configurable inputsoutputs.tf: useful deployment outputsterraform.tfvars.example: example input values
Assumptions built into this stack
- Your DNS for
imex.onlineis hosted in Route53. - You want Multi-AZ RDS enabled from the start for database availability.
- You are comfortable starting with
documenso/documenso:latest. For repeatable deployments, pin a version or digest after your first rollout. - You will provide SES SMTP credentials. Terraform verifies the SES domain, but it does not derive SMTP passwords for you.
- You will provide a base64-encoded PKCS#12 signing certificate and passphrase if you want document signing enabled immediately. This stack injects those values through Secrets Manager instead of mounting a host file.
- You are comfortable with Terraform creating a dedicated IAM user and access key for Documenso S3 uploads because Documenso documents explicit S3 credentials for the upload backend.
- You want Terraform destroy protection enabled for both the database and the uploads bucket.
Deploy
- Copy
terraform.tfvars.exampletoterraform.tfvarsand fill in the SMTP values. - If you want Documenso signing enabled, add
signing_certificate_base64andsigning_certificate_passphrase. - Optionally set
upload_bucket_nameif you want a specific S3 bucket name. - Run
terraform init. - Run
terraform plan. - Run
terraform apply.
Recommended first production adjustments
- Pin the Documenso image to a tested version or digest.
- Wire
alarm_actionsto an SNS topic, PagerDuty bridge, or your on-call system so alarms notify someone. - Expand the WAF rule set if you need more aggressive filtering later.
- Add CloudWatch alarms on ECS 5xx errors, ALB target health, and RDS CPU/storage.