AWS Classroomnotes 09/Jan/2022

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
    Preview
    Preview
  • 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
    Preview
  • To make changes and restart service use the below commands
    Preview
  • Change the password for postgres and other users by following below commands
    Preview
  • 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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner