How to connect to redshift database from Command Line using psql

Step1: Download and install psql tool from https://www.postgresql.org/download/ for your version of OS.

For Linux:

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm 

sudo yum install postgresql14

Step2: Copy the endpoint, database name, port information from AWS Management console for your Redshift database and use the below connection string to connect to the database. You will be prompted to enter the password for your specified ‘username‘.

psql -h <endpoint> -U <username> -d <databasename> -p <port>
See also  How to encrypt an EBS volume