"Public or private is a setting on the subnet." It isn't. There's no switch in AWS that labels a subnet public. The difference is one route in the subnet's route table. That's worth understanding properly, because a database placed in the wrong subnet can end up exposed to the internet without anyone deciding it should be.
What makes a subnet public
AWS defines it precisely:
- A public subnet is associated with a route table that has a route to an internet gateway.
- A private subnet is associated with a route table that has no route to an internet gateway.
That's all. The name you give the subnet ("public-a", "private-b") is only a label for humans. If someone adds an internet gateway route to the table a "private" subnet uses, it's now public, whatever it's called.
What it takes to be reachable
A route alone doesn't put a server on the internet. For a resource in a VPC to be reachable from outside over IPv4, all of these must be true:
- Its subnet's route table has a route to an internet gateway.
- The resource has a public IPv4 address (or an Elastic IP).
- Its security group and network ACL allow the traffic.
Public subnets should hold very little: typically load balancers, NAT gateways and perhaps a bastion host. Everything that only needs to be reached through the load balancer stays out.
One setting to check: subnets have an option to auto-assign public IPv4 addresses to instances launched in them. It's on for the default subnets of a default VPC, which is why a test server launched with default settings is reachable from the internet if its security group allows it.
What goes in private subnets
Everything else: application servers, databases, caches, internal services. Nothing on the internet can start a connection to them, because there's no route for that traffic to come in.
Private doesn't mean cut off. Private resources often need to reach out, for software updates or third-party APIs. Their route table sends internet-bound traffic to a NAT gateway, which lets connections go out and replies come back, but never accepts a connection that starts outside. For reaching AWS services such as S3, VPC endpoints give private subnets a path that doesn't use the internet at all.
The classic layout
In each Availability Zone you use:
- one public subnet with the load balancer in front
- one or more private subnets behind it for the application and the data
Many teams add a third tier: private subnets for databases with no route out at all. The common mistake is the opposite: putting everything in public subnets "to make it work" and relying on security groups alone. One overly broad rule is then all that stands between your data and the internet.
Where AI fits
AI workloads follow the same rule, and they raise the stakes, because they sit next to your most valuable data.
- Model servers you run yourself (on EC2, ECS or EKS) and vector databases (for example Amazon OpenSearch Service, or Aurora PostgreSQL with pgvector) hold prompts, documents and embeddings. They belong in private subnets.
- To call Amazon Bedrock from those subnets, create an interface VPC endpoint (AWS PrivateLink). AWS documents that this lets you reach Bedrock without an internet gateway or NAT device, and without public IP addresses.
Only the user-facing entry point, usually a load balancer or an API, needs a public subnet.
Quick recap
- Public = the subnet's route table has a route to an internet gateway. Private = it doesn't.
- Public subnets hold load balancers and little else; servers and databases stay private.
- Keep model servers and vector databases private, and reach Bedrock through a VPC endpoint.