Interview Prep/DevOps Fundamentals/Networking basics for DevOps

What are VPCs, subnets and security groups?

BeginnerConceptNetworking basics for DevOps
Answer

In one line: A VPC (Virtual Private Cloud) is your own private, isolated network in the cloud; subnets divide it into smaller ranges (public or private); security groups are firewalls attached to resources that control which traffic can reach them.

VPC

  • Your private network with an IP range, for example 10.0.0.0/16 (about 65,000 addresses).
  • Isolated from other customers. Called a VNet in Azure.

Subnets

  • Smaller ranges inside the VPC, each in one availability zone, for example 10.0.1.0/24.
  • Public subnet — has a route to an Internet Gateway; used for load balancers and bastion hosts.
  • Private subnet — no direct route from the internet; used for app servers, Kubernetes nodes and databases. Outbound internet access goes through a NAT Gateway.

Typical three-tier layout:

VPC 10.0.0.0/16
├── Public subnets (AZ a, b, c)  → Application Load Balancer, NAT Gateways
├── Private app subnets (a, b, c) → EC2 / EKS nodes
└── Private DB subnets (a, b, c)  → RDS

Security groups

  • Stateful firewalls attached to instances, load balancers, databases or pods.
  • Allow rules only (by port, protocol and source).
  • Stateful — if inbound traffic is allowed, the reply is automatically allowed out.
  • Can reference other security groups: "allow port 5432 from the app's security group" — better than IP ranges.

Network ACLs (NACLs) — an extra, stateless firewall at the subnet level with allow and deny rules (in Azure, NSGs cover both roles).

Example rules:

  • ALB SG: allow 443 from 0.0.0.0/0.
  • App SG: allow 8080 only from the ALB SG.
  • DB SG: allow 5432 only from the App SG.

Tip for interviews: describe the public/private subnet layout and security groups referencing each other — it shows you can design a secure network, not just define terms.

All DevOps Fundamentals questions

More on Networking basics for DevOps