Security groups work like a firewall and manage inbound and outbound traffic based on configured rules at the instance level.
We can assign different security groups to different instances based on our needs. A default security group, that is, the default VPC security group that is available in both EC2 dashboard and VPC dashboard. Let's click on Create Security Group:
- Provide a Security group name and select VPC. Then, click on Create:
- Add an Inbound or Outbound rule based on your requirements and click on Create:
- Verify the security group in the dashboard:
A security group is applicable at an instance level. Up to five security groups can be assigned to an instance. You can create 500 security groups per VPC (per region), 50 inbound or outbound rules per security group, and 5 security groups per network interface.
...