Terraform foundation for deploying the Fountain Life Notebook interview app to AWS.
This repo is intentionally inert until someone provides AWS credentials and runs Terraform. Do not run terraform apply or deploy workflows without explicit approval.
| GCP pattern | AWS shape in this repo |
|---|---|
| Cloud Build | GitHub Actions |
| Artifact Registry | Amazon ECR |
| Cloud Run service | ECS Fargate service behind an Application Load Balancer |
| Static frontend hosting | S3 private bucket with CloudFront |
| Firebase/Auth or Identity Platform | Cognito User Pool and hosted UI |
| Secret Manager | AWS Secrets Manager injected into ECS task env |
| Cloud Run HTTPS frontend-to-backend | CloudFront serves the SPA and proxies /api/* to the backend ALB |
- VPC with two public subnets for a low-friction demo deployment.
- Private ECS subnets with outbound internet through one NAT gateway.
- ECR repository for the backend Docker image.
- ECS cluster, Fargate task definition, service, CloudWatch log group, and ALB.
- S3 document bucket used by
DOCUMENT_STORAGE_PROVIDER=s3. - Private S3 frontend bucket plus CloudFront distribution.
- CloudFront
/api/*behavior to avoid browser mixed-content and CORS issues. - Cognito user pool with admin-created users only.
- Secrets Manager placeholder for the MongoDB Atlas URI.
- ECS task-role permission for Amazon Bedrock model invocation.
- GitHub OIDC role for backend/frontend deploy workflows on approved branch refs.
-
Create the AWS account and choose a region, defaulting to
us-east-1. -
Pick a globally unique Cognito domain prefix and copy
terraform.tfvars.exampletoterraform.tfvars. -
Run Terraform locally with approved AWS credentials:
terraform init terraform plan terraform apply
-
Put the MongoDB secret value after the secret placeholder exists:
aws secretsmanager put-secret-value \ --secret-id "$(terraform output -raw mongodb_secret_name)" \ --secret-string "mongodb+srv://..."
-
Enable Bedrock model access for the configured
bedrock_model_idin the selected AWS region. -
Copy the
github_backend_repository_variablesoutput into the backend repo variables. -
Copy the
github_frontend_repository_variablesoutput into the frontend repo variables. -
Run the backend
Deploy Backendworkflow once to publish a real image, roll ECS, and scale the service up. -
Set
backend_desired_count = 1interraform.tfvarsafter the first successful backend deployment if Terraform should preserve one running task on future applies. -
Run the frontend
Deploy Static Siteworkflow to publishbuild/clientto S3/CloudFront. -
Create demo users manually in Cognito with
AdminCreateUseror the AWS console.
The first Terraform apply uses the bootstrap backend image tag and backend_desired_count = 0, so ECS does not try to pull a nonexistent image. The backend deploy workflow pushes the first real image and scales the service up.
- MongoDB Atlas is the fastest database path for this milestone. DocumentDB remains a later AWS-native option.
- Bedrock model access must be enabled in the selected AWS region before notebook answers can use the deployed LLM provider.
- Fargate tasks run in private subnets. The public ALB accepts HTTP only from CloudFront origin-facing edge locations.
- CloudFront-to-ALB origin traffic is still HTTP until an ACM certificate and custom API origin domain are added. Do not handle PHI or production patient data before enabling HTTPS origin traffic.
- Custom domains and ACM are deferred. CloudFront's default HTTPS domain is enough for the first deployed demo and Cognito callback.
- Terraform state can start local for the first account bootstrap. Use
backend.tf.exampleto move to S3 state with DynamoDB locking before team use.