A lightweight Utility to convert your AWS EC2 instance into an On-demand server for your Discord community within minutes.
- Easy setup - convert your AWS EC2 instance into an On-demand server for your Discord community within minutes.
- Auto shutdown support when no one is online.
- Low cost (≈75 cents for 20 hr play/month with a t3.large spot instances).
Supported Discord Commands:
/start: Launch the server and post the IP address in the Discord channel/stop: Manually stop the server
AWS-OnDemand-Server-Discord-Interaction is based on CDK, given configurations, the setup script will set up all required environments (e.g. AWS CLI, CDK, and Python env), grab the EC2 instance ID and deploy a CloudFormation stack that contains all the Lambdas resources needed to convert the EC2 instance into an on-demand server controlled by Discord BOT.
An EC2 server instance on your AWS Account (preferably running Ubuntu Server 24.04 LTS with > 4GB RAM and > 8GB storage)
If haven't, here are some Guides & Tips for Launching an AWS EC2 Instance for Your Server.
- Create a new application on the Discord Developer Portal
- Navigate to the
OAuth2tab - In
OAuth2 URL Generator, selectapplications.commands - Copy the generated URL, paste it into the Discord App, and click it to add the BOT to your Discord server.
-
Clone this project:
git clone https://github.com/yxliaoyx/AWS-OnDemand-Server-Discord-Interaction.git
-
Update
config.inito include the following:STACK_NAME: CloudFormation Stack nameAPPLICATION_IDandAPPLICATION_PUBLIC_KEYcan be found in theGeneral Informationtab of your Discord ApplicationDISCORD_BOT_TOKENcan be found in theBottab. If you can't view the token, clickReset Tokento generate one.
Example
config.iniformat:[AWS] STACK_NAME = DemoStack [DISCORD] APPLICATION_ID = 1234567890 APPLICATION_PUBLIC_KEY = 1a2b3c4d5e6f7g8h9i0j BOT_TOKEN = A1B2C3D4E5F6G7H8I9J0K -
Run the installation script in the project folder:
cd AWS-OnDemand-Server-Discord-Interaction sudo /bin/bash install.sh -
When finished environment setup (5~10 minutes), it will prompt to set up the AWS CLI with Access Key:
- Go to IAM => Users => Create User
- In Permission Options, select
Attach policies directly - Click "Create Policy", this will open a new tab
- Copy and paste these policies JSON into to the Policy editor in the JSON view
- Navigate back to the Create User tab, click refresh, select the policies just created, then create the user.
- Select the user just created, Security Credentials => Create Access Key (Use case: "Command Line Interface")
- Copy the "Access key" and "Secret access key"
-
After setting up Access Key, AWS-OnDemand-Server-Discord-Interaction will start deploying the CloudFormation stack via CDK. When done,
DiscordInteractionUrlwill be printed to the console, copy and paste it to theInteractions Endpoint URLfield in theGeneral Informationtab of your Discord Application.- You can also grab the
DiscordInteractionUrlfromCloudFormation/<StackName>/Outputstab.
- You can also grab the
-
You are all set.Try typing
/startor/stopcommand in your Discord server to give it a try!
This project is inspired by MineCloud.
