= I setup a cloud hosted Valheim dedicated server using AWS, here's what I used and what problems I had. =

I've been working with AWS for a year or two now for my job (and I've worked in software dev for 20 years) and so I am pretty familiar with how it works and then I came upon this blog post from AWS on setting up a Valheim server

httpsaws.amazon.com/blogs/gametech/hosting-your-own-dedicated-valheim-server-in-the-cloud/
It does a pretty good job of going step by step through the process necessary to create everything. The end solution overall works pretty well, but there are some caveats and details I will go into later on

The basics are that it uses Cloudformation to create everything for you. You do some basic data entry and it does the rest. Cloudformation is the AWS configuration as code template language. You can generate any resources you want in AWS using Cloudformation. The resulting set of resources created by a Cloudformation template are called a Cloudformation Stack

The few manual steps involve setting up the hosted zone for the URL that will point to your EC2 instance IP address and some configuration of the control panel website users and the server password. I ended up paying $5 to register a .link domain that would point to the IP of my server and set it up using the Route 53 service as described in the post. This is optional but simplifies things

It creates an Eventbridge Rule that goes off once a day todown the EC2 instance to save costs. Having the EC2 running generates fees and unless you play 24/7 it makes sense toit off during sleep time (I set mine todown at 12:05am my time)

It generates a website that is hosted on cloudfront that you can use to turn the EC2 server on and off or resize it. Authentication to this site is managed using the Cognito service, so you can give logins to your friends and they can turn the server on (or off) when they want

The server startup will obtain the current IP address of the EC2 and update your Route 53 DNS to point to it

The Backup service is used to create daily backups of your server

This isn't really a problem per se, but if you aren't comfortable using SSH to log in to a Linux server this might not be the right thing for you to try. Troubleshooting does end up pushing you onto the server to check what is going on. For instance when the last patch broke things with world saves I went onto the server and copied the world file myself from one location to another to fix it

Again, this isn't necessarily a problem, but other than mentioning that it is running in a container and that you need to make some changes to docker-compose.yml to update the server password there isn't much detail given about the container setup in the blog post. If you do some searching based on things in the docker-compose.yml you'll find that it's running this Valheim container setup httpsgithub.com/mbround18/valheim-docker
The container solution is well documented if you need to troubleshoot it. It's overall been very much a non-issue except for one thing..

All of the previous stuff might never have come to my attention if the default settings for the container solution as installed (not the defaults that it comes with out of the box) were not setup to cause a failure. One day I tried to login to the server and it failed to let me in. After I got onto the EC2 instance using SSH I found that the primary disk drive was full. I investigated a bit and found that the way the valheim-docker container solution is setup has the default backup schedule for the game files set to be performed every 15 minutes and retention was set to 3 days

In hindsight, I could have seen this in the screenshot of the docker-compose.yml that they put in the blog post, but of course without any context it was lost on me at the time

httpsd2908q01vomqb2.cloudfront.net/91032ad7bbcb6cf72875e8e8207dcfba80173f7c/2022/04/05/valheim-nano-02-1024x494.png
AUTO_BACKUP = 1 -- Means auto backup is turned on

AUTO_BACKUP_SCHEDULE = */15 -- A cron expression for every 15 minutes

AUTO_BACKUP_DAYS_TO_LIVE = 3 -- How long backup files are kept

Considering each backup file is several hundred MB, within a few days this ate up the 8gb of space the default configuration is setup with. Once I deleted the unnecessary backups and changed the schedule to something a bit more reasonable all has been good ever since

I'm still using this setup. I like it. It's relatively low cost overall per month. They estimate $5 per month for 20 hours of uptime per week with a Medium server and so far that tracks with what I'm seeing. Yeah I'll probably be more around $10 since we play more often, but it's convenient. I don't need an extra machine running that uses electricity here at the house or really do any infrastructure work at all. The only thing I need to keep track of is the world saves if I need to move off of this and since everything is created by Cloudformation I canit away and recreate it within 15 minutes if I need to. It's neat overall

no comments yet
Be the first to share what you think!
== About Community ==
Vikings
Deer currently honking
Top 1%
Ranked by Size