The cheapest way to run Minecraft on AWS
Wednesday, 15 January 2020
Summary: By taking advantage of AWS spot instances and only running when you need to, you can have a powerful Minecraft server for as little as a couple dollars per month.
I’m happy to share a set of tools we’ve created to run a cheap, personal Minecraft server on AWS! It works like this:
- When you want to play, go to the server status webpage and launch the server.
- Wait for it to start up.
- Connect to the server from Minecraft.
- After you disconnect, the server will automatically shut down after a period of inactivity.
This way, you only pay for the time you play (along with storage costs for your world data). How cheap is it? Based on prices as I’m writing this:
- $0.0324/hr for c5.large instance in us-east-1 (there are cheaper regions available as well).
- $0.10/GB/month for EBS data storage.
- $0.09/GB for outbound bandwidth (budget 100MB/player/hr).
Assuming 4 people play together for 20 hours in the month and the world data is less than 2 GB, that works out to about $1.84. Add in a few more cents for S3, instance EBS, and Lambda, and it’ll end up being about $2.
On top of that, you can set up the server any way you’d like, since you’re running your own Linux box that you can install arbitrary software onto.
Technically, this involves the following components:
- Packer build script and various tools that are baked into an AMI (disk image).
- AWS Lambda/API Gateway web page for checking server status and launching the server.
- A floating EBS volume that contains your world data.
Since the status web page only charges for computation when someone uses it, then the cost when nobody is playing is just a few cents for storage.
So how does this compare to Realms?
Certainly, there’s nothing easier than using Realms, especially with Realms functionality built into the Minecraft client itself. You also know that you have one fixed cost (currently $7.99/month) no matter how big your world is or how often you play.
Realms makes money on the time that you don’t play. A machine powerful enough to run Minecraft that’s used 24/7 for a month will cost much more than the subscription fee. When you’re playing on Realms, they’re losing money. When you’re not playing, or forgot to cancel after you got tired of Minecraft, they’re making money.
You also can’t install mods like CraftBukkit on Realms since you have no access to the underlying machine for a Realms instance. Having access to the machine also enables other things like automatically generating world maps using MinedMap or Overviewer, automated snapshot backups, etc.
Still, most players just want something easy and aren’t worried about $7.99/month. If you’re not interested or willing to fiddle around with AWS and Linux servers, then Realms is still the best option for you.
Get the code and stuff
I should warn that the code is “good enough” for my use, but probably difficult to use for anyone who’s not familiar with AWS. So, pull requests and/or forks are encouraged! Specifically, a CloudFormation template to set up stuff automatically would probably be nice!
Github: https://www.github.com/erjiang/mine-on-demand