cordless
Build a production Discord bot without running a bot server. Discord sends a request, AWS Lambda wakes up, your handler runs, and it goes back to sleep. No process to keep alive, no idle cost.
import os
from cordless import Cordless
bot = Cordless(public_key=os.environ["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.lambda-url.us-east-1.on.aws/
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, public endpoint (a direct Function URL by default, or API Gateway if you want a custom domain) 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
- Full REST API: every Discord endpoint, typed, reachable as
bot.<verb>()or directly on the objects you already have (guild.create_channel(),message.reply()) - Raw HTTP routes:
@bot.route("POST", "/stripe/webhook")handles third-party webhooks, OAuth callbacks and health checks on the same function, outside Discord's interaction flow
Install
uv add cordless # (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.lambda-url.us-east-1.on.aws/
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, the REST API, 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.
Metadata
Release files for cordless 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cordless-1.5.1.tar.gz | 217.2 kB | Without provenance | Details for cordless-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cordless-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for cordless-1.5.1-py3-none-any.whl |
Total release size: 365.7 kB
Release files / cordless-1.5.1.tar.gz
| Download URL | cordless-1.5.1.tar.gz |
|---|---|
| Size | 217.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce39ecb66dd1b13ee45582ca449e8a93887ac3bd333e90b3481a6302d58eb1d7
|
|
BLAKE2b-256 checksum How to use checksums |
58e9895227cbc7a9a7962d1a3664246b16bce626d649acd5c93ac3d75671e189
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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}
|
Release files / cordless-1.5.1-py3-none-any.whl
| Download URL | cordless-1.5.1-py3-none-any.whl |
|---|---|
| Size | 148.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef3ca2e1c70b596276f8bdf055174fa2bd10b2016999f169e29eaa48149a75f0
|
|
BLAKE2b-256 checksum How to use checksums |
1137ac882d0c4d1ba4dbdd212da74e7ebe0a6115824ab2cdd3bbad8f5818a361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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}
|
Security for cordless 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.