Using Amazon EC2 Linux for Vanilla Minecraft Server

Minecraft screen shot

(Hey, I closed comments on my posts, but if you have follow-up questions about this, please contact me directly!)

After months of begging, I finally caved in to my seven-year-old’s pleading to install a Minecraft server for her to use with her friends. Not only was I prompted by the challenge, but I also wanted an environment for the kids that I could keep an eye on (plus the endless begging wore me down, obviously). Originally, I was going to build a FreeNAS box and host it there, but a colleague at work suggested Amazon Web Services as a scalable, but easier alternative. While getting your own hardware is not wrong, I have to give a shout-out to Brent who led me to the alternative that (so far) works best for me.

in office using minecraft server
Minecraft Server fun

Setting up the server was pretty straightforward: If you have an Amazon account (basically if you have ever bought any books and/or loot from Amazon) then you can use that to get the server. I used a Linux option which seemed to have Java already installed. I made sure the Linux instance was a t2.small instead of t2.micro to make sure there is enough wiggle room for memory (2GiB vs. 1GiB, although I might need more when the gang starts really hitting it, but this was the minimum even to get it going). Adding more memory changes the public IP because you have to stop and restart it. I also “IP locked” the server as a measure of security as well as whitelisting using the Minecraft admin commands. So really the game is double-locked, including whitelisting.

Once I had the server instance running, I pretty much followed the steps to install PuTTY and WinSCP because I started on Windows OS at first. My goal was to be able to do everything from home, which is a Mac, which I managed to pull off by creating a .pem key from PuTTYgen in the Windows machine and then imported it into Cyberduck. Great video tutorial by Jhonny Fransis on it here, but getting that .pem key is “the key”.

Along the way, I did get a “WARNING: UNPROTECTED PRIVATE KEY FILE!” error when using the Mac Terminal to get access to the server, but that was probably because I had the .pem file sitting in a Dropbox folder. Once I moved a copy to my local machine and pointed to that the error went away.
Now that Minecraft is up and running using the tutorial here, the only three lines to get into the admin section of the Minecraft server are the following in Terminal (NB I changed some details around, but the format is right):

ssh -i /Users/jlalonde/Documents/minecraft/jlalondekeypair.pem ec2-user@ec2-52-67-101-43.us-west-2.compute.amazonaws.com
cd minecraft_folder
java -Xms1G -Xmx2G -jar minecraft_server.1.8.1.jar nogui

Note that not everything is perfect, and I still get booted out, sometimes, but I may increase the memory allocation, because it seems to work well enough that this is probably it. I am sure my test player will enjoy herself trying it out!

Minecraft screen shot
Hey look! An island! And adventure!

Related posts