Setting up a Palworld server in AWS
Tags: aws
Published: 2024-02-12 13:00:00

> <a href="https://www.freepik.com/free-vector/developers-using-laptop-smartphone-working-with-cloud-data-multimedia-big-data-architecture-database-cloud-computing-cloud-platform-concept-vector-isolated-illustration_11668705.htm#query=cloud%20computing&position=44&from_view=search&track=ais&uuid=0109b806-3110-4f5a-826a-945232136c9b">Image by vectorjuice</a> on Freepik

A couple of weeks ago, a game called Palworld released and took the gaming world by storm. My brother and I wanted to play it co-op, but due to issues with the multiplayer server, we couldn't. Luckily, we found that Palworld has a [dedicated server](https://tech.palworldgame.com/dedicated-server-guide#deploy) that we can host it anywhere we want. I took this opportunity to try and host it myself using AWS.

## Setting up the EC2 instance

The first step is to spin up a virtual server using Amazon Elastic Compute Cloud (EC2), amazon's on demand virtual servers. For the image, I decide on Ubuntu since it was easier to set up the required dependencies for the Palworld server.

According to the recommended server specs we need at least 16GB of RAM, for this, I opt for the **t3.xlarge** instance and for the Elastic Block Storage (EBS) I put 30GB of storage.

Before moving on to the installation of SteamCMD and the Palworld dedicated server, I decided to create a specific Security Group and an Elastic IP address for this EC2 instance.

### Security Groups

**A security group controls the traffic allowed to reach and leave the resources that it is assigned to.** For my instance, I created a new security group called **Palworld Server Security Group** and then edit the inbound rules for this group. I enabled SSH to accept connections from my local IP address and allowed UDP port 8211 to accept any IPv4 requests. This will let anyone with the server IP address and port connect to the Palworld server using the in game server browser.

### Elastic IP

_Before February 1st, 2024, Elastic IP Addresses assigned to an instance were free, but now, they charge US$0.005/hour, you can read more about it [here.](https://aws.amazon.com/blogs/aws/new-aws-public-ipv4-address-charge-public-ip-insights/)_

IP addresses in the cloud are dynamic by nature; every time I stop an EC2 instance and then start it up again, it gets a new IP address. Due to this, I opted to use an Elastic IP address.

**Elastic IP is a static IPv4 address designed for dynamic cloud computing.** My main motivation to use an Elastic IP was so that I didn't have to share the server IP address every time my brother or cousins wanted to play.

That's all the setup as far as AWS console goes, now we will SSH into the EC2 instance to install everything we need to run the Palworld dedicated server.

## Installing SteamCMD and Palworld server

### SteamCMD

[SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD) is a Steam client CLI tool for installing and updating dedicated servers, to install it on ubuntu as per the documentation we run:

```shell
sudo add-apt-repository multiverse; sudo dpkg --add-architecture i386; sudo apt update
sudo apt install steamcmd
```

After the setup is complete, we can type in the following command:

```shell
steamcmd
```

If everything works, you should be inside a SteamCMD prompt

```shell
$ steamcmd
tid(931) burning pthread_key_t == 0 so we never use it
Redirecting stderr to '/home/ubuntu/Steam/logs/stderr.txt'
Logging directory: '/home/ubuntu/Steam/logs'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1705108307
-- type 'quit' to exit --
Loading Steam API...dlmopen steamservice.so failed: steamservice.so: cannot open shared object file: No such file or directory
OK

Steam>
```

That's all for the SteamCMD setup, now we move on to install and configure the Palworld server.

### Palworld dedicated server

Our first step is to download and install the dedicated server, to do this we run the following command:

```shell
steamcmd +login anonymous +app_update 2394010 validate +quit
```

- `+login anonymous` let us log in into steam as anonymous user.
- `+app_update <app_id>` installs or updates the installation of the given `app_id`.
- `validate` checks the server files to make sure they match with SteamCMD files.
- `+quit` logs off from the Steam servers.

After the download is complete, we go to the download directory, which, in my case, it was in my user's home directory.

```shell
cd ~/Steam/steamapps/common/PalServer
```

Now we simply run:

```shell
./PalServer.sh
```

On the first run, it will throw the following error:

```shell
.steam/sdk64/steamclient.so: cannot open shared object file: No such file or directory
```

As per the documentation, we can fix this with the following commands:

```shell
mkdir -p ~/.steam/sdk64/
steamcmd +login anonymous +app_update 1007 +quit
cp ~/Steam/steamapps/common/Steamworks\ SDK\ Redist/linux64/steamclient.so ~/.steam/sdk64/
```

1. It creates a folder called sdk64.
2. It installs the Steamworks SDK Redistributable.
3. Copy the file `steamclient.so` to `~/.steam/sdk64/`.

With that out of the way, we can run this command again:

```shell
./PalServer.sh
```

If we get the following line after running the previous command, the server is up and running successfully:

```shell
[S_API] SteamAPI_Init(): Loaded '/home/ubuntu/.steam/sdk64/steamclient.so' OK.  (First tried local 'steamclient.so')
```

We are almost done. The last thing we need to do is to change some of the server settings.

### Configuring the Palworld server

Running the server for the first time will generate a configuration file in the following location:

```shell
steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
```

As per the documentation found [here](https://tech.palworldgame.com/optimize-game-balance), we need to copy the default settings found in `steamapps/common/PalServer/DefaultPalWorldSettings.ini`.

There are many server parameters we can edit, but for now we only need to change the following:

- **ServerName**: We type in the name of our saver, in our case, we called it _Eternia_
- **ServerPassword**: We can set a server password here.
- **PublicIP**: We need to type in the Elastic IP address we set up earlier.
- **PublicPort**: We can specify a port number here, the default is 8211.

With those final steps, we are all set to begin our journey into Palworld.

Nice!👍🏻

## Closing thoughts

Setting up a game dedicated server with AWS was a really fun experience, from the proper setup of the EC2 instance, to the correct setup of the security group and the allocation of the Elastic IP while also installing and configuring all the dependencies needed to host the Palworld server.

With this little project under my belt, I'm looking forward to set up all kinds of dedicated servers, from Minecraft to Enshrouded and anything else that comes in between.

Hope to see you again as I continue my journey towards the cloud.