AWS Builder Center
Inside a 3-Tier AWS Architecture: What Really Happens Between a Click and a Response

Inside a 3-Tier AWS Architecture: What Really Happens Between a Click and a Response

A hands-on walkthrough of a production-style 3-tier architecture in ap-southeast-1 — tracing a real request from Internet Gateway through Apache, Flask, and Aurora PostgreSQL Serverless v2, and breaking down why the security group boundaries matter more than the diagram itself.

Senior DevOps Engineer | AWS Community Builder (Networking) | Terraform • CI/CD • Hybrid Infra

Building a Battle-Tested 3-Tier Architecture on AWS

Every developer draws a 3-tier diagram at some point. Fewer stop to ask: what actually happens, packet by packet, security group by security group, in the half-second between a user's click and the response landing back in their browser?
I recently deployed a 3-tier architecture in  ap-southeast-1  that answers exactly that question — not as a whiteboard exercise, but as a running stack with real traffic flow, real isolation boundaries, and real failure domains. Here's a walkthrough of the design, the reasoning behind each boundary, and why "3-tier" is still one of the most underrated patterns in cloud architecture.

The Setup

The architecture splits cleanly into three tiers, each living in its own subnet, each with a distinct blast radius:
  • Web / Presentation Tier — public subnet, EC2 running Apache, serving frontend assets and reverse-proxying API calls
  • Application / Logic Tier — private subnet, EC2 running a Python Flask app on port 5000, handling all business logic
  • Data Tier — private subnet, Amazon Aurora PostgreSQL Serverless v2 on port 5432
Only one of these three is internet-facing. That single design choice does more for the security posture of this system than almost any other decision made.

Tracing a Request End to End

  1. The request enters AWS. A user's HTTPS request hits the Internet Gateway attached to the VPC — the only sanctioned front door into the environment.
  1. The web tier catches it. The public EC2 instance terminates the request, serves static frontend content directly, and — critically — acts as a reverse proxy for anything dynamic.
  1. The app tier does the thinking. The web server forwards API calls to the private Flask application on port 5000. This is where business logic lives, completely walled off from direct public access.
  1. The data tier answers. Flask talks to Aurora PostgreSQL Serverless v2 over port 5432 to read or write application data.
  1. The response retraces its steps. Aurora → Flask → Apache → the user's browser, over the same HTTPS connection that started it all.
Nothing skips a tier. Nothing reaches the database directly from the internet. That's the whole point.

Why Serverless v2 for the Data Tier

Aurora PostgreSQL Serverless v2 isn't just a cost play — though scaling compute capacity to match actual load rather than provisioning for peak-forever is a real win. It also means the data tier's capacity profile can evolve independently of the EC2-based tiers above it, without a re-architecture.

The Quiet Hero: The NAT Gateway

Private subnets still need to pull package updates and reach external endpoints — they just shouldn't be reachable from the internet. The NAT Gateway threads that needle: outbound access without inbound exposure. It's an unglamorous component that quietly does the job every "least privilege" checklist demands.

Security Groups as the Real Perimeter

The subnet boundaries get the attention, but the security groups are doing the granular enforcement — tier-to-tier communication is explicitly allowed, everything else is default-denied. The public subnet doesn't get a free pass to the database just because it's "internal" traffic; it has to go through the app tier, and only the app tier's security group is permitted to speak to Aurora on 5432.

Why This Pattern Still Matters

In an era of managed everything — API Gateway, Lambda, Fargate — it's worth remembering that the 3-tier EC2-based pattern is still exactly right for a large class of workloads: predictable traffic, existing Flask/Django codebases, teams that want direct OS-level control, or migrations where lift-and-shift-plus-hardening beats a full serverless rewrite.
Good architecture isn't about using the newest AWS service. It's about drawing boundaries that match your actual risk model — and this one draws them in exactly the right place: one public door, two private rooms, and a data tier that never has to look the internet in the eye.


What would you change about this design? I'd love to hear how others are handling similar multi-tier deployments in ap-southeast-1 or elsewhere — drop your thoughts below.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article