skip to Main Content

An EFS file system was temporarily setup for use with two EC2 instances in different availability zones. Security groups were automatically created for each subnet within the region to which the EFS was launched. This region has three availability zones so three subnets and thus three security groups. Looking at the security groups description details the SGs’ creation:

Security Group Description

The EFS and the EC2s to which the EFS was attached have now all been terminated/deleted. However when attempting to delete the security groups I get the following notification for each:

Security Groups - Info on attempt to delete

Clicking on the link "1 security group associated" for details the of why security group sg-053f4a90837fda586 cannot be deleted shows that the associated security group is sg-0f481995d4e99ac12. Upon attempting to delete sg-0f481995d4e99ac12, the same information says that it cannot be deleted as it is associated with sg-053f4a90837fda586. So sg-053f4a90837fda586 cannot be deleted because sg-0f481995d4e99ac12 exists and vice-versa.

Attempting to delete both at the same time gives the same issue:

Attempt Simultaneous Deletion

What is the error in my approach?

2

Answers


  1. As far as I can see, you might be using default SG, which is unable to be deleted, as mentioned here:
    Troubleshoot delete SG

    All VPCs have a default security group. If you don’t specify a different security group when you launch the instance, a default security group is automatically associated with your instance. You can’t delete a default security group. But, you can change the default security group’s rules.

    Login or Signup to reply.
  2. This error can happen when the security group you are trying to delete is referenced in a rule of another security group.

    To fix this, in each security group remove the rule that is referencing the other group.
    Then, delete the security groups themselves.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search