Skip to main content
Almost all modern Discord bots rely on an external database (MongoDB, MySQL, PostgreSQL) to store user data, or they fetch data from external APIs (like YouTube, Spotify, or OpenAI). If your database is hosted on a different machine than your bot (e.g., MongoDB Atlas or a managed AWS database), you must whitelist the bot’s IP address.

How to Configure External Database Access

  1. Find the Public IPv4 Address of the machine hosting your Discord bot.
  2. Log into your database provider’s dashboard (e.g., MongoDB Atlas, AWS RDS).
  3. Navigate to Network Access or Security Groups.
  4. Add an inbound rule allowing connections from your bot’s specific IP address.
If you are hosting the bot on a home network where the IP changes frequently, you may need to allow connections from anywhere (0.0.0.0/0), though this requires strong database passwords for security. We recommend using the maximum password length your database provider allows, and saving this to a password manager like Bitwarden.