Explain VPC vs Subnet vs Security Group.

In AWS, a VPC (Virtual Private Cloud) is your isolated network, a subnet is a partition of that network within an Availability Zone, and a security group is a virtual firewall that controls inbound and outbound traffic.

When to Use

  • VPC: Create isolated environments (e.g., dev, staging, production).
  • Subnets: Separate application tiers (public web, private app, database).
  • Security Groups: Define traffic rules (e.g., allow HTTPS, block SSH).

Example

For a web app:

  • VPC: 10.0.0.0/16
  • Public Subnet: ALB (load balancer)
  • Private Subnets: EC2 + RDS
  • Security Group: Allow ALB → EC2 (443), EC2 → RDS (3306)

Want to master these concepts for interviews?

Explore:

Why Is It Important

Clear separation improves security, scalability, and cost control. These are core questions in system design and cloud interviews.

Interview Tips

  • Define VPC → Subnet → SG in order.
  • Mention stateful SGs vs stateless NACLs.
  • Walk through an end-to-end request path.

Trade-offs

  • More subnets and SGs = granular control but harder management.
  • Simpler setups = easier but risk exposure or IP exhaustion.

Pitfalls

  • Allowing 0.0.0.0/0 for SSH/RDP.
  • Leaving egress wide open.
  • Forgetting route tables/NAT for private subnets.
TAGS
System Design Interview
System Design Fundamentals
CONTRIBUTOR
Design Gurus Team
-

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Image
One-Stop Portal For Tech Interviews.
Copyright © 2025 Design Gurus, LLC. All rights reserved.