Outside of work, you may well already be using a Cloud based service, for example to back up photos, videos and important documents. If you are, the chances are it’s just one of the many file repository/backup services available. You may not have considered that a Cloud based “instance” (i.e. virtual machine) could be of any use to you outside of your work-related activities. I had not envisaged using an instance to meet a family related requirement. However, thanks to the popularity of a certain computer game, I have since discovered a good use case for a Cloud based instance (or even multiple ones). I have two daughters who are both crazy about this:
“They’re not alone!”, I hear you exclaim, as this affliction seems to be quite common these days… They were happy for a while playing in their own “worlds” (for the unitiated, in Minecraft a “world” is a game environment – you can create as many as you want). The next stage was to play with/against each other across the wlan. This is simple and even my 9 year old can configure this without my help (yes, she now knows what an IP address is!). Before too long, however, they wanted their friends to be able to join in from their respective homes. This would mean running the Minecraft server from home and would be much like running a web server from home inasmuch as it would require such things as: -A computer to run the server program on -Port forwarding on your router -a static public IP address or a DNS service such as DynDNS -Decent broadband upload speeds I only had to think about this for a few seconds before I concluded that this would be much better served by spinning up an instance with a Cloud based provider such as Amazon EC2, Google Compute Engine (GCE) or Microsoft Azure. I have since set up two such servers, one on EC2 and one on GCE and the rest of this article provides some guidance on how to do it using the particular providers. Of course, Azure (and others) could also be used equally well so please don’t take this as any sort of recommendation regarding which provider you should use 🙂 The steps below assume some familiarity with the Amazon and Google consoles. Note that Minecraft server runs on both Linux and Windows. Here, I will focus only on using a Windows (Server) instance. Step 1. For the first step, I suggest that you first create a “Security Group” (for EC2) or a couple of firewall rules (for GCE). These should allow TCP 3389 for RDP access to the server and TCP 25565 for Minecraft itself. The screenshots below show a suitably configured AWS Security Group and the equivalent configuration for GCE. Step 2 Next you can configure and launch an instance. I would advise against selecting the smallest instance available, which will typically have 1GB or less of RAM. This is not enough to run Windows Server on its own, let alone Minecraft server as well. A 1 vCPU instance should suffice but I’d recommend 4GB of RAM or thereabouts. You may find (depending on the choice of instances available) that by choosing one with 4GB, you’ve had to choose one with 2 vCPUs anyway. Here’s an example of available AWS instances. In this case, I’ve chosen the “t2.medium” one: And, for GCE, the “n1-standard-1” instance type has been selected: Select a Windows Server image, running either Windows Server 2008 R2 or 2012 R2. I used 2008 R2 but either should work. If using an EC2 instance, be sure to link it to the previously created Security Group. With GCE, as long as you’re creating the instance in the same Project and Network as the firewall rules, you’ll be good to go. Step 3 Once your instance is up and running, you should be able to RDP to it using the credentials supplied at the time of creation. Although we opened port 25565 in a previous step, this will only allow ingress at the perimeter to your Cloud network. You’ll also need to configure the Windows firewall to allow that port into the server. Port 3389 should be allowed by default on the Windows firewall. This shows the inbound Windows firewall rule for Minecraft server (all other options on the rule wizard are the default ones): Step 4 The next step is to create a folder on the C: drive and to download the Minecraft server executable to it. This software is free so you don’t have to worry about any licensing. You’ll also need to install the latest version of Java. Using the “Run as administrator” option, run the program. It will create a couple of files and a “logs” directory. Although the server console will appear, it’s not actually running properly yet so just close it at this point. This is what the Minecraft server looks like when it’s running: Note that when users are connected, their IDs will show up in the “Players” pane. Step 5 Open the eula.txt file and change the line “eula=false” to “eula=true”. You’ll also need to do this with administrator permissions. Step 6 Run the server executable again, as administrator. This time, it will create some more files and a “world” folder. Step 7 Close the server again and upload to the “world” folder the files pertaining to the world you or your offspring want to play when connected to the server. The file structure of a world should look something like this: Step 8 Run the server executable again, as administrator. Step 9 At this point, you will probably want to allocate an Elastic IP (for EC2) or a Static IP (GCE) to the instance. Otherwise, the Minecraft launcher will have to be reconfigured every time the instance is started and gets a new public IP address. This is what a static IP looks like in GCE: As you can see, it’s allocated to the Minecraft Server instance: Step 10 You should now be able to configure the Minecraft launcher (using the Multiplayer -> Add Server menu option) to connect to your instance. Happy Gaming! Tips
- You probably won’t want to keep the instance running 24×7 otherwise it could get rather expensive. But then, you probably don’t want your kids being able to play with their friends 24×7 anyway!
- It’s a good idea to configure the server to autologon and run the Minecraft server program automatically. A task scheduled to run “When I logon” and with the “Run with highest privileges” can achieve this in conjunction with autologon.
- I like the EC2 option because the availability of an Android app for AWS means that it’s really easy to start the instance wherever you are. So when you’re out shopping and you get that urgent call from your little darling asking for the server to be turned on, you can oblige with the minimum of effort. Granted, using the GCE web UI from a smartphone is not particularly hard either.
- Each instance of Minecraft server can only run one world at a time. Switching between worlds would mean stopping the server, swapping over the contents of the world folder and restarting the server. I have actually configured two instances, one on EC2 and one on GCE and they run different worlds. So the little darlings can choose which one to connect to depending on which world they want to wreak havoc…..sorry…..play, in.