Skip to content

Instantly share code, notes, and snippets.

asinghal /
Last active Oct 28, 2019
Clean up AWS Security groups

Commands to get security groups in use and echo names of groups that can not be found in use

Note: Always check manually before deleting security groups. There are various places the groups may be used, and the scripts output may not always be conclusive

aws elb describe-load-balancers --query 'LoadBalancerDescriptions[*].SecurityGroups' --output text | tr '\t' '\n' | sort | uniq > used.txt

aws ec2 describe-instances --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId' --output text | tr '\t' '\n' | sort | uniq >> used.txt
asinghal / affirmation
Created Feb 8, 2016
MuleSoft Contributor Agreement Acceptance by Aishwarya Singhal
View affirmation
I, Aishwarya Singhal, have read and do accept the MuleSoft Contributor Agreement
Accepted on Mon Feb 08 2016 16:58:07 GMT+0100 (CET)
asinghal / gist:1a609110c67a2eba7bb4
Created Aug 7, 2014
Clean up/ prune old Git branches
View gist:1a609110c67a2eba7bb4
git remote prune origin
git checkout master && git branch --merged | grep -v master | sed -e 's/origin\///' | xargs git branch -d