current status:
I have created a documentdb cluster. added an inbound rule for the security group to allow all traffic from anywhere. disabled TLS for the cluster
tried connecting to the db following this https://docs.aws.amazon.com/documentdb/latest/developerguide/connect_programmatically.html
but throws following error:
(node:45892) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [aacb-c1.cluster-c3ggyumy9pd2.us-east-2.docdb.amazonaws.com:27017] on first connect [MongoNetworkTimeoutError: connection timed out
Amazon DocumentDB is virtual private cloud (VPC)-only and does not currently support public endpoints. Hence, if you are trying to connect from a Node server running locally in your machine, it will not be able to reach Amazon DocumentDB publicly.
Alternate options:
You can use SSH tunneling to connect from a local environment. To create an SSH tunnel, you need an Amazon EC2 instance running in the same Amazon VPC as your Amazon DocumentDB cluster. You can refer to the instructions here: https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html
You can try running your application from an EC2 instance(with Node installed) created in the same VPC containing the Amazon DocumentDB cluster.