Deleting AWS security group error (has a dependant job)

When you start to mess about and experiment with AWS you will end up with lot of erroneous entries. One of these entries can be around the security groups, this is particularly the   case when creating RDS instances in a VPC as it does create security groups to match.

When you delete the RDS instance it does leave the security groups behind, you should clean these up to keep everything tidy.

You may get this dreaded error then

resource sg-fb9b8997 has a dependent object

Obviously your sg-xxxxxx will be different, I can guarantee you will hunt through your other security groups to see if the dependent object exists, but the chances are it won’t. You will the curse and swear, and then use your friend Google to find the answer, hopefully this is how you found me!!!! 🙂


The answer you will find is the security group is attached to the EC2 Network Interfaces, not sure how, why they get attached but they do, so navigate to the EC2 console and click Network Interfaces at the bottom.




You will be be presented with the Network Interface screen




Pick the network interface that you want to change, click more and then security groups, you can then pick the groups to dissociate with interface.



Once you have done this, you will be able delete the security groups. Unless there is another hidden area. Comments on this one please


Good hunting!!!!!!



, ,

  1. #1 by Meh on July 19, 2016 - 10:40 pm

    Bravo sir! Described and solved perfectly!

  2. #2 by Chad Pavliska on May 18, 2016 - 1:57 pm

    Somehow I got as far as you did and found the Network Interface. However, in my situation it says that I don’t have permission to modify the Network Interface presumably because it was created by Elastic Beanstalk. I’m logged in with the master account.

  3. #3 by sheldonhSheldon Hearn on June 29, 2015 - 2:43 pm

    Thank you so much!

  4. #4 by David Fevre on July 10, 2014 - 5:27 am

    Thanks Shawn Hank. That’s what it was for me.

  5. #5 by Shailesh on June 27, 2014 - 12:39 pm

    Thanks!! It will save my huge time.

  6. #6 by Arif on April 24, 2014 - 9:44 am

    This is really helpful for me. I was expending a lot of time to find the dependent objects of security group. It will save my huge time. Thanks man!!!!

  7. #7 by Joe on April 22, 2014 - 7:36 pm

    thanks man… I wasted a lot of time tearing my hair out – after I had removed all the interdependencies I could find – before I came across this. Thanks so much for taking the time to document it.
    I am using Cloud Formation and the issue is that it takes ages to fail. So i installed the was cli and at least that is quicker…
    aws ec2 delete-security-group –group-id sg-

  8. #8 by Tom Howard (@tomhoward87) on February 4, 2014 - 12:59 pm

    Ha, precisely the same for me, right down to the cursing and swearing.

  9. #9 by Big Dog on January 24, 2014 - 7:12 am

    If like me you have 100+ security groups and you can’t find the security group your security group is mentioned in/depends on you can run #aws ec2 describe-security-groups | grep . This will let you know if it is really another dependency.

  10. #10 by Justin Donnell on January 2, 2014 - 7:51 pm

    “You will the curse and swear, and then use your friend Google to find the answer…”

    Yup, it happended exactly as you predicted. Thanks! Your site has earned itself a bookmark.

  11. #11 by Shawn Hank on September 14, 2013 - 9:58 pm

    The other thing it could be is that you have inter-dependent security group rules. If Security Group B is the one you want to delete and it is part of the inbound rule set for Security Group A, you will not be allowed to delete Security Group B until you remove it from the Security Group A rule set.

  12. #12 by SJ on June 28, 2013 - 10:21 am

    Thanks!! Exactly what it was.

  1. The Dreaded 'Resource Has A Dependent Object' Error | David's Unix Tips and Tricks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Open Source Made Easy

Unanswered Questions Answered

Helping you achieve more

The Survival Guides's Blog

How to Survive IT and Holidays is the best place for your personal blog or business site.

%d bloggers like this: