Actvity: Migrating PostgreSQL to AWS RDS
- Lets create an ec2 instance with size db.t2.micro and ubuntu 20.04
- Install the PostgreSQL Database on ubuntu 20.04
- To change the bind address
sudo find / -name "postgresql.conf"
- Change the listen_address to ‘*’ from ‘localhost’ in location
/etc/postgresql/12/main/postgresql.conf
- To connect the postgres from your local system either download
pgadmin
Refer Here or use Azure Data Studio Refer Here - Make changes in pg_hba.conf
- To make changes and restart service use the below commands
- Change the password for postgres and other users by following below commands
- Now we need a sample db in postgres to migrate.
- To import the sample database execute the following commands
sudo apt install unzip -y
wget https://www.postgresqltutorial.com/wp-content/uploads/2019/05/dvdrental.zip
unzip dvdrental.zip
cp dvdrental.tar /tmp
sudo -i -u posgtgres
psql
CREATE DATABASE dvdrental;
exit
pg_restore -U postgres -d dvdrental /tmp/dvdrental.tar
psql
\c dvdrental
select * from public.actor;
- Next Steps:
- Create a postgresql in AWS rds with size db.t3.micro
- Create a replication instance with size db.t2.micro
- Create a source endpoint and target endpoint
- Create a Replication task.