Let's quickly go through some important concepts related to security groups:
- Security groups do not span across VPCs.
- We can create security groups from the EC2 launch wizard, from the EC2 dashboard, or from the VPC dashboard.
- Security groups are stateful, unlike NACLs.
- It is good practice to have multiple security groups based on usages. For example, we can create separate security groups, one for SSH and one for application-specific ports.
- We can configure the rules for a security group to allow instances from another security group instead of providing a CIDR. We can also specify our own security group to allow only instances within the same security group to talk to each other.