I created an Elastic Beanstalk with a Nodejs app on it. Then from the environments' configurations I created a postgres RDS.
I can connect to the postgres server from a console:
psql --host=aa1682linxrnijl.c09xht5iw0ld.us-east-1.rds.amazonaws.com --port=5432 --username=monolithDB --password --dbname=postgres
And I also have an existing table in it. result of \dt
But when I try to connect from my Nodejs localhost, using node-postgres:
const { Client } = require("pg");
const client = new Client({
host: 'aa1682linxrnijl.c09xht5iw0ld.us-east-1.rds.amazonaws.com',
password: 'XXX',
port: 5432,
database: 'postgres',
user: 'monolithDB'
});
client.connect()
I get an error:
error: role "root" does not exist
It seems to me that the node-postgres doesn't recognize the 'monolithDB' as a user. How can I properly connect to the Postgres server?