DEV Community

Dmitry Romanoff
Dmitry Romanoff

Posted on

1

How to download AWS RDS Postgres log files?

The following bash script downloads AWS RDS Postgres log files, appending them to one single file. It uses aws-cli.

the_region="us-east-1"
the_db_instance="my-db-instance"

for filename in $( aws rds describe-db-log-files --region $the_region --db-instance-identifier $the_db_instance | jq -r '.DescribeDBLogFiles[] | .LogFileName' )
do
aws rds download-db-log-file-portion --region $the_region --db-instance-identifier $the_db_instance --output text --no-paginate --log-file $filename  >> /tmp/postgres_aws_rds_logs_$the_db_instance.log
done
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay