Search code examples
mongodb-atlasmongodb-stitch

MongoDB Atlas - Configure IP Whitelist when hosting on AWS S3 and Cloudfront


How do I set the IP address Whitelist for a MongoDB Stitch application (MongoDB Atlas back-end) when the site is hosted on AWS S3 (using cloudfront)?

The site is currently working though I have never set an IP address.

I just don't want it to lose access at some point because I have failed to set the correct IP address whitelist. Perhaps it is not necessary because the cluster is already on AWS?

Thank you!


Solution

  • The IP Whitelist specifies IPs that the Atlas cluster will accept client requests from. Examples of clients include MongoDB Compass, the Mongo shell, and Stitch. In this case, your app only connects to Atlas indirectly through Stitch. Stitch automatically adds its own whitelist entries for itself as client.

    Stitch does not restrict any cross-domain requests unless you specify Allowed Origins in the Stitch settings. Otherwise, no apps using the client SDKs would work without explicit whitelisting!

    This is the control panel where you could set Allowed Origins, if you only want to be able to connect to Stitch from some specific domains:

    The Allowed Origins entry box on the Stitch Setting panel

    In short, you do not need to configure the IP Whitelist to allow your site to communicate with Stitch. Everything should keep working!