Created
November 9, 2023 23:58
-
-
Save lebeerman/c224eb2d50dc4e98d428251c1ebf0730 to your computer and use it in GitHub Desktop.
Simple script to get unused database parameter groups
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
#!/bin/bash | |
# NOTE you'll want to prefix this with any account assumption/shell prefix/saml/etc or redirect as needed :) | |
# TODO Cluster groups? | |
# Get all parameter groups | |
all_groups=$(aws rds describe-db-parameter-groups --query 'DBParameterGroups[].DBParameterGroupName' --output text) | |
# Get parameter groups used by DB instances | |
used_groups=$(aws rds describe-db-instances --query 'DBInstances[].DBParameterGroups[].DBParameterGroupName' --output text) | |
# Compare the lists to find unused groups | |
for group in $all_groups; do | |
if [[ $used_groups != *$group* ]]; then | |
echo "Unused parameter group: $group" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment