This project attempts to make an easy to use Minecraft server on demand using Terraform and AWS.
When applied, it will create a modest (but can be configured to be more powerful) EC2 instance within minutes which you can then use to host a multiplayer Minecraft server.
In order to keep costs down, the server will automatically self-terminate after 30 minutes of inactivity. ("Inactivity" meaning no players are connected to the server.)
To further reduce costs, the world data is backed up to S3 just prior to termination... and restored from S3 when the Terraform is reapplied. (Just re-apply the Terraform to spin the server back up.)
Downtime costs for the server should be very low, since you're only paying for a few megabytes of S3 storage space.
Uptime costs really just depend on how long your server runs and what size EC2 instance you choose.
- An AWS account.
- A usable domain registered via Route53.
- Terraform v1.0 or higher
- Properly configured
~/.aws/config
and~/.aws/credentials
files.
Usage of AWS + Terraform is beyond the scope of this README.
Usage of SSH is also beyond the scope of this README.
- Clone this repo.
- Use
notsketchy.auto.tfvars
as an example and make your ownsomething.auto.tfvars
with your own preferences. terraform init
terraform plan -var-file=something.auto.tfvars
terraform apply
This should create the following:
- EC2 instance running Ubuntu + Minecraft server
- S3 bucket for storing your Minecraft server world data backups
- Route53 record for your server.
- The default username when ssh'ing into your server is ubuntu
Using the notsketchy.auto.tfvars
example:
- It creates a server at mc.notsketchy.click
- It is only ssh accessible from the
allow_ssh_cidr
IP address - It is only ssh accessible with the private key that matches
public_key_file
- SSH via
ssh -i ~/.ssh/id_ed25519 [email protected]
- Backup will be at
s3://mcserver{random suffix}/mcserver/backup.tgz
- S3 bucket is set to use versioning, in case of corrupted backup.