24/7 Telegram bot on VPS: aiogram, monetization, load

calendar_month May 08, 2026 schedule 8 min read visibility 15 views
person
Valebyte Team
24/7 Telegram bot on VPS: aiogram, monetization, load
For the stable operation of a Telegram bot on a VPS with an audience of up to 10,000 daily active users (DAU), a server with 2 GB of RAM, 1-2 CPU cores, and an NVMe drive is required — such a configuration ensures 99.9% uptime with a rental cost starting from $6 to $12 per month.

Launching a Telegram bot on professional hosting is a transition from makeshift scripts to a full-fledged IT product. Unlike running it locally on a laptop, telegram bot hosting based on a VPS guarantees that your service will be available to users instantly, without delays or outages. When using modern frameworks like aiogram 3, proper environment configuration becomes a critical stage of development.

Why You Should Choose a Telegram Bot on a VPS for Commercial Projects

A Virtual Private Server (VPS) provides full control over the operating system, which is unavailable on Shared hosting or PaaS platforms with their strict limits. For tg bot business solutions, this means the ability to install any dependencies: from Redis databases for state caching to RabbitMQ message brokers.

Advantages of VPS over Cloud Functions and PaaS

  • Static IP address: Necessary for setting up Webhooks and protecting against Telegram spam filters.
  • No Cold Start: Unlike AWS Lambda or Google Cloud Functions, a bot on a VPS is always in memory and responds instantly.
  • Predictable cost: You pay a fixed monthly amount, regardless of the number of updates processed.
  • Data storage flexibility: You can deploy PostgreSQL or MongoDB directly on the same server.

For large projects requiring the processing of large datasets, integration with third-party services is often required. For example, if your bot is involved in data collection, you might find the article on scraping Wildberries/OZON/Avito on a VPS useful, where issues of working with proxies and anti-ban systems are discussed in detail.

Technical Specifications and Load Calculation: How Much RAM is Needed for 10k DAU

The choice of server resources directly depends on the complexity of the bot's logic and the stack used. A bot on aiogram vps consumes more memory than simple scripts using the telebot library due to its asynchronous nature and complex Middleware system, but it is capable of handling significantly more simultaneous requests.

Load Metric (DAU) Processor (vCPU) RAM Disk Type Recommended OS
up to 1,000 1 core (2.0+ GHz) 512 MB - 1 GB SSD / NVMe Ubuntu 22.04 / 24.04
1,000 — 10,000 1-2 cores (3.0+ GHz) 2 GB NVMe Debian 12
10,000 — 50,000 2-4 cores 4 GB - 8 GB NVMe Ubuntu 22.04 LTS
50,000+ 4+ cores (High Frequency) 16 GB+ NVMe RAID RHEL / AlmaLinux

It is important to understand that 10,000 DAU is not the limit for 2 GB of RAM if the bot is written optimally. However, if you use heavy libraries for image processing (Pillow) or machine learning, memory consumption can grow to 4-6 GB. For AI-related projects, specialized solutions are often used, which you can read about in the material on Vector DB on VPS.

Looking for a reliable server for your projects?

VPS from $10/mo and dedicated servers from $9/mo with NVMe, DDoS protection, and 24/7 support.

View offers →

Deployment on aiogram 3: The Modern Development Standard

The aiogram 3 framework is the de facto standard for high-load bots. It is fully asynchronous, supports Python 3.10+ typing, and offers a powerful Finite State Machine (FSM) system. To ensure a python bot 24 7 operation, it is necessary to properly organize the code structure and dependency management.

Example of a Basic Project Structure


project_bot/
├── data/
│   └── config.py
├── handlers/
│   ├── common.py
│   └── admin.py
├── keyboards/
│   └── reply.py
├── middlewares/
│   └── throttler.py
├── states/
│   └── user_states.py
├── bot.py
└── requirements.txt

To install and configure the environment on a VPS, use virtual environments (venv) or Docker. This isolates the bot's dependencies from the system Python libraries, preventing version conflicts.


# System update and dependency installation
sudo apt update && sudo apt upgrade -y
sudo apt install python3-pip python3-venv git -y

# Project creation
git clone https://github.com/youruser/yourbot.git
cd yourbot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Ensuring 24/7 Operation via systemd and Supervisor

Simply running a script in the terminal is not enough: when the SSH session is closed, the process will terminate. To ensure the bot runs continuously and automatically restarts after crashes or server reboots, system process managers are used.

Configuring a systemd Unit

Systemd is the standard tool in Linux for managing services. Create a configuration file:

sudo nano /etc/systemd/system/my_tg_bot.service

Insert the following content, replacing the paths with your own:


[Unit]
Description=Telegram Bot Service
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/yourbot
ExecStart=/root/yourbot/venv/bin/python bot.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

After saving the file, execute the commands to activate the service:


sudo systemctl daemon-reload
sudo systemctl enable my_tg_bot
sudo systemctl start my_tg_bot
sudo systemctl status my_tg_bot

Using a python bot 24 7 with systemd guarantees that even in the event of a critical code error (Exception) that causes the process to crash, the system will bring it back up in 5 seconds. If your project grows into several independent microservices, it's worth considering self-hosted n8n for automating complex action chains without writing extra code.

Monitoring and Logging: How Not to Miss a Bot Crash

Even the most stable VPS can encounter network issues or resource exhaustion. To monitor the bot's status, it is recommended to use UptimeKuma or a Prometheus + Grafana stack. UptimeKuma allows you to check the availability of the Telegram API and respond to your bot's HTTP requests (if you are using Webhooks).

Real-time Error Tracking

For a commercial bot, it is critical to know about errors before users write to technical support. Sentry integration allows you to collect all Tracebacks into a convenient dashboard. You can deploy your own instance of this service by following the guide on self-hosted Sentry, which will save you dozens of dollars on paid subscriptions.

Key metrics for monitoring:

  1. Response Time: Bot response time to a user message (normal is up to 200-500 ms).
  2. CPU Usage: If the load is constantly above 80%, it's time to upgrade to a more powerful plan.
  3. Memory Leak: A gradual increase in RAM consumption over a week indicates leaks in the code (e.g., unclosed DB connections).
  4. Update Queue: When using Polling, ensure the bot manages to process the update queue.

Typical Monetization Niches and TG Bot Business Models

Creating a Telegram bot is not just a technical task but also an opportunity to build a profitable business. Thanks to low infrastructure costs (VPS rental costs pennies compared to potential profit), the entry barrier remains minimal.

Popular Directions in 2024-2025

  • Cashback services and affiliate bots: Automatic issuance of referral links, tracking orders via store APIs.
  • Signals and analytics (Crypto/Stock): Paid subscription for trading recommendations. Minimal latency is critical here.
  • VPN services: The bot as a control panel for purchasing VLESS/Shadowsocks keys.
  • AI assistants: Integration with ChatGPT to solve user tasks (copywriting, translation, code generation).

To analyze marketing effectiveness and user behavior within the bot, standard Telegram statistics are not enough. We recommend implementing deep analytics tools such as self-hosted PostHog or Umami to understand at which stage of the funnel customers drop off.

Performance Optimization: Webhooks vs. Long Polling

At low loads (up to 50-100 messages per minute), the Long Polling method works perfectly. However, for a serious telegram bot hosting project, switching to Webhooks is mandatory. This allows the Telegram server itself to send data to your VPS when a new event occurs.

Setting up Webhooks with Nginx

To work with Webhooks, you will need an SSL certificate (free from Let's Encrypt) and an Nginx web server as a Reverse Proxy. This increases security and allows for handling thousands of connections simultaneously.


server {
    listen 443 ssl;
    server_name bot.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/bot.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/bot.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Using Webhooks reduces CPU load because the bot doesn't need to constantly "poll" Telegram servers. This frees up resources for more complex tasks, such as processing transactions or interacting with a blockchain.

Data Security and Server Protection

When your bot starts accepting payments or storing users' personal data, security becomes a top priority. VPS provides all the tools to create a secure perimeter.

Basic security measures checklist:

  • Disable password login: Use only SSH keys.
  • Configure Firewall (UFW): Close all ports except 22 (SSH), 80/443 (HTTP/HTTPS).
  • Regular backups: Set up automatic database copying to external storage or another VPS.
  • Hide the token: Never store the bot token in the code. Use environment variables or .env files.

For storing passwords and development team secret keys, self-hosted Vaultwarden is ideal, which can be deployed on the same server in a Docker container.

Conclusions

To launch a reliable Telegram bot 24/7, a VPS with 2 GB of RAM and a processor from 3 GHz running on the aiogram 3 stack under systemd is best. This configuration will provide scalability up to 10-15 thousand active users and allow for easy integration of additional monitoring and analytics services.

Ready to choose a server?

VPS and dedicated servers in 72+ countries with instant activation and full root access.

Start now →

Share this post:

support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.