amazon-web-services - 无法从我的 ubuntu EC2 机器连接到 AWS DocumentDB

标签 amazon-web-services ubuntu aws-documentdb

我无法从我的亚马逊 EC2 ubuntu 机器连接到我的 Amazon DocumentDB?我检查了 Amazon DocumentDB 的安全性,它当前被分配给具有“所有流量”的默认值。

尽管我收到了下面包含的错误消息,但我直接从 AWS 实例页面尝试了以下命令。

我已遵循此 aws 指南 https://docs.aws.amazon.com/documentdb/latest/developerguide/getting-started.connect.html

来自 EC2 ubuntu 机器的 Mongo shell 命令

mongo --ssl --host mydatabasename.23scnncsd3.eu-west-1.docdb.amazonaws.com:27017 --sslCAFile rds-combined-ca-bundle.pem --username webuser --password mypassword

我从 ubuntu 命令提示符中收到的错误消息如下

错误信息
MongoDB shell version v3.6.11
connecting to: mongodb://mydatabasename.23scnncsd3.eu-west-1.docdb.amazonaws.com:27017/?gssapiServiceName=mongodb
2019-03-11T21:39:37.587+0000 W NETWOK  [thread1] Failed to connect to 172.31.45.184:27017 after 5000ms milliseconds, giving up.
2019-03-11T21:39:37.595+0000 E QUERY    [thread1] Error: couldn't connect to server mydatabasename.23scnncsd3.eu-west-1.docdb.amazonaws.com:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed

难道我做错了什么?任何帮助表示赞赏!

非常感谢,

更新

aws screen shot

最佳答案

Amazon DocumentDB 在 VPC 内部署集群,充当其他 VPC 和 Internet 的强大网络边界。当您连接到集群时,请确保客户端计算机与集群位于同一区域和同一 VPC。

或者,如果您的开发环境位于不同的 Amazon VPC 中,您也可以使用 VPC 对等连接并从同一区域或不同区域的另一个 Amazon VPC 连接到您的 Amazon DocumentDB 集群。

有关故障排除的更多信息:https://docs.aws.amazon.com/documentdb/latest/developerguide/troubleshooting.html

从 VPC 外部连接到 Amazon DocumentDB 集群:https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html

关于amazon-web-services - 无法从我的 ubuntu EC2 机器连接到 AWS DocumentDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55110838/

相关文章:

aws-documentdb - 与 Java 的 AWS DocumentDB TLS 连接

java - 如何读取 Amazon S3 中的文件内容

amazon-web-services - 当网站是外部托管的(未托管在 AWS 或 S3 上)时,AWS Cloudfront 如何同时适用于静态网站和动态网站?

ruby-on-rails - 我如何在 ubuntu 17.04 上安装 rmagick

android - 模拟器已经在运行但无法在 ubuntu 中看到它

ruby-on-rails - 如何将 AWS 文档数据库与 Ruby On Rails 结合使用?与 3.6 版的兼容性?

amazon-web-services - AWS DocumentDb 不支持 mongodb 4.0

amazon-web-services - AWS API 网关 - 私有(private)端点 - 消息被禁止

amazon-web-services - 无服务器函数中的并发问题 (AWS/Azure)

linux - Docker 中的纯数据容器如何获取数据?