C2W1 Assignment 1: 1 - Fixing Database Connectivity Issues: adminpwrd fails to connect to server

Every time I run the code as specified in the instructions:

psql --host= --username=postgres --password --port=5432

I get this error every time including after having followed all the instructions through to inputting the new password adminpwrd. Where the notebook says I should be seeing a successful DB connection, I am instead seeing this error every time I run the code throughout this whole section and never see any other errors:

psql: error: connection to server at “de-c2w1a1-rds.cnyq8y8ui9v5.us-east-1.rds.amazonaws.com” (10.0.3.223), port 5432 failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

Preceding this, when trying to run this code:

sudo amazon-linux-extras install postgresql10 -y

I also get this error:

sudo: The “no new privileges” flag is set, which prevents sudo from running as root.
sudo: If sudo is running in a container, you may need to adjust the container configuration to disable the flag.

I’m not sure if this part matters though, because I ran:

psql --version

and I get this response:

psql (PostgreSQL) 15.8 (Ubuntu 15.8-1.pgdg22.04+1)

I have tried rebooting the lab assignment a couple times already and gone through the steps and verified that I have followed the instructions to the lab to the best of my ability and what appears to be correctly, and both times I have received the exact same errors. Hopefully, you can help me identify what is going wrong here whether that is on my end or some fluke from the lab configuration or server.

I tried again, and realized my mistake. I was using the VSCode console instead of the EC2 console. Missed that important detail, came back later, and found the missing detail with fresh eyes.

1 Like