0

I am having trouble connecting to my AWS DocumentDB Instance. Here is the setup.

DocumentDB

Engine version docdb 4.0.0

Security Groups:

  • Default
  • DocumentDB

EC2

Security Groups:

  • Default
  • SSHing VPC
  • DocumentDB VPC

Lambda

Security Groups:

  • DocumentDB VPC

VPC

Has Internet Gateway

Security Groups

Default

  • IB All traffic from Default SG
  • OB All traffic

SSHING Security Group

  • IB Traffic to ports 22 and 27017 from my IP Address
  • OB All traffic

DocumentDB

  • IB Port 443 from DocumentDB SG Port 27017 from my IP address All ports from SSHING
  • OB All traffic Port 443 DocumentDB SG

I realize my vpc is probably not set up correctly. Any advice would be appreciated

When I write a simple python script and execute it in an EC2 instance assigned the SSHing security group, it works.

When I try to execute a similar lambda function as configured above, I get a pymongo.errors.ServerSelectionTimeoutError.

When I create a tunnel locally via ssh -i "xxx.pem" -L 27017:xxxxx.us-east-2.docdb.amazonaws.com:27017 ec2-user@xxxxxxx.us-east-2.compute.amazonaws.com -N

then try to connect with Compass, the tunnel generates channel 2: open failed: connect failed: Name or service not known

jarmod
  • 71,565
  • 16
  • 115
  • 122

1 Answers1

0

There are several prerequisites required, in order to configure a Lambda function to successfully connect to DocumentDB. Follow this tutorial, which I believe it may help you.

Mihai A
  • 351
  • 1
  • 4