Back in 2023, instead of paying for a game hosting service, I decided to take advantage of the AWS EC2 free tier to deploy a headless Ubuntu server. That single decision was the best hands-on classroom for Linux administration I could have ever asked for.
1. Surviving on a t2.micro Instance
AWS t2.micro gives you 1 vCPU and only 1 GB of RAM. Trying to run a Java game server on 1 GB of RAM quickly triggers the Linux Out-Of-Memory (OOM) killer. The solution? Configuring a dedicated 2GB swapfile and tuning JVM garbage collection flags.
2. Daemonizing with Systemd
Running a server process in a tmux session works until the instance reboots. Learning to write custom systemd service files ensured the process automatically restarted on failure and booted on system startup.
[Unit]
Description=Minecraft Production Server
After=network.target
[Service]
User=ubuntu
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xmx800M -Xms512M -jar server.jar nogui
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target3. Security & SSH Hardening
Configuring AWS Security Groups to only expose required ports, setting up SSH key authentication, and monitoring memory with htop gave me a deep appreciation for the command-line interface.
Conclusion & Takeaways
Once you get comfortable inside a terminal over SSH, the cloud stops feeling like a black box and starts feeling like an infinite playground.