Last active
March 23, 2017 08:44
-
-
Save saitara/9bf907a2e94118a773fc to your computer and use it in GitHub Desktop.
AWSで全てのリージョンから無駄リソースを抽出するワンライナー ref: http://qiita.com/saitara/items/a1e3422042a2ec2fb8d7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for region in `aws ec2 describe-regions --query 'Regions[].RegionName' --output text`;do aws ec2 describe-volumes --region ${region} --filters Name=attachment.status,Values=detached;done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for region in `aws ec2 describe-regions --query 'Regions[].RegionName' --output text`;do aws ec2 describe-addresses --region ${region} --query 'Addresses[?InstanceId==`null`]';done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for region in `aws ec2 describe-regions --query 'Regions[].RegionName' --output text`;do aws elb describe-load-balancers --query 'LoadBalancerDescriptions[?length(Instances)==`0`].LoadBalancerName' --region ${region};done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for region in `aws ec2 describe-regions --query 'Regions[].RegionName' --output text`;do aws ec2 describe-network-interfaces --filters Name=attachment.status,Values=detached --region ${region};done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment