Shipfastai’s Enterprise tier includes a complete set of Terraform modules that provision a production-ready AWS environment. The infrastructure runs your backend and frontend as containerized services on ECS Fargate, backed by a managed RDS PostgreSQL database, and fronted by an Application Load Balancer with TLS termination. This page explains what is provisioned, how to deploy it, and how to run database migrations once your services are running.Documentation Index
Fetch the complete documentation index at: https://docs.shipfastai.dev/llms.txt
Use this file to discover all available pages before exploring further.
Estimated AWS costs for a small production workload (2 Fargate tasks each for backend and frontend, a
db.t3.medium RDS instance, one NAT Gateway, and an ALB) are roughly $50–100 per month. Costs scale with traffic, task count, and data transfer. Use the AWS Pricing Calculator to estimate your specific configuration before deploying.Prerequisites
Before running Terraform, make sure you have the following installed and configured on your machine:- AWS CLI configured with credentials that have sufficient IAM permissions to create VPCs, ECS clusters, RDS instances, ECR repositories, and IAM roles. Run
aws sts get-caller-identityto verify your credentials. - Terraform 1.5 or later. Run
terraform versionto check. - Docker, for building and pushing your backend and frontend images to ECR.
What the Terraform modules provision
The modules inproducts/enterprise/infra/terraform/ create the following AWS resources:
| Resource | Description |
|---|---|
| VPC | Isolated network with public and private subnets across two Availability Zones, a NAT Gateway, and an Internet Gateway |
| ECS cluster | Fargate cluster with Container Insights enabled; runs the backend API service and the frontend web service |
| ECR repositories | Two private image registries — one for the backend, one for the frontend — with image scanning on push |
| RDS PostgreSQL | PostgreSQL 15 instance (db.t3.medium by default) in private subnets, with Multi-AZ enabled in production, automated backups, and deletion protection |
| Application Load Balancer | Internet-facing ALB in public subnets; routes /api traffic to the backend target group and all other traffic to the frontend target group |
| Auto Scaling | CPU-based auto scaling for both the API service (2–10 tasks) and the web service (2–6 tasks) |
| CloudWatch | Log groups for both ECS services, plus alarms for high CPU and error rates |
| Secrets Manager | A single secret that holds sensitive runtime variables injected into ECS task definitions |
Initialize and deploy
Create your tfvars file
Copy the example variables file and fill in your values:Open You can also override instance sizes, task counts, and auto-scaling limits. Refer to
terraform.tfvars and set at minimum:variables.tf for the full list of inputs and their defaults.Initialize Terraform
backend "s3" block in main.tf with your bucket name and key.Preview the plan
Pushing Docker images
Afterterraform apply succeeds, build your images locally and push them to the ECR repositories Terraform created. The repository URLs are available in the Terraform outputs.
<backend-ecr-url> and <frontend-ecr-url> with the values from the backend_ecr_url and frontend_ecr_url Terraform outputs. After pushing, force a new deployment so ECS pulls the updated images:
Running migrations on AWS
You need to run Alembic migrations whenever you deploy a new schema version. There are two common approaches. Run migrations as a one-off ECS task. Use the AWS CLI to start a task that overrides the container command with the Alembic upgrade command:private_subnet_ids and the ECS tasks security group).
Use a bastion host for interactive access. If you prefer to connect directly to the database, launch a small EC2 instance in a public subnet within the same VPC, configure its security group to allow inbound SSH, and add a rule to the RDS security group allowing connections from the bastion instance on port 5432. You can then SSH in and run Alembic from there.
For automated deployments, the ECS task approach is recommended because it requires no additional infrastructure and uses the same Docker image as your running service.