An AWS CDK project to set up an almost free on-demand multiplayer server (Minecraft, Terraria, and more...) for a Discord community in just a few minutes
MIT License
MineCloud is an on-demand multiplayer server hosting solution based on AWS CDK (Cloud Development Kit) that allows users to set up an almost free on-demand game server for a Discord community in just a few minutes. MineCloud supports the following games out of the box:
Don’t see your favorite games? Consider contributing to the list by following the Create and publish your own MineCloud Configuration Packages guides!
mc_start
: Start the server and send the IP address to the Discord channelmc_stop
: Stop the servermc_restart
: Restart the server processmc_backup
: Pause the server and create a backupmc_backup_download
: Get the download link of the latest backupwith 20 hrs play / month
t2.large
spot price) * 20 (hr) ≈ $0.7/monthPlease refer to Spot Instances Pricing and S3 Pricing for more information.
For more details, please check out the wiki page.
Interested in MineCloud? Join our Discord Server!
If you prefer, we have a step-by-step video tutorial ↓
node --version
in the terminal to confirm Node is properly set up. You should see something like this:
v18.xx.x
aws --version
in the terminal to confirm AWS CLI is properly set up. Something like this should show up:
aws-cli/2.10.0 Python/3.11.2 Windows/10 exe/AMD64 prompt/off
Access key
and Secret access key
aws configure
When prompted, enter the Access key
and Secret access key
you got from the last step (and optionally choose the "default AWS region" and "output format")aws sts get-caller-identity
in the terminal to confirm the AWS CLI credentials are set up correctly. Something like this should show up:
{
"UserId": "1234567890",
"Account": "1234567890",
"Arn": "arn:aws:iam::1234567890:xxx"
}
MineCloud x.x.x
), download the corresponding version from the MineCloud release page and unzip it.npm install
"1.19.4 Vanilla.zip"
) into the /minecloud_configs
folder.npm run install-minecloud-config-pack
Successfully installed <Configuration Package Name> configuration package.
MineCloud-Service-Info.ts
and fill in the following fields:
AWS_ACCOUNT_ID
: Click the account name at the top-right corner of your AWS console and copy the Account ID
AWS_REGION
: Pick a region that's closet to you. Some example values are: us-west-2
, ap-northeast-1
or eu-west-2
DISCORD_APP_ID
and DISCORD_PUBLIC_KEY
: Go to Discord Developer Portal and click "New Application" to create a new Discord APP. On the "General Information" page, you will find the App Id and Public Key.DISCORD_BOT_TOKEN
: Go to the "Bot" tab, reset and copy the token
DISCORD_CHANNEL_WEB_HOOK
:
minecloud_configs\MineCloud-Configs.ts
npx cdk list
to make sure the build pass. You should see the stack name being printed:
<Stack Name>
npx cdk bootstrap aws://<AWS_ACCOUNT_ID>/<AWS_REGION>
npx cdk deploy
to deploy the stack./mc_restart
) in the Discord text channel to give it a try🎉!If you have deployed MineCloud more than once, THERE MIGHT BE DANGLING SPOT INSTANCE REQUESTS THAT WILL CONSTANTLY CHARGE YOU. MAKE SURE TO CHECK YOUR EC2 SPOT REQUESTS TAB AND CANCEL THE DANGLING SPOT REQUEST IF THERE'S ANY!!
After Deployment, the server can be managed by SSH terminals and SFTP clients.
MineCloud's working directory is /opt/minecloud
and the game server folder is located at /opt/minecloud/server
.
Different Configuration Packages may have different file-saving locations, please refer to the Configuration Package's homepage for more details.
The server can be connected via SSH, the easiest way to do it is by using the "Connect" button at the top-right of the EC2 instance page on the AWS console. For useful commands, please check out the Useful Linux Commands section on the Wiki.
The game server is running in a Screen session. To interact with the game server:
sudo screen -ls
to list out the screen session, and type sudo screen -r
to enter the sessionCtrl-a Ctrl-d
to exit the session.To manually start/stop the game server:
sudo systemctl stop minecloud.service
cd /opt/minecloud/server
,sudo ./start_server.sh
sudo ./stop_server.sh
sudo systemctl start minecloud.service
Usually, we will want to do this to make sure the server can start up correctly after we've made changes to the server files.
As long as ./start_server.sh
and ./start_server.sh
function properly, MineCloud service can start/stop the game server when the VM start and stop.
To make changes to the server files, connect to your EC2 instance with an SFTP client (ex: WinSCP).
PuTTY Key Generator
)PuTTY Key Generator
and click "Generate". When done, you should see your public key in the "Public key for pasting into OpenSSH authorized_keys" fieldsudo nano .ssh/authorized_keys
to edit. Copy and paste in the public key from the "Public key for pasting into OpenSSH authorized_keys" field as a new line and ctrl+x
to save the file.PuTTY Key Generator
, click "Save private key" to save your private key.You can also use this key to SSH into your server with PuTTY client.
sudo su
to become root user, and run chown -R ec2-user:ec2-user /opt/minecloud/server
to change the owner of the server files to our WinSCP login user.sudo systemctl stop minecloud.service
to pause the MineCloud system service/opt/minecloud/server
and start editing the server and world files.sudo /opt/minecloud/server/start_server.sh
to make sure the server can start properly and run sudo systemctl start minecloud.service
to enable the MineCloud system service again.Key pairs
, click Create key pair
on the top right corner.Create key pair
, your key pair will be downloaded to your /Downloads folder.sudo chmod 400 "name of .pem"
ssh-keygen -y -f "name of .pem"
authorized_keys
using the editor of your choice, eg.sudo nano .ssh/authorized_keys
authorized_keys
. Save and exit.ssh -i "name of .pem" <your instance's username>@<your instance's public ipv4 DNS>
ssh -i SSH_SFTP.pem [email protected]
sudo chown -R ec2-user:ec2-user /opt/minecloud/server
Site Manager
by pressing Ctrl + s
.New Site
, type the name of your server.Protocol
: choose SFTP - SSH File Transfer Protocol
.Host
: paste in the Public ipv4 address
of your instance.Logon Type
: choose Key file
.User
: type in the username of your instance, default is ec2-user
.Key file
: select the pem file.Connect
and you can start transfering files!STACK_NAME
field in minecloud_configs/MineCloud-Configs.ts
.Common questions and troubleshooting can be found in the FAQs & Troubleshooting page. You can also create a question post or ask on Discord if you like.
A star will be appreciated ;) Also, feel free to contribute to the project if you have any thoughts!