Building a Serverless Discord Bot on AWS

Gerald McAlister
10 min readMar 23, 2021

--

Discord is a pretty exciting platform. One of it’s biggest features is the ability to support bots on the platform, letting developers create some incredible tools for server moderators. In 2020, Discord introduced two major new features however, that don’t have a ton of example use cases around them yet: Slash Commands and Interactions Endpoints. These two things are incredibly powerful, and with today’s post I want to go ahead and take a deep dive in how you can use Interactions Endpoints to build an entirely serverless Discord bot.

If you don’t want to read through this and instead want to jump straight into the code, you can see the full repository for this here (with a corresponding NPM package available at https://www.npmjs.com/package/discord-bot-cdk-construct). Otherwise, read on for a full explanation of how the code works!

Why Serverless?

I’m not going to regurgitate what a serverless architecture is yet again (Google that if you are unfamiliar with it), but I do want to go over the benefits of it, especially in the context of building a Discord bot. Severless architectures generally provide two major benefits over traditional server architectures: High scalability and low costs. The low costs generally comes from the fact that you only pay for what you use, and the high scalability generally comes from…

--

--

Gerald McAlister
Gerald McAlister

Written by Gerald McAlister

Software engineer, hardware tinkerer, focused on VR, AR, AI, & Web3. I write about whatever crosses my mind, but try to focus on business vs tech vs philosophy.

Responses (3)