连接到AWS RDS PostgreSQL数据库失败
我是AWS和后端开发的新手。我未能使用Node-Postgres与下面的代码连接AWS在线数据库。
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'
});
我收到的错误消息是连接econnrefused
,我不确定每个参数是什么(host
,port
,user
,<代码>密码,数据库
)用于初始化客户端对象对应。顺便说一下,这是我在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"
]
]
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"
]
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论