July 24, 2014 · gaming minecraft technical

How to run a Minecraft server on Amazon EC2

I originally published this article on minecraftforum.net. This draft is revised for 2014, since Amazon updated their offerings.

This is an easy way to get a Minecraft server running 24 hours a day. It may not be the most cost-effective method - watch your Amazon bills! - but it's a great way to get familiar with EC2.

You will need some basic Linux ability for this guide.

Server facts

Let's create a server

This is really straightforward.

  1. Sign up for an account at http://aws.amazon.com/ and give them a payment method. There is no fixed charge for EC2 servers: you pay for what you use.
    • If you're sure you want to keep the server for a long time, a Reserved instance works out way cheaper.
  2. Navigate to the Amazon EC2 tab. This may take a minute or two to become active if you've just signed up. You will see that you have no instances, and the page will prompt you to Launch Instance.
  3. Hit the Launch Instance button to see a list of the possible server types. We're going to choose the first option on the list, Amazon Linux AMI (HVM).
    • This image uses EBS, which is independent storage. The alternative is 'Instance Store' which is less flexible.
  4. Now we Choose an Instance Type: we want a t2.small. To move on, hit Next: Configure Instance Details.
    • Micro instances are cheap, but they have some pretty crazy CPU throttling. Not recommended.
  5. On the Configure Instance Details page, we don't need to mess with anything. Hit Next: Add Storage.
  6. Under Volume Type, you can choose between Magnetic and General Purpose (SSD). Storage is pretty cheap (less than a dollar per month for 8GB) so go for General Purpose (SSD). Now Next: Tag instance.
    • Notice you can choose the space available here. Default 8GB is fine.
  7. Tag instance: we can ignore this since we only have one server to worry about. Hit Next: Configure Security Group.
  8. Configure Security Group: This is your firewall policy. It's a set of Rules which dictate who is allowed to connect to the server. We need to open a Minecraft port to allow players to connect.
    1. Let's Create a new security group and go with:
      • Security group name: minecraft-security
      • Description: Ports for Minecraft
    2. You'll see an existing Rule for SSH. We need a new one for Minecraft. Hit Add Rule and go with:
      • Custom TCP Rule
      • Port Range: 25565
      • Source: Anywhere
      • If you want to run with a non-standard port (to improve security), use that port here instead of 25565.
    3. Finally Review and Launch.
  9. The Review Instance Launch panel will summarise our options and warn us about security, since we're not limiting where SSH connections come from. This is fine for now: hit Launch.
  10. Now you'll get prompted for a Key pair, which you'll use to log into EC2 servers. On the dropdown, Create a new key pair and call it something sensible like my-key. Finally Download Key Pair.
    • You'll download a file with the extension .pem, e.g. my-key.pem. This is what you'll use to log in later. Hit Launch instances and then View instances.
    • Keys are important, because EC2 servers do not use passwords to log in! Instead you have a private key file stored on your local computer, which is used to authenticate.

You should now see your running instance listed - congratulations, you just created a server! Click on it to get details in the lower pane.

Observe your new Public IP: Players will need this to connect.

Let's log in

I'm going to assume you're using PuTTY on Windows.

  1. Open PuttyGen. We're going to convert the private key that Amazon gave us (.pem) into a Putty key (.ppk).
    • Hit Load, select the .pem key - you might need to filter 'All Files' in the dialog - and then hit Save private key to save it as a .ppk file.
    • Now you can close PuttyGen.
  2. Open Putty - we're going to configure a new Session. In the Host Name, enter ec2-user@your-Public-IP. e.g. ec2-user@
  3. Next look in SSH -> Auth. Use the Browse button to select your new .ppk file.
  4. Now back to the Session tab - give your session a name in the 'Saved Sessions' text area (e.g. 'EC2 minecraft') and hit Save.
  5. Finally hit Open to try and connect.
    • You will need to hit Yes when prompted to confirm you're connecting to a new server.
    • Putty will automatically try to log in as ec2-user (because you put the user prefix on the URL). Then it will present the key file which means no password is needed. You should be in!
    • If for some reason the automatic login doesn't work, enter your username as ec2-user.

At this point you have everything you need - a working server and shell access.

What now?

You should be logged into the ec2-user home directory, with 8GB of storage to play with.

First up, this is a good time to update the packages on your server with sudo yum -y update.

To verify java is working, try java -version.

Go ahead and install Minecraft in this directory. There are many other guides to help you at this point. At minimum you need to wget the server jar and run it with java -jar some-minecraft.jar.

If you're not afraid of more techie stuff, I wrote a followup article on how to get started with a tool called Minecraft Server Manager.

Things to know

You never log in as root, but always ec2-user. If you need to run something as root, prefix the command with sudo. e.g. sudo yum install foo to install the 'foo' utility.

Get notified when I post

Comments powered by Disqus