title: Mongodb atlas dedicated cluster: how to create peering connection with AWS and then access the cluster without whitelisting ips
body: <p>We have a dedicated M10 cluster in Mongodb Atlas, on which I have created a peering connection with AWS to incorporate security using VPC. I have followed this Mongodb document for configuring peering connection between AWS and cluster.</p>
  <p><a href="https://docs.atlas.mongodb.com/security-vpc-peering/" rel="nofollow noreferrer">https://docs.atlas.mongodb.com/security-vpc-peering/</a></p>
  <p>The peering connection is created successfully and is active now. But the thing is, I am unable to connect to cluster without whitelisting my IP. When I try to connect without whitelisting the IP, it gives below error:</p>
  <blockquote>
  <p>Something went wrong MongooseServerSelectionError: Could not connect
  to any servers in your MongoDB Atlas cluster. One common reason is
  that you're trying to access the database from an IP that isn't
  whitelisted. Make sure your current IP address is on your Atlas
  cluster's IP whitelist:
  <a href="https://docs.atlas.mongodb.com/security-whitelist/" rel="nofollow noreferrer">https://docs.atlas.mongodb.com/security-whitelist/</a></p>
  </blockquote>
  <p>While after whitelisting the IP, I am able to connect to cluster successfully from local environment.
  What do I need to access a cluster within VPC using application? I can not use the option IP whitelisting as every user's IP can not be whitelisted.</p>
  <p>I have already whitelisted CIDR block as mentioned by the above documentation.</p>