Your database tier must be reachable only from the app tier. How do you implement it across layers?
IntermediateScenarioSecurity: Firewalls, SGs, NACLs & VPN
Answer
Situation read → Defense in depth: routing, SG, NACL and DB auth.
What I'd do →
- Put the DB in private subnets without internet routes
- Security group allows 5432 only from the app SG
- Optional NACL allows 5432 from the app subnet CIDRs and ephemeral ports back
- Require TLS and a DB user per application
- Test from an unrelated instance, which must time out, and from the app, which must connect
Why → Each layer should block on its own so one mistake does not expose the data.
Interview tip → Say you test the negative case; people only test that the app works.
More on Security: Firewalls, SGs, NACLs & VPN
Security group versus NACL: explain the differences.BeginnerHow do you let only your office IP SSH into a server?BeginnerWhat does it mean that a security group can reference another security group?BeginnerStateful versus stateless firewalls: what is the practical difference?BeginnerWhat is a WAF and where do you place it?BeginnerWhat is the difference between a site-to-site VPN and a client VPN?Beginner