无法从我的ubuntu EC2计算机连接到AWS DocumentDB

问题描述 投票:2回答:1

我无法从我的亚马逊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-web-services ubuntu aws-documentdb
1个回答
1
投票

Amazon DocumentDB在VPC内部署集群,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

© www.soinside.com 2019 - 2024. All rights reserved.