- Security Group is the fundamental unit of network security on AWS.
- They control how traffic is allowed in/out of our EC2 machines.
- They act as firewall and regulate access to ports, authorized IP ranges, control of inbound/outbound network.
- SG:EC2 = Many:Many
- SG is locked down to a region/VPC combination.
- It's good to maintain one SG for SSH.
- By default, all inbound traffic is blocked and all outbound traffic is allowed.
- AWS allows pen-testing of SOME services without prior-approval.
- You can specify allow rules, but not deny rules.
- You can specify separate rules for inbound and outbound traffic.
- Security groups are stateful — if you send a request from your instance, the response traffic for that request is allowed to flow in regardless of inbound security group rules. Responses to allowed inbound traffic are allowed to flow out, regardless of outbound rules.
- When you create a new security group, it has no inbound rules. Therefore, no inbound traffic originating from another host to your instance is allowed until you add inbound rules to the security group. However, the EC2 launch wizard would pre-populate SSH rule to be added in the UI.
- By default, a security group includes an outbound rule that allows all outbound traffic.
- Security groups are associated with network interfaces. After you launch an instance, you can change the security groups that are associated with the instance, which changes the security groups associated with the primary network interface (eth0).
- A security group can only be used in the VPC that you specify when you create the security group.