Why should databases never sit in public subnets?
BeginnerProductionVPC & Network Architecture
Answer
A database exposed to the internet is only one weak password or unpatched CVE away from a breach. Put it in private subnets with no IGW route, restrict its security group to the app tier, and require TLS.
For admin access use SSM port forwarding, a VPN or an ephemeral bastion rather than opening the DB port.
More on VPC & Network Architecture
How would you design a production VPC for a three-tier web application?IntermediateHow many AZs and subnets should a production VPC use, and why?BeginnerWhat makes a subnet public versus private?BeginnerHow do you avoid NAT gateway single points of failure and cross-AZ charges?IntermediateWhen should you use VPC endpoints?IntermediateHow do you design connectivity for 50+ VPCs across accounts and regions?Advanced