Skip to content
~/patrick/projects/aws-test-platform
← projects

system lane · 2026

Shared AWS Test Platform

One Terraform-managed test environment shared by three apps: a single load balancer routes by hostname, one Aurora cluster serves them all, and a NAT instance replaces the NAT Gateways.

pipeline
  1. data (not covered)
  2. model (not covered)
  3. eval (not covered)
  4. serve (covered)
  5. monitor (covered)
result

Three apps share one test environment, and replacing NAT Gateways with NAT instances cut that line from as much as $109 a month to a few dollars.

stack

TerraformAWS ECS FargateAurora Serverless v2ALBVPC

Before this, each app had its own test infrastructure, and each one carried its own VPC, load balancer, database and NAT Gateway. I built one shared test platform that three apps use, and the same Terraform in each app can also run standalone, which is how the two production apps run.

Architecture

Internet Shared ALB one shared VPC portal ai-assessment supportforce NAT instance Aurora routes by hostname one listener ECS Fargate ECS Fargate ECS Fargate outbound for all three Serverless v2 one cluster

Each hostname gets one listener rule on a shared load balancer, so adding an app is one rule plus a target group. The apps connect to one Aurora Serverless v2 cluster and reach the internet through a single small NAT instance. All of it is Terraform, and I applied it on 2026-05-26.

One codebase, two modes

Each app’s Terraform has switches for the pieces it can share (create_vpc, create_alb and an external database endpoint). With the switches off, an app creates everything itself, and with them on it plugs into the shared platform. Test environments run in shared mode. Production for portal and AI assessment runs in standalone mode, each with its own load balancer, so a test change can never take down a production app. Supportforce never reached production.

Cost

NAT Gateways were the largest avoidable line. AWS Cost Explorer shows NAT Gateway spend of $68 in December, $109 in January, $97 in April and $89 in May, and $0 every month since June, once the last gateway was replaced. Four small t4g.nano NAT instances run in their place at a few dollars a month each.

Decisions and tradeoffs

  • Shared test, separate production. Sharing saves money where an outage doesn’t matter, and production keeps its own stack where it does.
  • NAT instances over NAT Gateways. A NAT Gateway bills by the hour whether or not traffic flows. An instance is far cheaper, and the tradeoff is that I own its patching and availability, and a single instance in one availability zone is a single point of failure that is fine for test.

What I’d do differently

The shared platform’s Terraform source lives in a folder on my machine, outside any git repository, so it has no history, no review and no CI. Its state is stored in S3, so the running platform is safe, but the code isn’t. I would put it in a repo with a pipeline from the start, so anyone on the team could change it safely.

nextVoice-to-CRM iOS App →

keyboard

⌘K /
Search and commands
t T
Next / previous theme
j k
Move through items on the page (k on the first one goes back to the top)
o
Open the selected item
g then h w p b a l
Home, Work, Projects, Blog, About, Lab
c
Copy email
?
This list

Choose a theme

Dark

Light

You can also press t to step through them.