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.
Advertisement
Answer
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