AWS and D&D

Foundry VTT

Posted by Zachary Sanders on October 17, 2020 · 8 mins read

Background

Prior to a few months ago I hadn't hadn't had much experience with Amazon Web Services outside of a few classes in college. I also hadn't played Dungeons and Dragons before even though I've always wanted to I've watched Critical Role here and there. This may seem like a strange combination of topics to some but I'll explain how they relate soon. When the COVID-19 pandemic hit, I was missing socializing with my friends and being social in general. I had always wanted to play D&D but never got around to forming or joining a party that wanted to play. If you've played D&D before you probably know finding interest isn't that difficult but getting 4-6+ people to all free up their schedules to sit down at a table at the same time is the equivalent of trying to herd cats. Well, one of the few fortunate things that resulted from COVID was that with everyone being quarantined at home it opened up an ample opportunity to connect virtually for a D&D campaign.

We decided on trying out Roll20 for our Virtual Tabletop as it seemed like the most commonly used freemium service. We already had a Discord server we were all members of so we just used that for communication. We also ended up using D&D Beyond to manage our character sheets, items, gold, etc. to simplify and standardize the process of character creation as well as maintenance. To create the connection to Roll20 and D&D Beyond we all used the Beyond20 browser plugin so we could roll skill checks, attacks, spells and everything else from our character sheets in D&D and have them reflect in Roll20.

Our first session went well but we all had different issues with Roll20. Either the browser was out of sync, our character sheet dice rolls weren't carrying over properly, or the graphics generally looked bad. Our DM (dungeon master) also said that he felt restricted with the different options Roll20 offered. He bared the brunt of creating maps, lighting and other virtual elements in the Roll20 VTT. So we decided to look elsewhere for VTT options, which is when we came across this up and coming player called Foundry VTT. It seemed to offer everything we wanted, it was open source, configurable, extendable... generally it just covered all of the points we were interested in. It runs as a node server built mainly with JavaScript and was written generally as a VTT to allow different game systems (not just D&D). It was also setup to easily allow developers to create their own modules that interacted directly with the application and game systems. This was what interested me the most. If we ever had any issues or there was some ad-hoc feature we wanted I could just code it up as an additional module and share it with my campaign (and potentially the entire Foundry VTT community).

Foundry VTT and AWS

Our GM decided to pay the one time license cost of $50 and was able to setup Foundry VTT locally on his Windows machine. Unfortunately he wasn't able to get his port forwarding to work properly to expose his machine's local port externally so that we could connect to it. So rather than his work and money be wasted I decided I was going to setup Foundry VTT in an AWS EC2 Linux instance.

I ended up registering a domain name with GoDaddy in an attempt to be fancy with a custom domain name. If you've ever used the AWS EC2 public IP URLs, you know they're rather unattractive. I also went with GoDaddy for the domain name registration because it was cheaper than AWS Route 53 for the same domain. This decision ended up causing a bit of a headache for myself to switch over the nameservers with the necessary record sets in the Route 53 hosted zone.

I spun up a simple AWS EC2 t2.micro (free tier) Amazon Linux instance. I added my personal IP to the inbound rules for port 22 (SSH port) and transferred over the Foundry VTT Linux installation and license. Prior to this I had a good amount of experience setting up, configuring and managing Linux servers. Along with being a software developer, I was/am also the only DevOps person on my team at work so a lot of the server configuration, CI/CD, containerization with Docker, port configuration, firewall, etc. falls onto my plate to configure (not that I had any official training on it). On the Linux instance I used yum to install nodejs and nginx. I used nginx as the proxy server because that is what I usually use. I used nginx to route the browser HTTP requests (port 80) to the domain to the internal port where FoundryVTT was running (port 30000). Foundry also has documentation on how to set all of this up for anyone that would need it.

Now

We've been using Foundry VTT ever since and it has been going really well. We're still using all the same tooling as before we just switched from Roll20 to Foundry. I also ended up adding our DM as an extra user via AWS IAM so that he could stop and start the server as needed in preparation for our sessions. I haven't had the time to create any custom modules for our group yet but thankfully the game system and community's modules are more than enough to play D&D virtually. I have run FoundryVTT locally and tinkered around a bit with the Foundry API, such as parsing incoming chat message, determining if certain spells were mentioned and creating buttons to apply conditions/effects to active tokens based on those spells. It seems like this was a bit premature since Foundry announced a new Dynamic Active Effects functionality. Which isn't the same thing I was doing but will change how I need to implement the changes. Hopefully I have some extra time soon as I'd like to contribute back to the community with a useful module.

Recently I've been doing a lot more work with AWS. I've been helping clients at work setup our tool suite in their own instances by providing them instructions and hands on support. I'm also in an AWS cloud bootcamp currently which is ending in a few weeks. Once the bootcamp is over I will take the AWS Certified Solutions Architect Exam. So far I've liked using AWS and I thought it was a bit funny that when asked certain things at work regarding it I was able to respond correctly because I learned it setting up my D&D campaign!