Running Minecraft on an EC2 instance

Brett Gillett

A few weeks back, my nephew spent a few days with us to finish his March break. Like many gamers, he spends most of his time in Fortnite, but when he arrived, he reminded me about our AWS Minecraft server from the previous year.

His memory is (much) better than mine, so I had to go digging - but I found the Amazon Machine Image (AMI) we created when we mothballed the Minecraft adventure from the year before. We decided to bring it back to life so we could play and I showed him how to run the AWS CLI commands to do it … yes, this happens when you spend March Break with me.

 aws ec2 run-instances --image-id <ami-id> --instance-type t3.medium --key-name <ec2-keypair-name> --security-group-ids <sg-id> --subnet-id <subnet-id> --profile <cli-profile> --region ca-central-1

After a rather interesting Alexa random question session - another favorite pastime when he visits - our Minecraft server was up and running. We quickly got to work remembering where stuff was and what we had built the year before.

Now, this isn’t just any regular Minecraft server - it has about thirty mods installed, one of which is called ‘Tough as Nails’ and yes, it lived up to its name. So we spent the next three days repeatedly dying and laughing about being killed by bees.

When his visit came to an end, we created a new AMI - he ran the commands - and I had to promise that I wouldn’t delete it so we could play next time he visits.

It was fun, and it made me think about automation. This week, I spent some time building CloudFormation templates and getting the Unified CloudWatch Log agent added to our EC2 instance - isn’t this how you spend your free time?

Here’s what I ended up creating:

Minecraft on AWS

Deployment Notes

Two NAT Gateways?

The VPC where the Minecraft instance resides uses one of our standard VPC templates, which by default, contains two NAT Gateways - one for each Availability Zone (AZ) in the VPC.

You could reduce your costs by removing the NAT Gateway in the second AZ.

Single EC2 Instance?

This is another cost-saving strategy. The Minecraft instance isn’t critical - if it’s not available, then we’ll have to find something else to do. You could wrap this in a ‘steady-state’ auto-scaling group and then use EC2 health checks to recover the instance if it were to fail.

No Security Group on the Network Load Balancer?

Security Groups are not supported by the Network Load Balancer (NLB). The Minecraft instance allows all traffic on the appropriate application port.

Some of you may be wondering why do I care about this. Here’s why - I believe it’s essential to become a continuous learner. By creating these templates, I furthered my knowledge of CloudFormation, and by publishing the templates, our customers can move faster and have some fun along the way. Both of these are essential wins in my book.

If you’re one of our Managed Service customers, the AMI is available, and the templates are available in the Solutions repo. Have fun and let me know what you create!

Brett Gillett


Like what you read? Why not subscribe to the weekly Orbit newsletter and get content before everyone else?