Created
June 20, 2024 16:58
-
-
Save imbgar/d1148a5108370e136f4802ed0023ba40 to your computer and use it in GitHub Desktop.
diff rds parameter groups
This file contains hidden or 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 | |
# Check if both parameter group names are provided | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 <parameter-group-name-1> <parameter-group-name-2>" | |
exit 1 | |
fi | |
# Fetch parameters for both groups | |
params1=$(aws rds describe-db-parameters --db-parameter-group-name "$1" --query "Parameters[].[ParameterName,ParameterValue]" --output json) | |
params2=$(aws rds describe-db-parameters --db-parameter-group-name "$2" --query "Parameters[].[ParameterName,ParameterValue]" --output json) | |
# Use jq to sort them by ParameterName | |
echo "$params1" | jq -S '.' > temp1.json | |
echo "$params2" | jq -S '.' > temp2.json | |
# Use diff to compare the sorted parameters | |
diff temp1.json temp2.json | |
# Clean up temporary files | |
rm temp1.json temp2.json | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment