Course contentsShow
← Cloud and Infrastructure
Lesson 202 of 2,9894. Cloud Networking BasicsFree lesson

Security Group Fundamentals

Learn how security groups act as virtual firewalls controlling inbound and outbound traffic at the instance level.

Security Group Fundamentals

What you'll learn: How security groups act as virtual firewalls controlling inbound and outbound traffic at the instance level.

What Is a Security Group?

A security group is a virtual firewall that protects individual cloud instances (virtual machines) by controlling which network traffic is allowed to reach them and which traffic they can send out. Think of it like a bouncer at a club door—the security group checks every incoming and outgoing connection request and only allows the ones that match specific rules you've defined.

Instance-Level Protection

Unlike network-level controls (which we'll cover later), security groups operate at the instance level. Each VM you launch can be assigned one or more security groups. The rules you configure determine:

  • Inbound traffic: What can connect to your instance (e.g., web requests on port 80, SSH on port 22)
  • Outbound traffic: What your instance can connect to (e.g., database servers, internet services)

How Security Groups Work

Security groups are stateful, meaning if you allow an inbound connection, the return traffic is automatically allowed—you don't need separate outbound rules for responses.

By default, security groups typically:

  • Deny all inbound traffic (you must explicitly allow what you need)
  • Allow all outbound traffic (your instance can reach anywhere unless restricted)

Rules specify protocols (TCP, UDP, ICMP), port ranges, and source/destination IP addresses or other security groups.

Example Scenario

If you're running a web server, your security group might allow inbound HTTP (port 80) and HTTPS (port 443) from anywhere (0.0.0.0/0), but only allow SSH (port 22) from your office IP address.

Key Takeaway: Security groups are virtual firewalls attached to instances that control traffic using allow rules, providing essential instance-level network security in cloud environments.