Three-Tier Web Application
coreadvancedThe three-tier pattern splits a web application into a presentation tier a browser talks to, an application tier that runs your code, and a data tier that stores state. On AWS that is Route 53 and CloudFront at the edge, an Application Load Balancer in public subnets, containers or instances in private subnets, and RDS plus ElastiCache plus S3 behind them. Every tier sits in at least two Availability Zones.
Think of it as
Read the diagram as a one-way street. Each tier only accepts traffic from the tier above it, and only the top tier is reachable from the internet. That single rule decides every subnet, route table and security group in the design — a tier that can be reached from two directions is a tier you cannot reason about.
What we're doing: Follow one page request through every hop, and name what each hop is for.
- 1
- One domain covers both static and dynamic traffic, because CloudFront routes by path to two different origins.
- 7
- The ALB is the only component in a public subnet, and the only thing the edge can reach.
- 13
- Cache-aside: the application, not the cache, decides what to store and when. See the ElastiCache section.
- 18
- The application connects to an endpoint name, never an IP — this is what makes failover survivable without a deploy.
Why this works: The value of the pattern is not the box diagram, it is that every hop has one job and one caller. When a request fails you can name which hop it died at, and when you scale you can scale exactly one tier. A design where the browser talks to two of these tiers directly loses both properties at once.
Putting the database in a public subnet "so it can be reached from a laptop"
Wrong
Better
What you see: The database is reachable from anywhere on the internet, and the first sign of it is credential-stuffing traffic in the engine logs.
Why: A subnet is public when its route table has a path to an internet gateway — that route, not the resource, is the decision. Once the data tier has one, every other control is the only thing left standing between the internet and your data.
- A five-band diagram, read top to bottom, with an arrow between each band.
- Band 1, Client: users on the internet.
- Band 2, Edge (global): Route 53 resolves the domain, CloudFront and AWS WAF terminate TLS and filter requests, and S3 holds static assets served through CloudFront.
- Band 3, Public subnets across two Availability Zones: the Application Load Balancer, and a NAT gateway for outbound-only traffic from private subnets.
- Band 4, Private application subnets across two Availability Zones: ECS tasks or EC2 instances in an Auto Scaling group, one set per zone.
- Band 5, Private data subnets across two Availability Zones: RDS with a Multi-AZ standby, and ElastiCache.
- Footnote: only band 3 has a route to an internet gateway, and each tier accepts traffic only from the tier directly above it.
Each tier: what it owns, where it lives, what reaches it
Together
Remember: Route 53 and CloudFront at the edge, ALB in public subnets, application in private subnets, data in private subnets with no default route — traffic only ever moves downward, security groups reference the group above rather than a CIDR, and the application tier holds no state.
See also: public to private design · multi az subnet architecture · serverless api · mapping a backend to aws

