Local Backup from Amazon RDS PostgreSQL database

Posted on

Question :

I have a PostgreSQL database on an Amazon RDS instance.

I want to have a local dump of this instance.

So far, I’ve tried with this:

PGPASSWORD="Password" pg_dump -h mydb.xxxxxx.us-east-1.rds.amazonaws.com -p 5432

But it keeps throwing an error, saying that the server refuse the connection, and check if the server is actually running on port 5432, which is actually doing.

All my credentials and DB path/codes are correct.

Answer :

You must be running in a Security Group firewall problem.

  • Go to your RDS Dashboard, select Instances and open the instance you want to connect to.
  • Look for a line like this : Security Groups rds-launch-wizard (sg-3e9axxx) ( active ). You should be able to click on rds-launch-wizard (sg-3e9axxx) which leads you to the EC2 Dashboard in the Security Groups panel.
  • Select your security group and open the Inbound Tab in the lower panel.
  • Click on Edit and Add Rule. Don’t forget to set the Port Range to 5432 and select My IP in the source.
  • Click on Save.
  • You should be able to connect to your RDS Instance from your local IP.

Leave a Reply

Your email address will not be published. Required fields are marked *