Hi there, I have been trying to connect my Node.js application in AWS EB to my AWS Atlas cluster via peering connection but I keep running into this error:
error: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017. I read that it meant the Mongodb is not running but I am able to connect to it via Compass. In my Node.js application I am using the following connection string
I used this quickstart guide MongoDB Atlas on the AWS Cloud, choosed the
Deploy MongoDB Atlas with VPC peering into a new VPC template and some tips from this old video MongoDB (Atlas) VPC Peering with AWS Tutorial - Jay Gordon - YouTube to figure out the routing table stuff. The Atlas cluster was created in a new project and I have added the Atlas Cluster’s CIDR to the two private subnets created by the template in the host VPC. On Mongo end, I have also whitelisted the VPC CIDR and also the EC2 instance’s public IP.
What am I missing? Thanks in advance for the assistance.