Reimagine The Good Place (or The Bad Place) in Minecraft. Become your own architect and manifest a world where it's your way or the highway. Design a server for who you want no matter what Chidi says is 'ethical' or not.
An AWS-hosted Minecraft server that you only pay for when it's being used. Minecraft Architect utilizes AWS EC2 and Heroku to start the server at will and automatically shut it down when idle. This project is based on/adapted from trevor/OnDemandMinecraft and utilizes alternative methods of server startup and cron jobs.
- Amazon AWS Account
- Familiarity with SSH, Linux, AWS, and Git
- Cloned this repository
- IAM User
- Go to the
IAM Management Console
, selectUsers
on the left andAdd user
- Create a username and select the
Programmatic Access
box - Assign the user to a new group with
AmazonEC2FullAccess
- Continue through the new user wizard and create user (no further configuration is vital at this point)
- Take note of the
Access key ID
andSecret access key
- these will be used later
- Go to the
- EC2 Key Pair
- Go to the
EC2 Management Console
, selectKey Pairs
underNetwork & Security
in the left sidebar - Select
Create Key Pair
and name it as desired - Save the resulting
.pem
file - this should prompt you automatically
- Go to the
- CloudFormation (the magic)
- Go to
CloudFormation
, selectCreate stack
and continue with thewith new resources (standard)
option - Use the
Upload a template file
option and upload theinstance/infrastructure.yaml
file in this respository - Follow the construction wizard (see tips below)
- When choosing your AMI, you will need to select one in your current AWS region, with amd64 Arch type, hvm:ebs instance type, and I suggest Ubuntu 16.04 or above in order to have Java 8 available to you. This filter
us-east-2 amd64 hvm:ebs
will help narrow down your options (note you must change the region) - Your instance type will be trial and error and will change the running costs of the server. I use a
t3.small
size with a 20 person server but have not yet reached capacity. See instance specs here https://aws.amazon.com/ec2/instance-types/t3/ - The key name is the name of our key pair created in the last section. This should appear in the drop down menu automatically.
- If you would like anyone to SSH into your instance, leave the SSHLocation as is. If not, place your IP in this location. You must include a range. If your IP is
192.168.1.1
(this will never be your IP), put192.168.1.1/1
- When choosing your AMI, you will need to select one in your current AWS region, with amd64 Arch type, hvm:ebs instance type, and I suggest Ubuntu 16.04 or above in order to have Java 8 available to you. This filter
- Once created, go to the
Resources
tab and take note of the EC2 instancePhysical ID
. We will need this later
- Go to
- You're finished with AWS!
- Copy your EC2 instance's public IP and take note of the location you saved our key pair
.pem
file to. Then, SSH into the EC2 instance withssh ubuntu@{PUBLIC_IP_ADDRESS} -i ./path/to/pem/file
- Having permissions issues due to a 'public key'? Run
chmod 400 ./path/to/pem/file
to fix this
- Having permissions issues due to a 'public key'? Run
- Once connected, let's update our instance
sudo apt-get update
- Run
Java
and Ubuntu should give you a list of available packages. Install openjdk version 8 or above. For example,sudo apt-get install openjdk-8-jre-headless
- Create a /opt folder if it does not already exist
mkdir /opt
- Make the user for our minecraft server
adduser --system --shell /bin/bash --home /opt/minecraft --group minecraft
and create aserver
directory in its homemkdir /opt/minecraft/server
- Go to https://www.minecraft.net/en-us/download/server and find the link to download the latest Minecraft server jar file. Right click and
Copy Link Address
. In your EC2 instance, runwget LINK_ADDRESS -P /opt/minecraft/server
. In my case, this iswget https://launcher.mojang.com/v1/objects/4d1826eebac84847c71a77f9349cc22afd0cf0a1/server.jar -P /opt/minecraft/server
. You should now have aserver.jar
file in your server folder. - Accept the eula by creating a
eula.txt
file witheula=true
as its contents.echo "eula=true" >> /opt/minecraft/server/eula.txt
- Create the SystemD Unit file and set its contents to
/instance/minecraft.service
bytouch /etc/systemd/system/minecraft.service
and editing its contents - Enable the system file
systemctl enable minecraft.service
- Next, copy
instance/autoshutdown.py
andinstance/crontab
to your sudo home directory and runsudo crontab /home/ubuntu/crontab -u ubuntu
. This will enable periodic player count checks and shutdown the server if it is idle for 5 minutes - The server should be available shortly at your server's public IP address on port 25565. View the server status by running
tail /opt/minecraft/server/logs/latest.log
- Create a Heroku account and install the Heroku CLI
- In your project directory, run
heroku create PROJECT_NAME
- Set the configuration variables with those that were noted earlier. Do this by filling in the following command or editing the configuration variables in your Herokuapp dashboard
heroku config:set \ AWS_ACCESS_KEY_ID=awsaccesskey \ AWS_SECRET_ACCESS_KEY=awssecretaccesskey \ INSTANCE_ID=instanceid \ REGION_NAME=regionname \ SERVER_PASSWORD=serverpassword
- Push the project
git push heroku master
- The resulting URL will give you access to start the server