Dec 31, 2015

Installing a Minecraft server on AWS

This one is for all the kids (and geek dads & moms) out there. I'm surprised I didn't get to write this sooner :)

Running your own Minecraft server in AWS is pretty straightforward, so here goes!

1) Create an EC2 instance

I've picked a t2.small instance (2 GB RAM) running the Amazon Linux AMI and costing $0.028 per hour at the time of writing. Anything smaller feels... small for a complex Java app, but you're welcome to try. Details and pricing for EC2 instances may be found here.

Only the security group needs to be tweaked: on top of SSH access, you also need to open a port for the server (default port is 25565). If you want to play with friends (which is kind of the point), allow access from anywhere.

Your inbound rules should look like this:

Select a key pair and launch your instance.

2) Install the Minecraft server

Once you ssh'ed into your instance, it's time to select a Minecraft version. Let's retrieve the list (conveniently hosted in S3) :

$ wget https://s3.amazonaws.com/Minecraft.Download/versions/versions.json

My customer (ok, my son) wants to run 1.8.9, so let's download and extract this version:

$ mkdir minecraft
$ cd minecraft
$ wget http://s3.amazonaws.com/Minecraft.Download/versions/1.8.9/minecraft_server.1.8.9.jar

3) Configure the Minecraft server

Start it once:

$ java -jar minecraft_server.1.8.9.jar

It will fail and complain about approving the user agreement (bleh). All you need to do is to edit the eula.txt file:

eula=true

Feel free to edit the server.properties file to add your favorite settings.

 4) Start the Minecraft server

The best way to start a long-running server without losing access to the console is to use screen. Here is a simple tutorial.

$ sudo yum install screen -y
$ screen java -jar minecraft_server.1.8.9.jar

Your server is running, congratulations. You should be able to connect to it using the Minecraft client.

In the console, you will see players joining and leaving the game, as well as their UUID, e.g.:

[17:08:11] [User Authenticator #1/INFO]: UUID of player _____Dante_____ is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

This UUID is useful to declare players as operators in ops.json:

$ cat ops.json
[
  {
    "uuid": "
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "name": "_____Dante_____",
    "level": 4
  }

]

That's it. Don't forget to detach from your server before ending your SSH session, or it will be killed (hint: CTRL-A D). And don't forget to stop the instance when you're not playing, it will save you money :)

Have a nice game and happy New Year!

Dec 27, 2015

A silly little script for Amazon Redshift

One of the great things about Amazon Redshift is that it's based on PostgreSQL. Hence, our favorite PostgreSQL tools can be used, notably psql. However, building and typing the full connection chain to a Redshift cluster is a bit of a drag.

So, here's a simple script (source on Github) for the lazy ones among us. It simply requires a cluster name, a database name and a user name. You will be prompted for a password, unless you have a matching entry in your .pgpass file. As a bonus, your connection will be SSL-enabled. Ain't life grand?


Dec 17, 2015

Amazon ECS @ Docker meetups

Here are my slides on Amazon ECS, which I had the pleasure to present at the Docker meetups in Marseille and Bordeaux. Thanks guys, I had a great time :)

Dec 10, 2015

A silly little script for Amazon ECS

I'm currently spending a lot of time playing with Amazon ECS and Docker.

The ecs-cli tool is very convenient to manage clusters and tasks, but I needed a few extra things (as always) and crammed them into the ecs-find script.

Hopefully, this might come in handy for you too :)

Dec 2, 2015

Upcoming meetup: Docker Paris, December 15

Amazon Web Services is now the official sponsor of the Docker Paris meetup :)

I'll be present at each event to keep the Docker community updated on the latest AWS news, especially on ECS and Lambda. See you there !