Change your database RDS instance security group to allow your machine to access it.
Add your IP to the security group to access the instance via Postgres.
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 PostgreSQL password.
a dump file(.sql) will be created
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>
the database is restored
#####ref
http://stackoverflow.com/questions/31881786/how-to-pg-dump-an-rds-postgres-database
http://www.thegeekstuff.com/2009/01/how-to-backup-and-restore-postgres-database-using-pg_dump-and-psql/
'backend > sql (postgres)' 카테고리의 다른 글
RDS에서 로컬로 postgres pg_dump해서 데이터 가져오기 (0) | 2018.03.16 |
---|---|
MySQL: install mysql in mac (0) | 2018.02.25 |
sql basic (codecademy 정리) (0) | 2017.12.08 |
Mac (OS X)에 postgres 설치하기 (sierra 10.12.6) (0) | 2017.11.28 |
ubuntu postgres systemctl restart 명령어 (0) | 2017.11.22 |