Skip to content

Instantly share code, notes, and snippets.

@joerx
Created June 20, 2018 02:37
Show Gist options
  • Save joerx/938f103c23704a5d18afd3bf5b4a47ef to your computer and use it in GitHub Desktop.
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
#!/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