Taking a remote backup of AWS RDS database
I wanted to do some experiments on my prod database which hosted on rds in aws locally.
after googling for sometime I thought of connecting my database with the help psql after I will connect I will use pg_dump but didn’t work then I thought of trying with pgadmin3. with it I was able to download a empty dump file as aws has some rds-admin because of which we cannot take dump after we connecting to database as a specific role.
Then i thought of a hack that 😜
pg_dumpdatabase_ name > dumpfile.sql
will give me the download dump of particular db. Why not without entring inside the db take the dump and the it won’t show the permission denied. then i got the following command to download dump of remote db
pg_dump -h <hostname>evo10 > dumpfile.sql
But the above didn’t work for me as by default it was taking rdsadmin as user name so with some i combined the psql login command with pg_dump command.
pg_dump -h <xxxxxxx-hostname> -U user-name -d dbname > dump.sql
Hope this helps to you all 😃 😄 😉.