This is an English translation of a Japanese blog. Some content may not be fully translated.
AWS

Outputting aws rds describe-db-snapshots Results as CSV

The jq command syntax is something I always have to look up.

Command

aws rds describe-db-snapshots --db-snapshot-identifier rdspostgresqldb-snapshot-test20191130-1 \
--query "DBSnapshots[].{DBInstanceIdentifier:DBInstanceIdentifier,DBSnapshotIdentifier:DBSnapshotIdentifier,SnapshotCreateTime:SnapshotCreateTime}" \
--output json | \
jq -r ".[] | [.DBInstanceIdentifier,.DBSnapshotIdentifier,.SnapshotCreateTime] | @csv"

Result

"rdspostgresqldb","rdspostgresqldb-snapshot-test20191130-1","2019-11-30T06:47:14.370Z"
Suggest an edit on GitHub