I am new to AWS and backend development. I failed to connect an AWS online database using node-postgres with the code below.
const { Client } = require('pg');
const client = new Client({
host: 'database-1.*****.us-east-1.rds.amazonaws.com',
port: 5432,
user: 'postgres',
password: '<master-password>',
database: 'postgres'
});
The error message I got was connect ECONNREFUSED, and I am not sure what each parameter (host, port, user, password, database) for initializing the client object corresponds to. By the way, here is some information I retrieved in the cloudshell.
[cloudshell-user@ip-10-0-82-165 ~]$ aws rds describe-db-instances \
> --query "*[].[DBInstanceIdentifier,Endpoint.Address,Endpoint.Port,MasterUsername]"
[
[
"database-1",
"database-1.*****.us-east-1.rds.amazonaws.com",
5432,
"postgres"
]
]