Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • ThomasPowell 8:59 pm on August 18, 2020 Permalink
    Tags: ec2, minecraft   

    Deploying a Minecraft Server to EC2 (with some cost analysis) 

    Caveat… an EC2 server is likely not the option you want to pursue for a small to medium scale Minecraft server… Lightsail will be more cost-effective due to the amount of data transfer involved. Also, this is partly an exercise it navigating Amazon Linux as a largely Ubuntu user. If you really want to host your own Minecraft server on a virtual server, I’ve also done this exercise minus 90% of the steps on a 2GB Linode (get a $100, 60-day credit through that referral link) and you will not get a huge egress bill for the insane amount of data you transfer out. OR if you want a fairly plug-and-play solution, PebbleHost offers Minecraft hosting for as little as $1/month ($3-5 basic plan recommended depending on your needs)

    Purchase a Domain

    I’m going through Namecheap for a .online domain because… well… it’s cheap… and registering (.online domain through Route 53 would be $39 vs. $1.88 for the first year with Namecheap).

    Launch an EC2 instance

    If you’re trying to use free-tier resources for this, you’ll want to go for a t2.micro, but you’ll also need to modify the java parameters for the server to fit within those memory limits.

    • Go to the EC2 console via Services -> EC2
    • Scroll down in the main window to “Launch instance” and click [Launch Instance]
    • Select Amazon Linux 2 AMI (should be the first option)
    • I’m selecting t3a.small ec2 instancetype for this to be similar in “virtual” resources as the $10-15/mo virtual server hosting providers (including Amazon Lightsail).
    • Click [Next: Configure Instance Details]
    • You’ll get a default vpc and subnet created and selected… if you don’t want to use these, you can click the available links to create new ones.
    • For “Auto-assign Public IP”, I have “Use subnet setting (Enable)” because I’m going to want to have this publicly accessible.
    • Scroll to near the bottom of the “Step 3” form and find “T2/T3 Unlimited” and uncheck “Enable” unless you want to run up a bill because you forgot about the Minecraft server.
    • Click [Next: Add Storage] to configure your space.
    • Click [Next: Add Tags]
    • Click [Next: Configure Security Group]
    • Click [Add Rule] and add a Custom TCP Rule that allows traffic to port 25565 (the port for Minecraft) from
    • Click [Review and Launch]
    • Click [Launch] and choose “Create a new key pair” named “minecraftserver”
    • Click on Instances and select your new instance, noting the IPv4 Public IP in the instance details below (leave tab open for reference in the next section)

    Create a Hosted Zone in Route 53

    • In a new tab, go to Services -> Route 53 -> Hosted Zones
    • Click [Create hosted zone]
    • Type in your domain name for your server and select “Public hosted zone”
    • Copy the values for the NS record and populate those as the nameservers for your domain (for me, this is on Namecheap
    Route 53 NS record
    Namecheap Custom DNS settings
    • Now go back to Route 53 and [Create Record]
    • Choose “Simple routing”
    • Click [Define simple record]
    • Leave the record name blank.
    • Under “Value/Route traffic to” select “IP address or another value depending on the record type” and paste your IP in.
    • Be sure “Record type” is “A” and click [Define simple record]
    Routing your A (alias) record in Route 53 to your EC2 instance
    • Click [Create records] on the “Configure records” screen.

    Install and setup Minecraft

    • Using your keypair from instance creation, ssh into your your instance
    chmod 400 minecraftserver.pem # or whatever the filename is
    ssh -i minecraftserver.pem [email protected]
    • Create minecraft server folder and user
    sudo mkdir /srv/minecraft-server # assuming EBS mount
    sudo adduser --system --home /srv/minecraft-server minecraft
    sudo chown minecraft.minecraft /srv/minecraft-service
    • Do updates and install java
    sudo yum update
    sudo amazon-linux-extras install java-openjdk11
    • Download minecraft server, run for the first time, and set the eula.txt
    sudo -u minecraft wget
    sudo -u minecraft java -Xmx1024M -Xms1024M -jar server.jar nogui
    # you'll get an error, so edit the eula.txt
    sudo -u minecraft nano eula.txt # or vi, just set to eula=true
    # run minecraft again and try to connect to server at

    Making Minecraft a service

    • Run sudo nano /lib/systemd/minecraft-server.service
    • Paste a config similar to:
    Description=start and stop the minecraft-server 
    RestartSec=20 5
    ExecStart=/usr/bin/java -Xms1024M -Xmx1024M -jar server.jar nogui
    • Now, enable the service with sudo systemctl enable /lib/systemd/minecraft-server.service
    • And start the service with sudo systemctl start minecraft-server.service
    • As it’s starting, you can check the status with sudo systemctl status minecraft-server.service.
    • With this systemctl setup, you should also be able to reboot the instance and have the Minecraft server come back up


    • If you don’t go with the default gateway and subnets created with the instance, you may find yourself having to explicitly set up an Internet Gateway and a Route Table ( to your igw)
    • Make sure the associated security group is allowing port 25565 to connect (especially if SSH is working)


    Be sure to delete your hosted zone (you’ll need to delete the A record before deleting the zone) and terminate your instance to avoid running up charges for things you’re not using. I deleted the VPC as well just to avoid clutter and half-baked subnets and security groups, but that’s only because I have nothing of long-term value in the account.

    Cost Analysis

    There are multiple hits that you’re going to take by hosting this on EC2:

    • egress costs (9¢ per GB after your first GB): In my limited tests, the Minecraft worlds we started up required 100-200MB to initially download per session. It’s unclear if that’s the case for every session, but if you have 20 of your friends use a server, that might be 9¢ x 0.20 GB x 20 for one session each… 36¢ per average number of sessions… that could add up quickly. By contrast, you could get a different hosting provider (including Lightsail) to bundle 2TB of transfer instead.
    • hosted zone cost (50¢ for a distinct domain’s hosted zone)
    • If you use a separate EBS volume, minimum cost there is 80¢.
    • EC2 pricing for a t3a.small is 1.88¢ per hour or $13.53/month… you could have the server shut down during off-hours, but then you’re not comparing to “always-on” options.
  • ThomasPowell 10:44 am on August 13, 2022 Permalink | Reply  

    Emacs errors in process sentinel: WakaTime Error (127) 

    I was setting up the wakatime-mode extension in a fresh Emacs For Mac OS X install so report to WakaTime. After setting up the CLI in my home directory I was getting the following message on saving:

    Emacs errors in process sentinel: Wakatime error
    Emacs error with wakatime-mode

    It sounded like WakaTime Error (127) #35, but I was able to run the command at my shell.

    Of course, the problem is that since I installed the extension into my home directory, I specified it this way in the init.el:

    (setq wakatime-cli-path "~/.wakatime/wakatime-cli")

    Unfortunately, ~ won’t get expanded like it will in my zsh.

    Changing it to the full path, i.e.,

    (setq wakatime-cli-path "/Users/powell/.wakatime/wakatime-cli")

    will resolve the error in WakaTime.

  • ThomasPowell 6:15 pm on August 5, 2022 Permalink | Reply  

    VS Code Failed to create file handle: Access is denied 

    VS Code Failed to create file handle: Access is denied

    Recently in Windows, while running VS Code primarily from Windows vs. WSL, I started encountered an error “VS Code Failed to create file handle: Access is denied” tl,dr; Relaunching VS Code as Administrator and checking for updates was the magic formula in my case.

    I encountered a possible solution on Reddit which suggested making sure that AppData\Local\Programs\Microsoft VS Code was writable by the user.

    No sure luck on that one. But I canceled out of the upgrade and saw a reference to a file to the effect of C:\Users\username\AppData\Local\Temp\vscode-inno-updater-1659730976.log which pointed to several attempts to access C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin\code. I first trying renaming the file and then deleting it. Then code.cmd in the same folder was complained about.

    I ultimately ended up restoring those files.

    I finally went back and retried running VS Code as Administrator and checking for updates. This time the updates worked.

  • ThomasPowell 4:48 pm on July 25, 2022 Permalink | Reply
    Tags: docker, docker desktop,   

    Changing Docker Desktop for Windows between Windows and Linux Containers 

    In order to change Docker Desktop for Windows to use Windows <-> Linux Containers, you have to go to the Docker Desktop system tray. There is no setting in the Docker Desktop Console for it.

    docker desktop for windows system tray menu
    Docker Desktop for Windows System Tray menu

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc
%d bloggers like this: