We use pg_dump
and pg_restore
to make backups of a database and mirror it to our staging and testing environments and this has worked well with RDS in AWS, but we have started working with Aurora and this process often fails with large databases because the scaling events close the connection and cause other problems.
Is there a recommended/better way to handle this in Aurora?
(Supposing your both environment are Aurora)
Rather than implementing own back up mechanism, I would consider a slightly different approach. There is already AWS implementation of snapshot or back up [1] out of the box for Aurora. For example, you can take a snapshot of the cluster, share / copy the snapshot to your staging environment, do the restore.
[1] https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/BackupRestoreAurora.html