I have setup a mongodb atlas. Also, I have configured a VPC peering from mongodb atlas to my AWS VPC. I have allowed VPC CIDR in the IP access list on mongodb atlas and it's working fine.
I also have a client VPN endpoint Which I am using to connect AWS VPC via secure tunnel. I have also allowed my client VPN private ip range on mongodb atlas IP access list but I am unable to connect to mongodb atlas endpoint.
I tried to dig down further and performed these steps:
resolve hostname from SRV record:
nslookup -type=SRV _mongodb._tcp.clusterx.xxxxxxxxxx.mongodb.net
ping the hostname
ping clusterx-shard-xx-xx.xxxxxx.mongodb.net
When trying the ping from AWS VPC, it resolves to the private ip of that hostname but when I try to ping the hostname from local, it resolves to public ip of that hostname. That was the reason I was unable to connect to mongodb atlas endpoint from my local.
Is there any way to make mongodb connection work with private ip from my local? Any suggestion/help is appreciated.