Created
June 20, 2018 02:37
-
-
Save joerx/938f103c23704a5d18afd3bf5b4a47ef to your computer and use it in GitHub Desktop.
List RDS instances, select some fields and render as CSV with aws cli, bash and jq
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/sh | |
if [ "$INSTANCE" == "" ]; then | |
CMD="aws rds describe-db-instances" | |
else | |
CMD="aws rds describe-db-instances --db-instance-identifier=$INSTANCE" | |
fi | |
echo '"DBInstanceIdentifier","DBInstanceStatus","DBInstanceClass"' | |
$CMD | jq -rM '.DBInstances[]|[.DBInstanceIdentifier,.DBInstanceStatus,.DBInstanceClass]|@csv' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment