Firstly, Amazon DocumentDB is a VPC only service, hence it is not possible to create outside a VPC. If you delete the default VPC, you will need to create a new VPC, subnets, security group, DB subnet group, etc. before setting up a new DocumentDB cluster.
Secondly, since the command hangs, I would recommend you to check the connectivity setup with subnets and security group. Is the Security Group being used by the DocumentDB cluster allowing access on port 271017 from the private IP of the EC2, or the CIDR range if in same VPC?
To test connectivity, you can SSH to the EC2, and try a telnet to DocumentDB endpoint to confirm the connection and port are accessible.
Hi! Good question. DocumentDB in this case will require a VPC configuration.
To your point, what you are doing is setting up an EC2 instance in the same VPC to forward connections to the DocumentDB as described here: https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html. Do you have TLS enabled on the DocumentDB Cluster? If so, you will need to download the public key. This could also be an issue with the network connectivity of the EC2 instance or the connection between the EC2 and the DocumentDB cluster (Security Groups, other network config).
If you want to use a DB Service that does not require a VPC configuration, check out DynamoDB: https://aws.amazon.com/dynamodb/. AWS calls this a "a fully managed, serverless, key-value NoSQL database."
Connect Amazon DocumentDB Cluster from Outside Amazon VPCasked 8 months ago
Can't select subnet at DocumentDBasked 3 years ago
MongoDB Atlas vs DocumentDBasked 7 months ago
Unable to connect to DocumentDB within VPC via EC2 windows host using MongoDB Compass tool.asked 2 months ago
Athena DocumentDB with GeoJSON data not workingasked 5 days ago
Connecting Programmatically to Amazon DocumentDBasked 2 months ago
"Connect failed" when trying to connect to the DocumentDB cluster from AWS C9asked 6 months ago
Lower pricing options on DocumentDBasked 3 years ago
Migrate or dump DocumentDB dataasked 3 years ago
Is it possible to configure documentDB global clusters from sa-east-1?asked 6 months ago