Get a list of stale AWS security groups

aws ec2 describe-vpcs --query 'Vpcs[*].VpcId' --output text |xargs -t -n1 aws ec2 describe-stale-security-groups --vpc-id
AWS provides a method to audit for obsolete AWS security groups. From their documentation: "Describes the stale security group rules for security groups in a specified VPC. Rules are stale when they reference a deleted security group in a peer VPC, or a security group in a peer VPC for which the VPC peering connection has been deleted."
Sample Output
aws ec2 describe-stale-security-groups --vpc-id vpc-cafebabe
    "StaleSecurityGroupSet": []
aws ec2 describe-stale-security-groups --vpc-id vpc-babebabe123414
    "StaleSecurityGroupSet": []
aws ec2 describe-stale-security-groups --vpc-id vpc-095ce7acd7e772170
    "StaleSecurityGroupSet": []
aws ec2 describe-stale-security-groups --vpc-id vpc-face1358
    "StaleSecurityGroupSet": []

By: vocatan
2019-09-09 18:54:08

What Others Think

What is this? Please help me to know what really it. I have seen many articles like this and always confused me a lot with the piece of codes that you have shared here. Hope you will upadte the post soon. BIM Model Coordination
zaiyamariya · 54 weeks and 1 day ago
learned alot here but are there any other alternatives welding san antonio?
looneyhans · 53 weeks and 4 days ago
People who want to learn the skills of devops should not hesitate and consider learning via this website. As this saas architecture helps in doing that and they are very reliable as well. I hope people will appreciate my recommendation.
Aaron12 · 51 weeks and 3 days ago
financial advisor tacoma How can I get more infos about that products
yeoyeo · 47 weeks and 2 days ago
thank you for this! really appreciate you doing this jet
sammm · 44 weeks and 1 day ago
Secured. awesome metal sheds lubbock
geebranz · 29 weeks and 2 days ago
Thanks a lot for giving a clear idea about aws and the information or the description you have provided here along with the code with the sample output really help to understand it perfectly so keep on sharing more such informative post cbd oil for pain
Kaitlyn · 27 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: