AWS SAM Local Invoke not connecting to DocDB Cluster

318 Views Asked by At

My company has a DocDB cluster in a sandbox environment.

Currently, I can do the following:

  • Connect to cluster via Terminal and Mongo Compass.
  • If I deploy the lambda to was,it can connect to the cluster.
  • If I run the Python script in VScode, I can connect to the cluster.
  • Lambda can make Api calls when invoked locally (It has internet access).

However, when I try to do SAM LOCAL INVOKE, I get the following message:

{"level":"ERROR","location":"lambda_handler:277","message":"Error executing lambda handler.","timestamp":"2022-05-17 16:46:07,870+0000","error":"No replica set members found yet, Timeout: 30s, Topology Description: <TopologyDescription id: xxxxxxx, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('xxxx', port_num) server_type: Unknown, rtt: None>, <ServerDescription ('xxxx', port_num) server_type: Unknown, rtt: None>, <ServerDescription ('xxxxx', port_num) server_type: Unknown, rtt: None>]>"}
END RequestId: 2955dfe0-ab6b-48e6-b5bb-276633f60f6f

Any ideas what is going on?? We have a SSO system, I think it might be something going on with the docker container, ip mapping and SSO? Any advice on what to do?

1

There are 1 best solutions below

0
On

Amazon DocumentDB is VPC only and does not currently support public endpoints. You can’t connect directly to your Amazon DocumentDB cluster from outside of your VPC unless you have a vpn connection or setup ssh port forwarding.