Serverless Discord interactions framework for AWS Lambda
Project description
cordless
Build Discord bots that run on AWS Lambda. Discord sends a request, Lambda wakes up, your handler runs, Lambda goes back to sleep. No server to keep alive, no idle cost.
import os
from cordless import Cordless
bot = Cordless(public_key=os.environ.get("DISCORD_PUBLIC_KEY"))
@bot.command("ping", description="Say hello")
async def ping(ctx):
await ctx.send("pong")
handler = bot.handler()
cordless deploy --register
# → https://abc123.execute-api.eu-west-2.amazonaws.com/
Why cordless?
Most Discord bots run as long-lived processes, a VPS or container that sits idle 99% of the time, waiting for someone to type a command. You pay for uptime whether your bot is busy or not.
cordless flips this. Your bot is a Lambda function: it only runs when Discord sends an interaction, takes milliseconds to respond, and costs essentially nothing to host. One command provisions everything on AWS: IAM role, Lambda function, API Gateway endpoint and registers your commands with Discord.
- No server: no EC2, no containers, no uptime monitoring, no SSH
- No idle cost: Lambda charges per invocation, not per hour
- One command to ship:
cordless deployhandles all the AWS wiring - Local dev:
cordless devruns your bot on localhost with a live public tunnel - Slow commands: deferred interactions hand off to a worker Lambda so Discord's 3-second limit is never a problem
Install
uv add "cordless[deploy]" # (we should ALL be using uv)
Quickstart
Scaffold a new bot:
mkdir my-bot && cd my-bot
cordless init my-bot
This creates lambda_function.py, cordless.toml, and .env.example.
Configure your credentials in .env:
DISCORD_PUBLIC_KEY=your_public_key
DISCORD_BOT_TOKEN=your_bot_token
Test locally — cordless dev runs your bot with hot reload. With cloudflared installed it opens a public tunnel so Discord can reach it directly.
cordless dev
Deploy to AWS and register your commands with Discord:
cordless deploy --register
# → https://abc123.execute-api.eu-west-2.amazonaws.com/
Paste the URL into your Discord app's Interactions Endpoint URL and your bot is live.
Documentation
Full docs at cordless.dev — commands, options, buttons, modals, deferred interactions, Components v2, scheduled handlers, and the full deploy reference.
Please note that this is a work in progress, I have found genuine interest in serverless development and wanted an easy way to provision AWS.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cordless-1.0.0rc3.tar.gz.
File metadata
- Download URL: cordless-1.0.0rc3.tar.gz
- Upload date:
- Size: 55.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b32e6253566e6c2114f579e46da545285298dfba75face357b7d9323ea9de873
|
|
| MD5 |
d27f2cb74d8262f9667bf183e9fed90a
|
|
| BLAKE2b-256 |
e75790772072224d4541129279afc62b067025611634b3c033a760a53031190e
|
File details
Details for the file cordless-1.0.0rc3-py3-none-any.whl.
File metadata
- Download URL: cordless-1.0.0rc3-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63ec8ec32a9aa2289af09d37ec42231df22ef0f0caa0b9917de1456f5ec3f3b7
|
|
| MD5 |
7f03fd722872c5f4c2002ac57dbf3dbd
|
|
| BLAKE2b-256 |
59cdfb8af14a8e7300ae9def503feb94a4ed717039edf012ce512817769f97ca
|