[英]I cant connect to AWS RDS using Postgres
我在 aws 上創建了一個實例/數據庫,當我嘗試通過終端連接到它時,通過運行下面的代碼,出現錯誤。
我在終端運行的線路是:
psql --host=testdb.c7hgibdbsgjm.eu-west-2.rds.amazonaws.com --port=5432 --username=postgres --password --dbname=testdb
它返回的錯誤是:
psql: error: could not connect to server: could not translate host name "testdb.c7hgibdbsgjm.eu-west-2.rds.amazonaws.com"
to address: nodename nor servname provided, or not known.
我花了最后 3 天閱讀相關文檔並試圖讓它工作,但我不知道我哪里出錯了。
當我跑步時:
nslookup testdb.c7hgibdbsgjm.eu-west-2.rds.amazonaws.com
它返回:
Non-authoritative answer:
*** Can't find testdb.c7hgibdbsgjm.eu-west-2.rds.amazonaws.com: No answer
我來自統計背景,我在 R 和 python 中進行了相當多的編碼,但我對使用終端等相對較新!
感謝您提供任何指導或幫助,因為這讓我想打我的筆記本電腦。
在運行 dig 命令時: dig testdb.c7hgibdbsgjm.eu-west-2.rds.amazonaws.com
它返回了一個私有 IP: 172.31.23.42
。
看來您正在以私有或內部方式運行 RDS 實例,即無法從 Internet 訪問它。
您需要從 VPC 本身訪問它或需要使用 VPN。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.