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": []
}

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

What Others Think

Selling Business Outcomes Specialists. An IP address is utilized to be the character of an individual and every individual ought to have its IP address so if there is any sort of an individual around you who may have a risk for you so Cisco 820-424 Exam Questions there the specialists may safe you or ensure that you are not an inappropriate one.
calapamrk · 3 days 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: