Forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
Created
December 24, 2020 09:47
-
-
Save it-one-mm/1c2dedb89aa3e15ba0746ca0f0bc8b3c to your computer and use it in GitHub Desktop.
How to copy production database on AWS RDS(postgresql) to local development database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) Change your database RDS instance security group to allow your machine to access it. | |
| Add your ip to the security group to acces the instance via Postgres. | |
| 2) Make a copy of the database using pg_dump | |
| $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database> | |
| you will be asked for postgressql password. | |
| a dump file(.sql) will be created | |
| 3) restore that dump file to your local database. | |
| but you might need to drop the database and create it first | |
| $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment