Before I begin, please let me be specific that issue may not be related to MongoDB, this could be some error/mistake at my end. I am just seeking help from the community.
I have a mongodb atlas cluster where I have added 2 IPs in its whitelist (say ip1 and ip2)
ip1 belongs to a windows webserver hosted on google cloud. I am able to connect to atlas through this ip.
ip2 belongs to a centos7 instance running tomcat on google cloud. I have a webapp which is trying to make a connection to mongodb atlas but I am getting timeout exception saying permission denied.
My connection string is the same for both cases so that is not the point of failure. I believe there is some issue in tomcat which is blocking this webapp to connect to mongodb atlas.