Using the node pg package, pg
, I'm trying to connect to a PostgreSQL DB created in AWS-RDS. I believe the DB was NOT given a name when creating an instance, note that an instance is different than a DB. When trying to connect using Client
or Pool
from pg
my syntax is
const client = new Client({
host : <<RDS ENDPOINT>>,
user : <<RDS DB USERNAME>>,
password : <<RDS DB PASSWORD>>,
port : <<RDS DB PORT>>
});
client.connect()
.then(data => {
console.log('connected');
})
.catch(err => {
console.log(err);
})
But every time I am returned with error: database <<linux user name>> does not exist
.
Now creating a different PostgreSQL instance and supplying a name for the DB I am able to add a database
prop to my Client
objects config and everything works and I am returned with a console log of connected
.
So my question is, how am I supposed to connect to the DB on AWS-RDS without supplying a database
prop in my Client
config?
Edits
edit 1
Supplying a database
prop with an empty string will be overwritten with my linux username