PostgreSQL DB backup to target outside AWS

0

We are considering a move of our corporate data to AWS (that will then reside in a PostgreSQL DB), however we would like to maintain a backup of the data to one of our own servers residing outside the AWS cloud (in our own data center). Is this possible?

Dave
asked 2 years ago270 views
2 Answers
0

I've done a bit more research. Seems this would be possible with a VPC. If we wanted to break out of the VPC and run completely independent of AWS, how hard would that be?

Dave
answered 2 years ago
0

Hi there! So here I have provided 2 ways to implement this backup:

  1. If you want your backup to be totally independent of AWS services, then go on.

    A great technique to backup a PostgreSQL database that is not dependent on other AWS services is with pg_dump. The following steps shows how to use pg_dump for backups:

    1. Install PostgreSQL Tools: Ensure that your on-premises server has the PostgreSQL client tools, including pg_dump.
    2. Schedule Backups: On your on-premises server, set up a scheduled task to run the pg_dump command periodically. Your PostgreSQL database is logically backed up with this command.
    3. Backup Script: Write a backup script that connects to your PostgreSQL database hosted by AWS and performs the backup using pg_dump. For instance:
      1. pg_dump -h your-aws-db-hostname -U your-aws-db-username -d your-aws-db-name -f /path/to/backup.sql

        Replace the placeholders with your actual AWS database details.

    4. Secure Transfer: After the backup is made, you can transfer the backup file from your AWS environment to your on-premises server using secure techniques (such as SCP, SFTP, or any secure file transfer protocol).
    5. Restore Plan: If a restore is necessary, you can use the psql command and the backup file produced by pg_dump to transfer the data to a fresh instance of PostgreSQL on your local server.

    Resource Link: https://docs.aws.amazon.com/dms/latest/sbs/chap-manageddatabases.postgresql-rds-postgresql-full-load-pd_dump.html

    The use of pg_dump offers a simple and adaptable method for backing up your PostgreSQL data while being totally independent from AWS services. To safeguard the confidentiality and integrity of your data, just make sure that you have put security measures in place for both data transport and storage.

  2. You might automate this process by utilizing RDS if you want to use an AWS service for backup:

    1. Setting up routine RDS snapshots of your PostgreSQL database on AWS is step one. Amazon S3 houses these snapshots.
    2. Set up AWS DataSync such that it replicates the RDS snapshots from S3 to your on-premises systems. DataSync guarantees quick and safe data transfer between your data center and AWS.
    3. On-Premises Backup Storage: RDS snapshots can be obtained and kept on your local servers. Then, you can utilize these snapshots as backups or for other things.

    Resource Link: https://aws.amazon.com/blogs/storage/synchronizing-your-data-to-amazon-s3-using-aws-datasync/

    You can achieve automation by combining RDS snapshots with AWS DataSync while keeping your data outside of AWS at all times. This method takes advantage of AWS's extensive snapshot and synchronization features while streamlining the backup process and minimizing manual intervention.

    In order to guarantee the data's confidentiality and integrity throughout transport and storage, keep in mind to establish appropriate security procedures, encryption, and access controls.

Hope this was helpful!

AWS
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions