I am currently preparing to put my web application for production. I'm using an Amazon EC2 on Redhat and have a Postgres AWS RDS in the same VPC. I cant seem to connect to the database or to a local one running on the same EC2. I have had no issues while running and testing my app on my local mac and another physical server in our office that runs Redhat 7.
I'm running the 'sails lift' command with my models set to migrate:'alter' so that it can properly set up the Database with my models and configurations, however it gets hung on a 'Waiting...' command in the middle of the orm hook as in the image.
Problematic Output
default: {
adapter: 'sails-postgresql',
host: 'localhost',
port: 5432,
user: 'exampleuser',
password: 'thepassword',
database: 'newdb',
},
I can connect to my RDS database and the local one using psql without any issues and with PGadmin. This exactly datastores setup works with my Mac and with our physical Redhat server using their own respective local postgres instances. On the Amazon EC2s however Im running into the problem from the image.
I have also tried running a complete base sails app made with 'sails new newBaseApp' and set up the datastore in that to connect to the local postgres database on the ec2 server. It has the exact same problem.
Related
I have two postgresses running. One is running in the local machine and the other in a docker-container. I first had trouble connecting to the postgres running in the docker-container at all, but after following the instructions in this post I was able to connect to it after I had shut down my local postgres. Now my question is how could I have Postico connecting simultaniously to the local postico and the one that is running in docker-container, so that I can access databases in them simultaniously?
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 !
I have written a set of APIs using springboot framework. Locally its working fine. But now I am trying to test it with the postgresql database running on ec2 instance on aws.
NOTE: I am not using amazon RDS services, I have created an ec2 instance and installed postgres and configured database there.
I can see this exception being thrown when I am running my springboot application locally.
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:297)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211)
This is the config from application.properties for one of the db
spring.xyz.datasource.jdbc-url=jdbc:postgresql://xyz.com:5432/xyz_db
spring.xyz.datasource.username=xyz
spring.xyz.datasource.password=xyz123
Am I not being able to connect because of the EC2 instance security configs ? How can I change that ?
Also it will be helpful if someone can tell me how can I make aws ec2 instance to accept the connection from only one VM ?
regarding Postgress connection-
add below rule to security group of Ec2 instance , on which you have installed postGress
Allow inbound traffic to postgress port from 0.0.0.0/0 and test. ( protocol- TCP, port - 5432, IP - 0.0.0.0/0)
regarding allow from only one VM
add security group rule to your Ec2 instance
Allow inbound traffic from your VM IP only
I have 2 computers (Win 10 and Mac) and need to access a RDS Postgres database. Connection is secure via a bastion host and ecs instance. When I configure TablePlus like this:
It works perfectly on the Mac but not on Windows. I checked a bit and recommendation is to create a tunnel via Putty to forward the port 5432 to a local one and then try to access the db with a local IP. But no success.
I would like to know if there is a specific setting in TablePlus or something I'm missing that will allow me to access the database on my Windows computer? I tried also with pgAdmin and same results.
I'm a bit new to SQL and Docker. I've recently created a container for PostgreSQL on my Linux server that can be accessed by SSH. I am trying to manage it using the Entity Framework on .NET Core 2.2.
I'm trying to go by Npgsql's official documentation, but there isn't any provision for connection via SSH. The example they've provided for the connection string is:
optionsBuilder.UseNpgsql("Host=my_host;Database=my_db;Username=my_user;Password=my_pw")
Where:
my_host is set to the docker container's IP address.
my_db is the database name
my_user is the username on PostgreSQL
my_pw is the database password
I am also using this First EF Core Console Application as a tutorial. When I am attempting on the dotnet CLI:
dotnet ef database update
It keeps timing out, obviously because it can't connect to the server via SSH.
I've done my fair share of Googling with no luck. Can any of you please advise?
Edit FYI:
I am using a Windows 10 computer as a client
I am using Ubuntu Linux and connecting via OpenSSH
The Linux server has a Docker Container w/ PostgreSQL
I have successfully connected from my Windows 10 client using DBeaver
In principle, connecting to PostgreSQL isn't done over SSH - it's done directly via port 5432. You typically need to configure your container to expose that port (check the docker networking docs).
It is possible to use SSH tunneling to connect to PG (or any other service), but that's a pretty specialized mechanism to bypass firewalls and the like. You likely just need to expose port 5432 from your container.