Bash script for using awscli rds-data cli for querying RDS db and outputting to CSV with jq
DB_NAME=my-db \
SQL_FILE=./my-query.sql \
RDS_CLUSTER_ARN=arn:aws:rds:<region>:<account_id>:cluster:<cluster_id> \
DB_CREDENTIALS_SECRET_ARN=arn:aws:secretsmanager:<region>:<account_id>:secret:<cluster_credentials_secret_id> \
bash execute-rds-sql.sh
# outputs to eg. my-query-2000-01-01-00:00:00.csv- awscli
- jq