Connecting to Amazon RDS from local machine through an ec2-instance bridge - postgresql

Hello all
I have a dabase seted up in RDS. Right now there is a ec-instance which is my test enviroment which connects to that RDS and working on a particular DB.
Now something with a migration might have messed up the data in that database.
What I am trying to do is connect to that database using pgAdmin 3 to check what's going on.
What I did is used the connect to a new server of pgAdmin
and used the SSH Tunnel tab.
In the properties I used the credentials of the RDS and in the SSH Tunnel(tab)
I used the ssh files I am using to connect to the testing instance I already know has access to the RDS.
Problem is I am getting
Error: SSH error: Error when starting up SSH session with error code
-8 [Unable to exchange encryption keys]
Does my logic make sense ?
Meaning to use the SSH tunnel to configure a connection to an ec2 instance and assume that throught this tunnel the pgAdmin is going to be able to connect to the actuall RDS hosted database ?
Any direction on how to proceed further are greatly appriciated !

Related

Error connecting server to DigitalOcean Postgresql droplet

I am aware that I can connect to a pre-configured Digital Ocean PostgreSQL database cluster and that's what I'm actually connected to right now, but I'd like to connect to a droplet instead (It's cheaper). The droplet is running Ubuntu and came set up with Node JS, PM2, and Nginx. I have already Installed postgreSQL and set up a database on it.
I try to connect to the droplet with this connection string:
DATABASE_URL="postgresql://<USERNAME>:<PASSWORD>#<DROPLET-IP-ADDRESS>:5432/<DBNAME>?schema=public"
and this is the error im getting:
Can't reach database server at `<DROPLET-IP-ADDRESS>`:`5432`\n\nPlease make sure your database server is running at `<DROPLET-IP-ADDRESS>`:`5432`.",
Whats the correct way of connecting via Prisma to a DigitalOcean droplet
If you changed listen_addresses to *, but forgotten to remove the comment (#) at the beginning of the line, the parameter will still be at its default value localhost. Check that the # is removed and restart PostgreSQL. Quite common mistake.
Also answered here by someone.

pgAdmin is throwing Error saving properties unable to connect server timeout expired connecting to Postgresql in AWS Lightsail

I have a Linux instance in AWS Lightsail and I have started up a PostgreSQL database on my LightSail hosted Linux server. On my local Windows 10 machine, I have a Postgresql server as well. When I am attempting to connect to the AWS Postgresql server on Lightsail following the steps described here:
https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-connecting-to-your-postgres-database
On my pgAdmin (my pgAdmin is acting as the client while the Postgresql database that I have on AWS is the server), I am seeing the following error message:
Error saving properties
Unable to connect to the server:
timeout expired
Please note, my database is hosted by Lightsail and not by AWS RDS.
use SSL tunnel with your ip and pem file under SSH Tunnel Tab
Under connection user the ip 127.0.0.1 with your postgres username and password.

PGAdmin III cannot connect AWS RDS

I am trying to connect AWS RDS PostgreSql from PgAdmin 3. I followed the below link
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html
In Security Group, I also added PostgreSQL and All traffic as below
The "publicly accessible" flag was enabled (updated after Mark B's comment)
I got the error from PGAdmin3
Very appreciate for any suggestion
******UPDATE*******
I can connect pgAdminIII to AWS RDS successfully using home wifi, but cannot connect using office wifi.
My concern is:
Was the port 5432 blocked by office wifi?
How can I configure/update the port without impacting to current API?
Note: My current API is working well (CRUD)
Can you can test your connection to a DB instance using common Linux or Windows tools first?
From a Linux or Unix terminal, you can test the connection by typing the following (replace with the endpoint and with the port of your DB instance):
$nc -zv DB-instance-endpoint port
For example, the following shows a sample command and the return value:
$nc -zv postgresql1.c6c8mn7tsdgv0.us-west-2.rds.amazonaws.com 8299
Connection to postgresql1.c6c8mn7tsdgv0.us-west-2.rds.amazonaws.com
8299 port [tcp/vvr-data] succeeded!
Windows users can use Telnet to test the connection to a DB instance. Note that Telnet actions are not supported other than for testing the connection. If a connection is successful, the action returns no message. If a connection is not successful, you receive an error message such as the following:
C:>telnet sg-postgresql1.c6c8mntzhgv0.us-west-2.rds.amazonaws.com
8299
Connecting To sg-postgresql1.c6c8mntzhgv0.us-west-2.rds.amazonaws.com...Could not
open connection to the host, on port 819: Connect failed
If Telnet actions return success, then you are good to go.
If you are trying to access it from a network which is not listed for that port. you need to add inbound rules for those network IPs from AMAZON RDS system
You will also need to set Public accessibility true under Connect & security tab in RDS console.
Read this post.In your security group go to unbound rules and add my ip.
and make sure your database is public.
https://serverfault.com/questions/656079/unable-to-connect-to-public-postgresql-rds-instance

Connect to database in docker container on remote host with pgadmin3

I'm trying to connect to a database running in a docker container on a remote host. I configured SSH-Tunnel in pgadmin3 with ip of the host and identity file. On Settings tab I inserted 172.18.0.2 (the container IP) as host. It is not possible to connect. pgadmin turns grey for a while and presents me a beautiful error message:
SSH error: Error when starting up SSH session with error code -8 [Unable to exchange encryption keys]
Do I miss something? Is it possible to connect to the container?
When I upgraded pgAdmin 1.20.0 to 1.22.1, I started getting the same error. pgAdmin 4 doesn't have support for any SSH tunnel either. So, the only option you have right now is .. revert back to 1.20.0. Unfortunately, if you're on PG9.5 or better, pgAdmin 1.20.0 doesn't support it.
If you require access to a Postgres 9.5 database, you can manually create the SSH tunnel, and then connect using pgAdmin3 by setting the host to localhost. On Linux or Mac, you can use the following: ssh -L 5432:<pg-host>:5432 <jump-host-ip-or-dns>. It doesn't seem likely that pgAdmin3 will receive any updates with the direction pgAdmin4 is heading.

Can't connect to Google Cloud SQL

I opened a trial account on Google Cloud and I'm having difficulties connection to Cloud SQL.
I made the basic setup, authorizing my IP/32 && adding a new User (appUser).
But I can't open a remote connection to the instance.
mysql -v --host=<ip> --user=appUser --password
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '<ip>' (60)
I'm at work and obviously behind a ton of firewalls and whatnot. Could this be the cause of my problems ?
There is a good change that it is a firewall problem. Error 2003 (from MySQL client manual) means that it can't connect to the server.
Can you try to connect through a computer outside the firewall?