AWS Redshift

Redshift CLI command via PSQL | Cheat Sheet

psql cli client installation 

Step 1: update you package repo.

Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository:

deb bionic-pgdg main

Step 2: download the psql client

wget --quiet -O - | sudo apt-key add -

Step 3: update your linux

sudo apt-get update

Step 4: install the psql client

apt-get install postgresql-12

How to Connect to psql

psql -h <endpoint> -U <userid> -d <databasename> -p <port>

How to Connect to psql without password

export PGPASSWORD=’Ar123456’

run SQL Query via psql cli

psql -h <endpoint> -U <userid> -d <databasename> -p <port> -c <command>

Credit : Ariel Yosef


I put a lot of thoughts into these blogs, so I could share the information in a clear and useful way. If you have any comments, thoughts, questions, or you need someone to consult with, feel free to contact me:

Leave a Reply