What IPs must I whitelist so my Glitch project can access my MongoDB database?

Hey @charliea21, unfortunately, we don’t have a good, simple answer for this question. The way our AWS fleet is set up our hosts are assigned IPs more or less randomly from the vast pool of Amazon IP ranges, and we have no control over which ones are assigned where. On top of that, every time a project host gets recycled it will get a new IP. We’re updating our fleet policies right now and I expect that workers will get recycled roughly weekly, so at some point in the future the longest your project will have the same IP address is 7 days.

One mitigating factor here is that Amazon publishes their IP address ranges, so you can actually get the IP address ranges that your project might have with this *sh console command (which you can run locally):

curl https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region=="us-east-1") | select(.service=="EC2") | .ip_prefix'

in other words, download the ip-ranges.json file from Amazon, filter it for IP ranges for EC2 in the us-east-1 region and list the ranges.

If you can whitelist that set of ranges you should be covered (until Amazon updates their regions or we start using other regions).

Barring that you can always

curl https://ifconfig.co/

in your project’s console to get its current IP address. I don’t know if MongoDB has an API for whitelisting, but that might be something someone could explore.

Happy Glitching!

3 Likes