Reputation: 572
I'm trying to restore my Postgres database to an RDS Postgres Instance in the AWS using pg restore from an EC2 instance. I am using the following command to restore the database:
pg_restore -v -h host --no-owner -d PostgresDB postgres.dump
Now the problem is that originally, I didn't specify the --no-owner option, and since the owner of the local database that has been backed up, and the owner of the RDS Instance aren't the same. This threw an error, which is why I read that specifying this option helps solve the issue. However, now I get a
pg_restore: [archiver (db)] connection to database "XY" failed:
FATAL: password authentication failed for user "ec2-user"
error message, although the password is right. Now I read that this does happens with Postgresql, but I can't find a way to solve this on EC2. According to this thread, I need to change the format of one of the configuration files. But this my postgres is an AWS Instance, how can I achieve this? I browsed my EC2 server instance and didn't find any pgpass.conf file (according to 'which' the file doesn't exist on the server). How can I solve this?
Upvotes: 0
Views: 478
Reputation: 201058
What username did you create for Postgres? Surely it isn't ec2-user
. You need to be specifying the username and password with the --username
and --password
options. Here is the documentation.
Upvotes: 1