Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I know how to restore a pg dump into an RDS database if that dump is in my machine, but how could I do it when the dump is available at a remote location, say Amazon S3?

What I want to do is something like this: 

pg_restore -h somedomain.us-east-1.rds.amazonaws.com -p 5432 -d databasename -U username https://s3.amazonaws.com/database.dump 

But of course, this results in 

pg_restore: [archiver] could not open input file "https://s3.amazonaws.com/database.dump"

1 Answer

0 votes
by (44.4k points)

If a filename is not specified, pg_restore will take data from standard input (doc). So, this would work:

Pg_restore will take the data from standard input if the filename is not specified (pg_restore documentation). This might work:

wget -O - 'https://s3.amazonaws.com/database.dump' | pg_restore -h somedomain.us-east-1.rds.amazonaws.com -p 5432 -d databasename -U username

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...