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
#!/usr/bin/env python | |
import boto3 | |
import sys | |
import json | |
import time | |
import argparse | |
from termcolor import cprint |
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
pg_dump -h SOURCE_HOST -p 5432 -U SOURCE_USER -Fc -b -v -f FILE -d SOURCE_DATABASE | |
dropdb -h TARGET_HOST -p 5432 --if-exists -U TARGET_USER TARGET_DATABASE | |
createdb -h TARGET_HOST -p 5432 -U TARGET_USER TARGET_DATABASE | |
PGSSLMODE=allow pg_restore -v --no-owner --role=TARGET_USER -h TARGET_HOST -U TARGET_USER -d TARGET_DATABASE FILE |