Last active
June 21, 2017 14:49
-
-
Save wliao008/5a36a45caf8c7741a587413632816c81 to your computer and use it in GitHub Desktop.
Quick (kinda) way to find unused aws launch configurations
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
1. Get the list of all launch configurations | |
aws autoscaling describe-launch-configurations | |
--region us-east-1 | |
--output text | |
--query 'LaunchConfigurations[*].LaunchConfigurationName' > launch_configs.txt | |
2. Get the list of in-use launch configurations from auto scaling groups, these are the configurations that are in use. | |
aws autoscaling describe-auto-scaling-groups | |
--region us-east-1 | |
--output text | |
--query 'AutoScalingGroups[*].LaunchConfigurationName' > asg_launch_configs.txt | |
3. Turn tabs char into newline so they can be sorted | |
cat launch_configs.txt | tr "\t" "\n" | sort > launch_configs_sorted.txt | |
cat asg_launch_configs.txt | tr "\t" "\n" | sort > asg_launch_configs_sorted.txt | |
4. Diff the 2 files, in a tool such as https://www.diffchecker.com/diff, now you should see list of configurations highlighted that are not in use. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment