cechow
cechow

Reputation: 170

AWS RDS Connection with SSM and Bastion - pgAdmin Connection Timeout

I have an AWS RDS that I'm accessing securely via AWS SSM and Bastion. I do the following to start an AWS session:

  1. In my terminal, set AWS session credentials
  2. Run AWS SSM: aws ssm start-session --target bastion-instance-id --region my-region --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters '{"host": ["awsrdsurl.rds.amazonaws.com"], "portNumber":["5432"], "localPortNumber": ["5896"]}'
  3. I get the following:
    • Starting session with SessionId: session-id
    • Port 5896 opened of sessionId session-id
    • Waiting for connections...

I am able to connect to the session using psql: psql -h localhost -p 5896 -U my-db-username -d my-db-name. This indicates to me that the port forwarding is working.

I'm not able to connect to the session using pgAdmin, it gives me "Unable to connect to server: connection timeout expired".

My "Connection" tab has:

My "Parameters" tab has:

I've tried connection timeout up to 300s and it's the same thing.

When I try to connect, I'm not connected to the SSM session with psql so it's the only connection attempt to the SSM session.

The above worked at one point, I had the server connection set up in pgAdmin for a couple months ago and I had removed it today to walk through setting it up from scratch and this happened. I've also updated to the latest version of pgAdmin (v8.13).

I'm not sure what I should be checking and if I'm completely missing something in my setup, any help/advice would be greatly appreciated!

Upvotes: 0

Views: 89

Answers (1)

Radu
Radu

Reputation: 1

you can not use 'localhost' when pgadmin is run from a docker container no matter the docker network mode. For host mode use 'host.docker.internal'

Upvotes: 0

Related Questions