A set of scripts for running a minecraft server on AWS spot instances.
This repository provides a way to create a cloudformation stack which creates:
You must have an AWS account. On your computer, make sure that you have the AWS cli installed and have configured it to use the credentials for the aforementioned account by default. Currently, the helper scripts don't support using other profiles, but that's trivially easy for you to add if you know what you are doing.
Make sure that you create an EC2 Key Pair for logging into the ec2 instance running the server.
parameters.sample.json
to parameters.json
and edit the values accordingly.ServerFilename
- the name of the minecraft server that you downloaded from mojang (or whatever you renamed it to)BucketName
- whatever you want to name your new s3 bucketServerName
- some arbitrary, alphanumeric name for your serverInstanceType
- the EC2 instance type which you want to provision and run your minecraft server onOperatorEMail
- your email address. This is used to notify you of autoscaling operations.KeyName
- This is the name of the EC2 Key Pair that you created as a prerequisite.SSHLocation
- This is the ip address of your home. It is used in a hacky way to lock down ssh access to just you.SpotBid
- The maximum amount of money that you are willing to pay for the ec2 instance, per hour. This does not account for all costs which will be incurred by the infrastructure created by using these scripts. Please see AWS documentation and read the code in this repository for details.Run create-stack.sh
(located in the helpers
directory) to create the s3 bucket.
Run upload-scripts.sh
to upload the bootstrap and subsystem scripts to the bucket.
Upload the server file that you downloaded from Mojang to the bucket you specified in parameters.json
. It should be placed in the /common/servers/
directory.
Upload any relevant minecraft configs to the bucket under /servers/YOUR_SERVER_NAME/configs
. You must confirm the acceptance of the minecraft server eula by placing a properly configured eula.txt
in that directory in order for the server to start.
Run update-stack.sh
to update the existing stack and build a server.
Lookup the elastic IP that was created in the AWS console. You may use this to connect to your server.
If at any time, you want to delete the stack that you created, run delete-stack.sh
. This does not guarantee that all resources will be deleted in AWS. You will need to do your due diligence to make sure that they are.
Pull requests welcome!