What You'll Learn
You'll learn how to use cloud security groups to create stateful, instance-level network boundaries that control exactly which traffic can reach your resources.
What Security Groups Do
Security groups act as virtual firewalls at the instance level, controlling inbound and outbound traffic for your cloud compute resources (VMs, containers, databases). Unlike network-level controls that apply broadly, security groups attach directly to individual resources, enabling fine-grained segmentation.
Think of them as bouncers at each door of your building, rather than a single gate at the entrance—each resource gets its own access rules.
Stateful Traffic Control
Security groups are stateful, meaning they automatically track connections. If you allow inbound traffic on port 443, the return traffic is automatically permitted without needing a separate outbound rule. This simplifies rule management compared to traditional firewalls.
How to Segment with Security Groups
By tier: Create separate security groups for web, application, and database layers. Your web group allows inbound 443 from the internet but can only talk to the app tier. Your app tier can't accept internet traffic but can query the database tier.
By function: Different groups for different services—one for SSH bastion hosts, another for internal APIs, another for batch processing jobs.
Deny by default: Security groups start with implicit deny; you only add allow rules. This aligns with Zero Trust principles (building on what you learned about identity as the perimeter).
Rule Examples
- Web tier: Allow inbound 443 from
0.0.0.0/0, allow outbound to app-tier-security-group - App tier: Allow inbound from web-tier-security-group, allow outbound to db-tier-security-group
- Database tier: Allow inbound 5432 from app-tier-security-group only
Key Takeaway: Security groups provide instance-level, stateful segmentation by acting as virtual firewalls that enforce least-privilege access between resources, creating isolation boundaries that support micro-segmentation and Zero Trust architectures.