docs
GitHub CI/CD Deployment
DB Access with SSM
pgAdmin 4

pgAdmin 4

pgAdmin 4 is a popular open-source tool for managing PostgreSQL databases. It provides a graphical interface that makes it easier to interact with PostgreSQL databases compared to using the command line. In this guide, we'll walk through the steps to connect pgAdmin 4 to a PostgreSQL database running in a staging/production RDS.

Step 1: Start the SSM Session to Your EC2 Instance.

Ensure that you have started the SSM session in a terminal.

aws ssm start-session \
 --target [EC2-INSTANCE-ID] \
 --document-name AWS-StartPortForwardingSessionToRemoteHost \
 --parameters '{"host":["[HOST]"],"portNumber":["[DB-PORT]"],"localPortNumber":["[DB-PORT]"]}' \
 --profile [PROFILE] \
 --region [REGION] 

Step 2: Open pgAdmin 4

Open your pgAdmin 4 desktop app.

Step 3: Register a New Server

Right click on the Servers -> Register -> Server...

Create Permission Set

Step 4: General Tab

  • Name: dbname from Secrets Manager

Create Permission Set

Step 5: Connection Tab

  • Host name/address: localhost

  • Port: port from Secrets Manager

  • Maintenance database: dbname Secrets Manager

  • Username: username from Secrets Manager

  • Password: password from Secrets Manager

Create Permission Set

Step 6: Check Database

Access database i.e. launchgoatStaging

Create Permission Set