I have a VPC peering established with MongoDB Atlas, however when I try to resolve the database cluster's domain from within an EC2 instance in the same VPC, I get back the public IP. This is a problem because the whitelist can't contain any public IPs, as I want to grant access to the database only for internal services.
I tried to enable both "DNS resolution" and "DNS hostnames" in the VPC settings, as well as "Accepter DNS resolution" in the peering configuration, but nothing works.
Besides the information above, I can mention that the EC2 does have access to the Internet (that's how I connect via SSH to it), the VPC has only one subnet and the route table is properly configured to send traffic to the VPC peering (see screenshot below).
My questions are: 1) Is it possible to do what I'm trying (I saw multiple people on the Internet describing their solution to this, however they don't work for me -- good to note that their articles dates from years ago, so that all might be different now); 2) What am I doing wrong?