16. Designing the AWS Version, on Paper First
The point of designing before building
Section titled “The point of designing before building”This lesson produces a diagram and a written trace, not infrastructure — Terraform comes in Lessons 17-18, deliberately deferred. The actual acceptance test the lesson sets: for every arrow crossing a network boundary in the diagram, can you name the specific security group rule that permits it? If not, the design isn’t simple, it’s incomplete — a distinction worth taking seriously before any terraform apply makes an incomplete design expensive to unwind.
The shape of it
Section titled “The shape of it”Customer traffic hits Route 53, resolves to an Application Load Balancer sitting in public subnets, terminating TLS with an ACM certificate. The ALB splits by path or host header into two target groups — one for the frontend’s Fargate tasks, one for the backend API’s. Both sets of tasks run in private subnets with no public IP at all; the ALB is the only thing internet traffic ever actually touches directly. The API tasks reach RDS PostgreSQL and ElastiCache Redis over private networking, never touching the public internet for that traffic. Outbound needs — pulling images, writing logs, reading secrets — route either through a NAT gateway or through VPC interface endpoints for ECR, CloudWatch Logs, and Secrets Manager specifically, which matters more than it sounds: every one of those requests skipping the NAT is a request that isn’t accumulating a per-GB NAT charge on every single deploy.
Two IAM roles, easy to conflate
Section titled “Two IAM roles, easy to conflate”Fargate uses a task execution role — the platform’s own identity for pulling images and writing logs, invisible to application code. A separate task role is what your actual Node process would assume if it called AWS APIs directly. Confusing the two produces two very different failure modes: mixing up which role needs ECR/logs access produces tasks that never start at all (“cannot pull image”); a task role that’s too narrow produces tasks that start fine and then crash the moment application code tries to read something it was never granted access to. For an API that only talks to RDS and Redis over the network, the task role can stay narrow or unused entirely — RDS and Redis use network reachability and database credentials, not IAM, unless you opt into IAM database authentication specifically.
The registry decision, named explicitly
Section titled “The registry decision, named explicitly”The existing pipeline (Lesson 6) already pushes to GHCR, and that keeps working — Fargate can pull from GHCR with repository credentials, as long as tasks have outbound HTTPS. The AWS-native alternative is mirroring images to ECR in the same Region: simpler IAM (the execution role just needs ecr:GetAuthorizationToken and pull permissions), and interface VPC endpoints mean image layers never cross the NAT at all. Neither choice changes the deployment model — same CI job, same immutable tag or digest, different docker push destination. The decision matters enough to write down explicitly rather than leave implicit, because guessing which registry is authoritative during an incident is exactly the kind of ambiguity a design review is supposed to prevent.
Rolling deployments, and what the load balancer actually sees
Section titled “Rolling deployments, and what the load balancer actually sees”ECS’s minimum healthy percent / maximum percent settings on a service control what a deploy actually looks like from the ALB’s perspective. Set minimum to 100 and maximum to 200, and ECS can run a full extra set of tasks before draining the old ones — zero downtime, briefly double the compute cost. Set minimum to 0, and there’s a real window where nothing is healthy at all if the new revision fails to start, and the ALB serves 503s until something registers. Most teams land in between and learn the right numbers by watching a first real deploy — this is exactly the kind of operational detail that’s invisible in a diagram and only shows up once a deployment actually runs long enough to matter.
What actually pages people at 3am
Section titled “What actually pages people at 3am”Rarely “Fargate is mysterious.” The lesson’s own list of what breaks in this specific pattern: tasks stuck PENDING because a private subnet has no route to NAT or ECR endpoints; an ACM certificate requested in the wrong AWS Region for the load balancer it’s meant to attach to; a database or cache with 0.0.0.0/0 copied straight from a tutorial into a security group; and — the mundane, most common one — a target group pointed at the wrong port after a container image changes what it listens on. None of these are exotic AWS failure modes. They’re the same class of copy-paste and mismatch bugs that showed up constantly across Lessons 6-13, just wearing AWS’s specific error messages instead of Docker’s or systemd’s.
How this looks in production
Section titled “How this looks in production”Teams adopt Fargate specifically to stop SSHing in for kernel patches on the app tier — then get genuinely surprised by NAT and VPC endpoint line items once CI runs fifty times a day and every deploy pulls fresh image layers. The fix is usually adding ECR and Logs endpoints once someone actually pulls a week of VPC Flow Logs and looks at where the money’s going, not guessing upfront. There’s no universally correct answer on NAT vs. endpoints — it’s a real spreadsheet exercise using actual pull frequency and Region pricing, not something to decide by intuition on day one.
Cloud module continues with Terraform in Lessons 17-18.