Skip to main content

Mike Kreuzer

DadOps: a Minecraft Java server

10 May 2022

DadOps: where I get to play with software with my kids, which is without a doubt my favourite part of all of this.

This week's DadOps adventure was setting up a Minecraft Java server, one that was also playable by my kids' friends, but without breaking the bank.

I set up a VPC on AWS, with public & private zones (public zones being where the boxes with public IP addresses go, private zones for those without), putting the Minecraft server in the private zone. That setup hides the server away, but means a jump box in the public zone so I can SSH in to the Minecraft box, a NAT box for traffic going out from the Minecraft box, & an NLB for port 55… 5-whatever-Minecraft-uses. (I have to look it up every single time. 25565.) All of which could get expensive if I used AWS's managed NAT for example, or left the boxes turned on when the kids weren't playing.

Scripting to the rescue.

I got to play with the AWS CDK again, as a replacement for me for Terraform. The CDK & Terraform both have their advantages, but the standout advantage of the CDK for me is I'm not using yet another language. The sooner I never have to think about HCL again the better, I think.

I used an EC2 nano for the NAT box, rather than the high availability managed (expensive) alternative, so I can just turn it off when it's not needed. I have to set up the IP tables each time the boxes are turned on but that's just a bash script, a small price to pay. I set up the NLB in its own CDK/CloudFormation stack so I can tear that down too, using an elastic IP address so I can keep the address the same for the kids. Having an unattached elastic IP address when the NLB's not there costs ten times less than leaving the NLB up & running all month.

All of this is orchestrated by a few Javascript functions in a Jerbs script, jerbs minecraft start and the fun begins.

Once I've used them in anger a few more times I'll clean up the CDK and Jerbs scripts & put them up on Github.

In the meantime happy crafting, & don't mine at night.