"One server can run the whole app." It can, until it can't. On a single server, the web pages, the business logic and the database fight for the same CPU and memory. One busy page slows the database, one bad deploy breaks everything, and one crash takes the whole app down. The classic fix is the three-tier architecture: split the app into three layers, each with one job.
The three tiers
- Web (presentation) tier: faces users. On AWS that is usually an Application Load Balancer in public subnets, or CloudFront serving the front end.
- Application (logic) tier: runs the business rules. It can be EC2 instances in an Auto Scaling group, containers on ECS or EKS, or Lambda functions. It sits in private subnets, so nothing on the internet can reach it directly.
- Data tier: stores state, for example Amazon RDS or Aurora, also in private subnets. With Multi-AZ, RDS keeps a standby in a second Availability Zone and fails over to it.
Each tier only talks to its neighbour. Users reach the web tier, the web tier calls the app tier, and only the app tier reaches the database.
Chaining tiers with security groups
The neat trick on AWS is that a security group rule can reference another security group instead of an IP range:
- The load balancer's group allows HTTPS from the internet.
- The app tier's group allows traffic only from the load balancer's group.
- The database's group allows its port only from the app tier's group.
New instances pick up the right access automatically, because membership, not IP addresses, decides who can talk. A common mistake is opening the database to the whole VPC CIDR "just for now"; that quietly removes the third layer of defence.
Why it's worth it
- Independent scaling. A traffic spike adds web or app capacity without touching the database. See Auto Scaling groups.
- Smaller blast radius. A crash in one app instance doesn't take the data with it.
- Clear ownership. Front-end, back-end and database changes ship separately.
Three tiers is not the only shape. Serverless and microservice designs keep the same idea of separated responsibilities with different building blocks. But for a classic web app, it remains a solid default.
Where AI fits
When you add a generative AI feature, the model call belongs in the application tier, next to your business rules. The app tier calls Amazon Bedrock, ideally through a VPC interface endpoint (AWS PrivateLink) so the traffic stays off the internet, and it checks permissions, adds context and logs usage. The data tier gains a vector store for retrieval, for example S3 Vectors or a PostgreSQL database with pgvector. The browser never calls the model directly and never holds credentials for it.
Quick recap
- Three layers: web, application, data, each with one job.
- Only neighbours talk, enforced by security groups that reference each other.
- Each tier scales on its own; the AI call lives in the app tier, the vector store in the data tier.