The security groups are actually associated with the network interfaces. So, when you change the security group of an instance, it changes the security groups that are connected to the primary network interface. Each security group contains a set of rules that are applied to all of the associated EC2 instances. These rules manage the inbound and outbound traffic. The default security group allows all outbound traffic. When creating a rule, you will have to specify details such as a name, the protocol to allow, the port range to be allowed and much more.

Creating a Security Group

Viewing your Security Groups

Editing Rules of a Security Group

The EC2 console offers you complete control over your security groups. If you wish to add new rules or delete any of the existing rules, you can do so very easily. You are able to edit both the inbound rules of the security as well as the outbound rules. When you add new rules to a security group, they are automatically applied to the instances that are associated with that security group so you don’t have to worry about anything. However, there is a short delay before the rules are applied so don’t expect it to be instant. To edit the rules of a security group, follow the instructions provided below:

Deleting a Security Group

As it turns out, you can also choose to completely remove a security group instead of removing specific rules from it. However, there are some things that you have to keep in mind before you proceed with deleting a security group. First of all, you can’t delete a security group that is associated with an instance. If you wish to do so, you will have to provide a different security group for the associated instances so that the one you are about to delete isn’t belonging to any EC2 instances. Furthermore, you cannot delete the default security group that exists. Finally, if a security group is referenced by a rule in a different security group in the same VPC, you cannot delete unless you delete the referencing rule first. These are some of the things that you have to keep in mind before you continue with the instructions provided below since the security group won’t be removed if any of the above mentioned cases is applicable to you. To delete the security group, follow the instructions provided:

How to Manage Security Groups of Amazon EC2 Instances  - 20How to Manage Security Groups of Amazon EC2 Instances  - 83How to Manage Security Groups of Amazon EC2 Instances  - 60How to Manage Security Groups of Amazon EC2 Instances  - 68How to Manage Security Groups of Amazon EC2 Instances  - 40