Creating a Minecraft server in under three minutes with Terraform
Last post I talked about how I created a server in a Terraform with its own VPC, well I may have taken that step just a little but further.
When I made a post about how to get practical experience in Google Cloud I got an idea that I should try create the Minecraft server I made manually and create it via Terraform, and the result is fantastic.
So here is the Google Cloud guide I used as reference.
So not only does it create all the services and firewall rules, it also has a startup script that pulls and sets up the server, check out the startup script section below. startup-script = <<SCRIPT mkdir -p /home/minecraft mkfs.ext4 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-minecraft-disk mount -o discard,defaults /dev/disk/by-id/google-minecraft-disk /home/minecraft apt-get update apt-get install -y default-jre-headless cd /home/minecraft wget https://launcher.mojang.com/v1/objects/3dc3d84a581f14691199cf6831b71ed1296a9fdf/server.jar java -Xms1G -Xmx3G -d64 -jar server.jar nogui sed -i ‘s/false/true/g’ eula.txt java -Xms1G -Xmx3G -d64 -jar server.jar nogui SCRIPT
So let’s check this out in action, and also here is the link to my Github for this.