Getting Startedbasic5 minute guide

Public and Private Subnets in an AWS VPC

This VPC pattern makes exposure decisions explicit. The load balancer and NAT gateway live in the public path, application compute accepts traffic only from the load balancer, and the database has no direct route from the internet.

Open editable diagram

Published August 18, 2026

Reference architecture

Architecture diagram

Edit this exact diagram
AWS public and private subnet architecture diagram with an internet-facing load balancer, NAT Gateway, private application server, and private RDS databaseOpen on the canvas

AWS public and private subnet architecture diagram with an internet-facing load balancer, NAT Gateway, private application server, and private RDS database. The image links to a fully editable BuildPlane starter.

Overview

A compact VPC example that makes subnet responsibilities visible. Public subnets contain resources that must reach the internet directly, while application compute and relational data remain private.

Components

  • Public Load Balancer: Receives internet traffic and forwards only approved application requests into the private tier.
  • NAT Gateway: Lets private compute initiate outbound connections without accepting inbound internet sessions.
  • Application Server: Runs application code in a private subnet and receives traffic only from the load balancer.
  • RDS Database: Keeps relational data in a separate private subnet with no direct public path.

Network Flow

  1. Internet users connect to the public load balancer.
  2. The load balancer routes application traffic to the private application server.
  3. The application server reads and writes data in the private RDS database.
  4. When outbound access is needed, the application server routes through the NAT gateway.

Customize First

  • Add matching subnets in a second Availability Zone for production availability.
  • Replace broad security-group rules with the smallest required source-to-destination rules.
  • Add VPC endpoints for AWS services that should not require NAT egress.

Design rationale

Decisions that shape this architecture

1

Public does not mean every resource is internet-accessible

A public subnet has a route to an internet gateway. Security groups, listener configuration, and public addressing still determine whether a resource can receive traffic.

2

Use the load balancer as the ingress boundary

The application server remains private and accepts only traffic from the load balancer security group. This removes direct public addressing from the compute tier.

3

Separate outbound access from inbound access

The NAT gateway lets private compute initiate internet connections without creating an inbound route to the application server.

Before production

Operational checks

Verify route tables independently for each public and private subnet.

Restrict security-group references to the next required tier.

Review NAT data-processing cost and use VPC endpoints where appropriate.

Add equivalent subnets in another Availability Zone for production availability.

Scope and tradeoffs

What this diagram does not solve

The starter shows one-AZ concepts clearly

A production web application should usually duplicate the relevant subnets and zonal compute across at least two Availability Zones.

Subnet placement is only one security layer

IAM, encryption, patching, flow logs, network controls, and application authorization remain necessary even when resources are private.

Common questions

Frequently asked questions

What makes an AWS subnet public?

A subnet is public when its route table has a route to an internet gateway. Individual resources also need suitable addressing and security rules to communicate with the internet.

Why is the database in a separate private subnet?

The separation prevents a direct internet path and lets the database accept connections only from the application tier on the required port.

Can private subnets access AWS services without NAT?

Yes. VPC gateway and interface endpoints can provide private access to supported AWS services and can reduce NAT traffic and exposure.

Keep exploring

View all 17 guides
Highly available three-tier AWS architecture diagram with an Application Load Balancer, Auto Scaling web and application tiers, and Amazon RDS Multi-AZ
Getting Startedbasic

Highly Available Three-Tier Web Application on AWS

This starter architecture separates ingress, presentation, application logic, and relational data so each tier can fail and scale independently. It is a practical baseline for teams moving a conventional web application onto AWS without collapsing every responsibility into one server.

Explore the architecture

From reference to working draft

Adapt this architecture with your AWS AI Agent

Start from the exact diagram in this guide. Change requirements, challenge a decision, or ask what fails first, while keeping the architecture editable.

Open editable diagram