Installing Postgres Client on Amazon Linux

February 11, 2019

I needed to install a postgres client onto Amazon Linux so that I could access my RDS database with it temporarily.

Installing

To install:

[ec2-user ~]$ sudo yum install -y  https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm

[ec2-user ~]$ sudo sed -i "s/rhel-\$releasever-\$basearch/rhel-latest-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"

[ec2-user ~]$ sudo yum install -y postgresql10

[ec2-user ~]$ psql --version

psql (PostgreSQL) 10.6

Connecting

You can connect to the RDS instance (provided you're in the right security group) using:

$ psql -h db-url.abc123.eu-west-1.rds.amazonaws.com -U adminuser -d databasename

References