Home
Minecraft Server (AWS)

Discord Bot (Python, AWS, SQL)

This Website (HTML, CSS, JavaScript, Git)

Certifications

Minecraft server.


This stemmed from wanting to have a Minecraft Server for my friends and I to play 24/7
Searching online for options, I found a lot of services that did this for a reasonable rental fee. However, I was looking to keep complete control over the performance of the server as well as drive costs even further down if possible.

I ended up settling on Amazon EC2 instances, as the architecture is barebones (forcing me to use linux in a shell interface) but the Amazon tools around it provide many options.
I started by creating a Medium Instance (4GB of RAM and 2 virtual CPUs), downloading the key locally and SSH'ing into the server.
I had to get comfortable with chmod to grant the right permissions (or simply use sudo before a command) as well as
"yum" which is the Amazon package manager (why you gotta be different, Amazon??).

For installing the latest Java package, I downloaded the .rpm file from Oracle. To make file transfer more efficient going forward, I downloaded WinSCP and set up the session profile. I moved the rmp over to the server with WinSCP and installed it with sudo yum install.
Similarly, I downloaded and moved the Minecraft server file over to a newly created directory and successfully ran it for the first time

However, at this point I would theretically need to have my shell session open 24/7 to keep the server running, and at $0.05 an hour that meant I would pay overy $35 a month for this. I was also the only one with the access to start / stop the instance, which defeated the purpose. My solution was to write a Discord Bot (Here's my page on that) to allow any user in my group to start / stop this server, as well shut down the server after 30 minutes of inactivity (leveraging Amazon's Cloudwatch metrics).

I started by adding a script in the instance's startup folder to boot the minecraft server automatically once the instance was started.
This is in var/lib/cloud/scripts/per-boot/, and the script simply "CD's" to the correct Directory, and runs the java server file as root.

I also took the time to set up weekly backups for the instance, just for safety.

Considering we play 5-10 hours per week at most, this was able to successfully reduce the costs from $35 to under $5 a month which is cheaper and more reliable than other services offered online.
Please see the Discord Bot page for more information on how accomplished this last part.