Free Discord Bot? Say Less.
We like having Discord bots to automate things. Nobody wants to deal with hosting them. Or worse, some people run them from their home network (nah). In this post, part of my ongoing free cloud infrastructure series, I’ll show you how I host a Discord bot that manages my FoundryVTT game server all for free using Google Cloud Run.
Cloud Run pricing sounds simple until you read the fine print1. Every request, every compute tick, every megabyte counts.
Here’s the deal: Cloud Run charges by request count, vCPU-seconds, and memory-seconds. The free tier includes 180,000 vCPU-seconds, 360,000 GiB-seconds, and 2 million requests per month at the time of writing this post. For a lightweight Discord bot used by a small group, this is plenty. The real concern is making sure your service doesn’t get randomly hit by the public internet. Every request counts… even junk traffic. My cloud VM (which runs the Foundry server) just has to stay under the 1 GB egress cap, and we can leverage that as part of the design.
The problem: Public exposure means risk. If someone decides to curl
your Cloud Run endpoint 10,000 times, that’s money. Cloudflare can help with rate limiting and caching, but it doesn’t block everything.
The solution: Don’t expose Cloud Run directly.
Instead, I proxy all bot traffic through my Foundry host. That server already lives in the cloud, and already has protection in place. I run a small custom proxy there that does two things:
- Hard rate-limits incoming traffic
- Only forwards valid bot requests to the Cloud Run service
If someone really wants to DoS my bot, fine. The proxy can throttle it or go down without consequence. Better that than waking up to a billing alert for something that was supposed to be free.
The Foundry server sticks around regardless, so it’s the perfect traffic filter. Normally I would use Caddy for the proxy for this, but I opted to use a custom go proxy instead for fine tune, very niche control over my domain.
Flow:
Cloudflare → FoundryHost (custom proxy with strict rate limit) → Cloud Run service

As covered in previous posts: my Foundry server runs IPv6-only. Cloudflare proxies incoming IPv4 traffic, so clients don’t know the difference. But internally, the proxy must resolve the IPv6 address of the Cloud Run service, and the Discord bot must listen on an IPv6 interface. That’s the price of squatting in the cloud. No public IPv4, no budget hits.
All of this effort,IPv6 routing, strict egress control.. just to save a few bucks a month. But that’s the point. I want a personal site, a game server, and a Discord bot… all hosted in the cloud, for free, without touching my home network.
We do it for the love of the game.
-
https://cloud.google.com/run/pricing?hl=en ↩