A VDS for a Discord bot is a virtual server that keeps your bot online 24/7, even when your computer is off. Free hosting services often come with sleep modes, resource limits or outages; on your own VDS you get dedicated CPU and RAM for your bot and full administrative control.
In this guide we explain how many resources a Discord bot needs, how to run a Node.js or Python bot on a Linux VDS and what to do to keep it running without interruption.
How Many Resources Does a Discord Bot Need?
| Bot type | Typical needs |
|---|---|
| Moderation, welcome or command bot (a few servers) | 1–2 cores, 1–2 GB RAM |
| Bot using a database across many servers | 2 cores, 2–4 GB RAM |
| Music bot, image processing, AI integration | 3–4 cores, 4 GB RAM or more |
Most bots are lightweight; what really determines resource needs is what the bot does and how many servers it is in. You can also run several bots or a web dashboard on the same VDS.
Affiliate ProgramFound this useful? Share it and earn.Get 20% commission on orders from customers you refer. Joining is free.DetailsDo I Need to Open a Port?
No. Discord bots make an outgoing connection (WebSocket) to Discord's servers; nothing connects to the bot from outside. So you don't need to open a port in the firewall for the bot. You only need to open a port if you publish a web dashboard or webhook for the bot.
Step-by-Step Setup (Ubuntu, Node.js)
- Connect to the server:
ssh root@server-ip - Create a separate user: don't run the bot as root.
adduser botuser su - botuser - Install the current LTS version of Node.js (use the official Node.js install instructions or nvm).
- Upload your bot files: pull them with Git or upload them over SFTP, then run
npm install. - Don't hard-code the token: put the bot token in a
.envfile instead of the code, and don't add that file to your Git repository. - Run the bot with a process manager:
PM2 restarts the bot if it crashes; withnpm install -g pm2 pm2 start index.js --name mybot pm2 save pm2 startuppm2 startupthe bot also starts automatically when the server reboots.
The logic is the same for Python bots: create a virtual environment (python3 -m venv), install the dependencies and run the bot as a systemd service.
Security and Maintenance Tips
- If your token leaks, regenerate it immediately in the Discord Developer Portal.
- Request only the permissions the bot needs (intents and role permissions).
- Use key-based SSH login instead of a password and close unnecessary ports.
- Check the logs (
pm2 logs) regularly and keep dependencies up to date. - If you use a database, back it up regularly.
Windows or Linux?
Linux uses fewer resources and is the usual choice for bots. A Windows VDS makes management easy through a graphical interface over Remote Desktop; for connecting, see our article What is RDP.
Running a Discord Bot on a ViHyper VDS
ViHyper VDS plans are located in Turkey; you choose the operating system when ordering and can upgrade to a bigger plan as your resource needs grow. For the basics of VDS, read our article What is a VDS.
Frequently Asked Questions
Why a VDS instead of free bot hosting?
Sleep modes, resource limits and outages are common on free services. On a VDS the resources are reserved for you and you can configure the bot however you like.
How many bots can run on one VDS?
For lightweight bots, a single small VDS can comfortably run several. Decide by monitoring total RAM and CPU usage.
Why does my bot keep shutting down?
The most common causes are uncaught errors, insufficient RAM and an invalid token. Run the bot with PM2 or systemd and check the logs to find the cause.