# Serverless DNS driven on-demand Minecraft server with Route53+Fargate+EFS

**URL:** <https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545>\
**Category:** AWS Compute Discussion\
**Tags:** route53, efs, fargate\
**Created:** [September 6, 2021, 11:19pm UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545 "2021-09-06T23:19:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![doctorray](https://awshq.com/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@doctorray](https://awshq.com/u/doctorray)\
**Post date:** [September 6, 2021, 11:19pm UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/1 "2021-09-06T23:19:57Z")

</div>

Serverless DNS driven on-demand Minecraft server with Route53+Fargate+EFS

[https://github.com/doctorray117/minecraft-ondemand](https://github.com/doctorray117/minecraft-ondemand)

---

<div class="post-metadata">

**Author:** ![doctorray](https://awshq.com/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@doctorray](https://awshq.com/u/doctorray)\
**Post date:** [September 6, 2021, 11:25pm UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/2 "2021-09-06T23:25:26Z")

</div>

This is a tutorial I’ve put together for self-hosting a Minecraft server in a completely serverless environment using EFS for persistent storage. It’s designed to start up with a simple DNS query which means you just need to open Minecraft, wait about a minute, then refresh and the server will be online and ready. There’s a companion container that shuts it down when not in use and can also send texts through Twilio when the server is ready to go.

There’s other on-demand style minecraft server systems out there but they usually require some sort of special action to turn them on. This implementation is designed to be more automatic. I think it’s an interesting use case of the AWS stack and I wanted to share it. Thank you and enjoy.

---

<div class="post-metadata">

**Author:** ![unseenspecter](https://awshq.com/letter_avatar_proxy/v4/letter/u/b2d939/32.png) [@unseenspecter](https://awshq.com/u/unseenspecter)\
**Post date:** [September 7, 2021, 12:04am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/3 "2021-09-07T00:04:23Z")

</div>

> [@doctorray](#):
>
> This is a tutorial I’ve put together for self-hosting a Minecraft server in a completely serverless environment using EFS for persistent storage. It’s designed to start up with a simple DNS query which means you just …

Just out of curiosity, what’s the costs look like for a build like this?

EDIT: nevermind, I see it on the GH notes.

---

<div class="post-metadata">

**Author:** ![doctorray](https://awshq.com/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@doctorray](https://awshq.com/u/doctorray)\
**Post date:** [September 7, 2021, 12:11am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/4 "2021-09-07T00:11:11Z")

</div>

> [@unseenspecter](#):
>
> Just out of curiosity, what’s the costs look like for a build like this? EDIT: nevermind, I see it on the GH notes.

No worries. For quick visibility for anyone else.. about $0.50/mo for the Route53 hosted DNS zone, and basically free / pennies when it’s idle, and between 2 and 6 cents an hour when running depending on whether using spot or regular Fargate respectively.

---

<div class="post-metadata">

**Author:** ![unseenspecter](https://awshq.com/letter_avatar_proxy/v4/letter/u/b2d939/32.png) [@unseenspecter](https://awshq.com/u/unseenspecter)\
**Post date:** [September 7, 2021, 12:42am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/5 "2021-09-07T00:42:22Z")

</div>

> [@doctorray](#):
>
> No worries. For quick visibility for anyone else.. about $0.50/mo for the Route53 hosted DNS zone, and basically free / pennies when it’s idle, and between 2 and 6 cents an hour when running depending on whether using …

That’s actually pretty crazy comparitively seeing that a typical hosted game server is… expensive.

---

<div class="post-metadata">

**Author:** ![WH7EVR](https://awshq.com/letter_avatar_proxy/v4/letter/w/e79b87/32.png) [@WH7EVR](https://awshq.com/u/WH7EVR)\
**Post date:** [September 7, 2021, 1:05am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/6 "2021-09-07T01:05:39Z")

</div>

> [@unseenspecter](#):
>
> That’s actually pretty crazy comparitively seeing that a typical hosted game server is… expensive.

By expensive do you mean $10/mo? Because small servers are about $10/mo.

---

<div class="post-metadata">

**Author:** ![unseenspecter](https://awshq.com/letter_avatar_proxy/v4/letter/u/b2d939/32.png) [@unseenspecter](https://awshq.com/u/unseenspecter)\
**Post date:** [September 7, 2021, 1:22am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/7 "2021-09-07T01:22:09Z")

</div>

> [@WH7EVR](#):
>
> By expensive do you mean $10/mo? Because small servers are about $10/mo.

Yes. Unless you are hosting a public server where people are on 24 hours/day, this solution amounts to around 25% less cost for even a heavy gamer (approx. 5 hours of play per day, 6 days per week). I’d consider 25% greater cost expensive, comparitively.

---

<div class="post-metadata">

**Author:** ![donkanator](https://awshq.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@donkanator](https://awshq.com/u/donkanator)\
**Post date:** [September 7, 2021, 1:27am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/8 "2021-09-07T01:27:58Z")

</div>

Ironically I just wrote practically the same thing in cdk for Q3 based game. My game image simply doesn’t change so I didn’t have a need for EFS and data persistence.  
My server also shuts down automatically sometime at night so I don’t have to query itself on a weird port… Could …but bending over backwards would cost me a lot more than a fargate container over many years.

I also find strange CX that a user would look up a server and fail. What I did was create a rest API [example.com/start/{region}that](http://example.com/start/%7Bregion%7Dthat) links to lambda that increments desired service count by one. Once the task is up, another lambda creates a DNS for entry.

We were so close. If I publish my work I will tag you. It’s all Iaac.

---

<div class="post-metadata">

**Author:** ![WH7EVR](https://awshq.com/letter_avatar_proxy/v4/letter/w/e79b87/32.png) [@WH7EVR](https://awshq.com/u/WH7EVR)\
**Post date:** [September 7, 2021, 1:39am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/9 "2021-09-07T01:39:02Z")

</div>

> [@unseenspecter](#):
>
> Yes. Unless you are hosting a public server where people are on 24 hours/day, this solution amounts to around 25% less cost for even a heavy gamer (approx. 5 hours of play per day, 6 days per week). I’d consider 25% …

I’m sorry, that math doesn’t check out. Using standard Fargate pricing, the absolute minimum price per hour is about 5 cents. Using spot pricing you could get this down to 1.5 cents/hour, but spot pricing is not reliable nor are your instances guaranteed to be around. This works out to $6.50/mo for a reliable Fargate instance with 2GB of memory, or $1.95/mo for a potentially-unreliable fargate spot instance with 2GB of memory. Alternatively you can spend $4/mo for a reliable server on 24/7 without all the jank of an on-demand configuration, like this – which is 50% cheaper than a guaranteed fargate instance, about 100% more expensive than a potentially-unreliable fargate spot instance. We’re talking the price of a starbucks beverage here.

If you ever decide to build something that relies on spawn chunks (chunks that process 24/7, basically), the whole system turns against you. That’s say you build a mob farm and want to let it run while you’re away. As soon as you reach merely 7.5 hours of active server time per day, you lose advantage vs a server from a hosting platform.

To me this is solution is extremely niche, and has a lot of potential to cost way more money – especially for your “hardcore gamer” example.

---

<div class="post-metadata">

**Author:** ![cr125rider](https://awshq.com/letter_avatar_proxy/v4/letter/c/e47774/32.png) [@cr125rider](https://awshq.com/u/cr125rider)\
**Post date:** [September 7, 2021, 1:52am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/10 "2021-09-07T01:52:14Z")

</div>

> [@doctorray](#):
>
> This is a tutorial I’ve put together for self-hosting a Minecraft server in a completely serverless environment using EFS for persistent storage. It’s designed to start up with a simple DNS query which means you just …

DNS and socket triggers are a lost art. I love this. Great job

---

<div class="post-metadata">

**Author:** ![doctorray](https://awshq.com/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@doctorray](https://awshq.com/u/doctorray)\
**Post date:** [September 7, 2021, 2:10am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/11 "2021-09-07T02:10:14Z")

</div>

> [@donkanator](#):
>
> Ironically I just wrote practically the same thing in cdk for Q3 based game. My game image simply doesn’t change so I didn’t have a need for EFS and data persistence. My server also shuts down automatically sometime at …

Odd CX, yeah but I was tired of my son interrupting my work asking to turn on the server. I was looking for a way to make it as easy as possible without requiring a static listener somewhere.

This could easily be modified in a variety of ways to trigger the action; most would require a browser/bookmark or a button/etc. SMS twilio webhook as a trigger would be great too. I felt the DNS pipeline was a neat way to try something different.

With respect to querying itself on a weird port, my watchdog container just runs netstat+grep+wc to get a connection count. In Fargate the network stack is shared so it works fine.

---

<div class="post-metadata">

**Author:** ![unseenspecter](https://awshq.com/letter_avatar_proxy/v4/letter/u/b2d939/32.png) [@unseenspecter](https://awshq.com/u/unseenspecter)\
**Post date:** [September 7, 2021, 2:47am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/12 "2021-09-07T02:47:58Z")

</div>

> [@WH7EVR](#):
>
> I’m sorry, that math doesn’t check out. Using standard Fargate pricing, the absolute minimum price per hour is about 5 cents. Using spot pricing you could get this down to 1.5 cents/hour, but spot pricing is not …

You literally gave a number of $10/month as a counter to what I said, which I accurately disputed as 25% more expensive than the OP’s numbers, comparatively, then replied again to tell me I’m wrong using a completely different number ($4/month). The number I disputed ($10/month), is still more expensive than the reliable Fargate costs you mentioned in your follow-up reply. Just stop.

---

<div class="post-metadata">

**Author:** ![ProperBaker3](https://awshq.com/letter_avatar_proxy/v4/letter/p/7ba0ec/32.png) [@ProperBaker3](https://awshq.com/u/ProperBaker3)\
**Post date:** [September 7, 2021, 5:14am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/13 "2021-09-07T05:14:49Z")

</div>

> [@unseenspecter](#):
>
> You literally gave a number of $10/month as a counter to what I said, which I accurately disputed as 25% more expensive than the OP’s numbers, comparatively, then replied again to tell me I’m wrong using a completely …

When big iq gets crushed by mega iq, or basic arithmetic

---

<div class="post-metadata">

**Author:** ![gergnz](https://awshq.com/letter_avatar_proxy/v4/letter/g/858c86/32.png) [@gergnz](https://awshq.com/u/gergnz)\
**Post date:** [September 7, 2021, 6:05am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/14 "2021-09-07T06:05:37Z")

</div>

This is really interesting. I’m half way (all projects are always half done) on a different approach for my boys as they want different servers for different versions, game modes, ops, etc. Still using containers but was on EC2 . I’ll take a look and might have a crack of combining the two approaches.

Nice one.

---

<div class="post-metadata">

**Author:** ![tb200](https://awshq.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@tb200](https://awshq.com/u/tb200)\
**Post date:** [September 7, 2021, 6:22am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/15 "2021-09-07T06:22:48Z")

</div>

Dang.

I don’t play Minecraft anymore but this is a really interesting approach to hosting.

---

<div class="post-metadata">

**Author:** ![tuig1eklas](https://awshq.com/letter_avatar_proxy/v4/letter/t/54ee81/32.png) [@tuig1eklas](https://awshq.com/u/tuig1eklas)\
**Post date:** [September 7, 2021, 6:35am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/16 "2021-09-07T06:35:13Z")

</div>

I’ve been meaning to build something similar, but by letting it run 24/7 using Fargate and EFS. This solution is neat…

---

<div class="post-metadata">

**Author:** ![SureElk6](https://awshq.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@SureElk6](https://awshq.com/u/SureElk6)\
**Post date:** [September 7, 2021, 7:27am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/17 "2021-09-07T07:27:07Z")

</div>

> [@doctorray](#):
>
> This is a tutorial I’ve put together for self-hosting a Minecraft server in a completely serverless environment using EFS for persistent storage. It’s designed to start up with a simple DNS query which means you just …

Instead of updating the DNS manually, try using AWS cloudmap.  
Don’t know if will work for your need, but its an unknown AWS service I discovered recently for a similar use case.

---

<div class="post-metadata">

**Author:** ![RulerOf](https://awshq.com/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@RulerOf](https://awshq.com/u/RulerOf)\
**Post date:** [September 7, 2021, 8:33am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/18 "2021-09-07T08:33:21Z")

</div>

Great writeup.

---

<div class="post-metadata">

**Author:** ![moofox](https://awshq.com/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@moofox](https://awshq.com/u/moofox)\
**Post date:** [September 7, 2021, 9:18am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/19 "2021-09-07T09:18:23Z")

</div>

> [@doctorray](#):
>
> Odd CX, yeah but I was tired of my son interrupting my work asking to turn on the server. I was looking for a way to make it as easy as possible without requiring a static listener somewhere. This could easily be …

I really like the idea of the launch being triggered by DNS query logging - great work!

---

<div class="post-metadata">

**Author:** ![Torgard](https://awshq.com/letter_avatar_proxy/v4/letter/t/f07891/32.png) [@Torgard](https://awshq.com/u/Torgard)\
**Post date:** [September 7, 2021, 10:18am UTC](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545/20 "2021-09-07T10:18:22Z")

</div>

This is a great tutorial on a couple of AWS services that I haven’t dug too deep into! Thanks for making this and sharing it.

I have occasionally hosted a Minecraft server for some friends, but I’ve frequently forgotten to turn it off again. I’ve wondered about how to make it on-demand before, and your solution is quite elegant! I dig it.

Thanks!

[Next page](https://awshq.com/t/serverless-dns-driven-on-demand-minecraft-server-with-route53-fargate-efs/13545.md?page=2)
