Security Group
Security Group in Amazon VPC
ℹ️ Definition and Characteristics
- A Security Group acts as a virtual firewall at the instance level
- It only supports Allow rules
- Separate rules can be configured for inbound and outbound traffic
- It is a stateful service — if inbound traffic is allowed, the corresponding outbound traffic is automatically allowed too
⚠️ Default Configuration
- A newly created Security Group has no inbound rules by default
- By default, it has an outbound rule that allows all traffic
- Initially, an instance blocks all inbound traffic until you configure rules for it
🔒 Connection Management
- Instances can only communicate when associated with an appropriate Security Group
- The Security Group assigned to an instance can be changed after the instance is created
- It is associated with the instance’s network interface
- Supports connectivity across VPCs via VPC Peering
Security Group Rules
ℹ️ Rule Structure
- Inbound rules:
- Specify the traffic source (a CIDR or another Security Group)
- Specify the destination port or port range
- Outbound rules:
- Specify the destination (a CIDR, Security Group, or Prefix List)
- Specify the destination port or port range
💡 Pro Tips
- Use standard protocol ports (SSH: 22, HTTP: 80, HTTPS: 443)
- Take advantage of Security Group references for more flexible rule management
- Apply the principle of least privilege when configuring rules
⚠️ Limits and Notes
- Up to 5 Security Groups per network interface
- Deny rules cannot be configured
- Remove the default outbound rule if you need tighter control over outbound traffic