Security

Security Group

A stateful allow-only firewall around EC2 instances.

How it works

A security group is a stateful virtual firewall controlling inbound and outbound traffic at the network interface of resources such as EC2 instances. Allow rules can specify protocols, ports, and sources or destinations, such as IP ranges or another security group. A new security group has no inbound allow rules; return traffic for an allowed connection is generally permitted automatically.

When to use it

Control inbound and outbound ports and sources for instances.

Real-world example

An administrator attaches a security group to a public web server. Inbound rules allow HTTP on port 80 and HTTPS on port 443 from the internet, while SSH on port 22 is allowed only from the office IP address.

Key facts

  • Inbound blocked by default; outbound authorised by default.
  • Scoped to a Region / VPC combination and can be attached to many instances.
  • Rules can reference an IP range or another security group.

Common pitfall

Security groups support allow rules, not a separate deny rule for an IP address. If another rule still allows traffic from that IP, change the rule or use another appropriate control layer.

Often confused with

IAM, which controls API permissions rather than network traffic.

References

Prepared by Cloud Quest. Check current behavior and limits in the AWS documentation:

SAA-C03 study guide and learning resources

Keywords you will see in SAA-C03 questions

  • timeout
  • inbound rule
  • reference security group

Understand it for real with 3D models and simulated labs

Connect the concept to a working architecture.

Start learning