Open
Conversation
Drop X.509 certificate authentication in favor of SCRAM (username/password via DATABASE_URL) with TLS. Add /health endpoint for ECS health checks, URL redaction for safe logging, and MONGODB_RETRY_WRITES env var support (DocumentDB requires retryWrites=false).
Simplify Dockerfile.mongodb to dev-only (no TLS/X.509 branch). Add curl and AWS DocumentDB CA bundle download to Dockerfile.api. Remove prod targets and cert generation from Makefile. Delete X.509 cert scripts and config files.
Three standalone templates deployed in order: - network.yml: VPC (10.2.0.0/21), 2 public + 2 private subnets, ALB/ECS/DocumentDB security groups, DocumentDB subnet group, S3 VPC endpoint - database.yml: DocumentDB 5.0 cluster with Secrets Manager credentials and Lambda-backed custom resource to build the full connection URL - backend.yml: ECS Fargate service behind ALB with HTTPS (ACM), Route 53 DNS (cfdb.vis-api.link), Secrets Manager injection for DATABASE_URL
After pushing the image to ECR, trigger a rolling ECS deployment via update-service --force-new-deployment. Tag images with both :latest and the short git SHA for traceability. ECS cluster/service names are read from GitHub secrets.
Store the sync API key in Secrets Manager instead of as a plain environment variable, matching the DATABASE_URL pattern. The execution role is granted read access to both secrets.
Add VPC Flow Logs to CloudWatch (matching CVH reference pattern) for network traffic monitoring. Expand the AZ region map from 3 regions to the full set of 27 regions from the CVH template.
conradbzura
commented
Feb 17, 2026
Collaborator
Author
There was a problem hiding this comment.
Virtually a direct copy of https://github.com/hms-dbmi/cvh/blob/john-conroy/yaml-envs/cloudformation/network.yml
AWS EC2 security group descriptions only accept ASCII characters.
… instance count to 1; Drop DB instance size to t3.micro; Drop default DB admin username
e8fbf76 to
76e3c9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deploy CFDB on ECS Fargate with DocumentDB, replacing the unused X.509 certificate auth with SCRAM (username/password) over TLS.
DATABASE_URL, and DocumentDB'sretryWrites=falserequirement is handled viaMONGODB_RETRY_WRITESGET /healthendpoint for ECS target group health checksDockerfile.mongodbto dev-only (remove TLS/X.509 branch); addcurland AWS DocumentDB CA bundle toDockerfile.api-prodMakefile targetscloudformation/): network (VPC, subnets, security groups), database (DocumentDB + Secrets Manager), backend (ECS, ALB, ACM, Route 53):latestand short git SHA, thenaws ecs update-service --force-new-deploymentLocal dev workflow (
make mongodb && make api) is unchanged.Post-merge deployment steps
1. Deploy CloudFormation stacks (in order)
2. Set GitHub repo secrets
The CI/CD workflow needs two new secrets:
Set in GitHub → Settings → Secrets and variables → Actions:
ECS_CLUSTERcfdb-backend-clusterECS_SERVICE3. Retrieve the sync API key
The sync API key is auto-generated at stack creation. Retrieve it for use in
X-API-Keyheaders:4. Update IAM deploy role permissions
The existing
AWS_IAM_ROLEused by GitHub Actions needs these additional permissions:ecs:UpdateServiceecs:DescribeServices5. Initial data load
DocumentDB starts empty. Restore data from a host with VPC access (bastion or ECS Exec):
6. Verify
Test plan
make mongodb && make apistarts successfully,curl http://localhost:8000/healthreturns 200docker build -f Dockerfile.api .succeeds (CA bundle downloaded)curl https://cfdb.vis-api.link/healthreturns 200