-1

I have PostgreSQL dump file in my local environment, and I want to restore it on AWS server where Django app was deployed.

I think I should upload the dump file to AWS server but I don't know where it should be uploaded to and how to restore it.

2 Answers 2

0

First, copy your file from your local environment to AWS using scp command

e.g

scp -i /directory/to/abc.pem mydump.sql user@ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:/tmp/

where abc.pem is your private aws key. mydump.sql is your dump file and /tmp/ is the path where the dump file will be copied

Once the file is copied to your AWS /tmp folder or whatever location you use, Next you need to restore it to your database e.g using

./pg_restore -U postgres -p 5432 -d yourdatabase < mydump.sql
0

Use pgrestore to restore your database.

Link : https://www.postgresql.org/docs/9.2/app-pgrestore.html

Inorder to get a dump of your database use pgdump.

Link : https://www.postgresql.org/docs/9.6/app-pgdump.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.