3

I'm trying to install postgresql client from AWS Cloud shell, however getting below error:

Preparing your terminal...
Failed to open session : Timed out while opening the session
Trying to open session (Retrying. Attempt #1)
Connection is lost. Please refresh the browser to re-establish the connection.
[cloudshell-user@ip$ Try these commands to get started:
aws help  or  aws <command> help  or  aws <command> --cli-auto-prompt
[cloudshell-user@ip$ sudo apt install postgresql-client
sudo: apt: command not found
[cloudshell-user@ip$ 

I'm using the below command to install the postgresql client.

sudo apt install postgresql-client.

is there any way we could connect AWS RDS PostgreSQL from AWS Cloud Shell ? Like in GCP Cloud Shell ? When i try to connect from GCP Cloud shell, it allows me without any issues but the problem persists in the AWS cloud shell.

Appreciate your help.

Puteri
  • 3,348
  • 4
  • 12
  • 27
  • 1
    Have you tried refresh the browser as shown in the error? Besides, if your postgres is in the private subnet, cloud shell cannot access it. Ref: https://aws.amazon.com/jp/cloudshell/faqs/ – shimo Oct 02 '22 at 20:53
  • Yes, I refreshed it. If psql client is not there by default then I'm looking for a way to install it on cloud shell – Pravin Maske Oct 03 '22 at 10:08

1 Answers1

5

cloudshell runs on Amazon Linux 2, which is based on centos or redhat enterprise linux. It is not a debian-based system, so you will not find apt and friends.

You could try installing with yum, but you are probably best-off with the amazon-specific tooling:

sudo amazon-linux-extras install postgresql14

currently versions 11, 12, 13, and 14 are available

Aryeh Leib Taurog
  • 5,370
  • 1
  • 42
  • 49