How to Host a Pocket Minecraft Server in Google Cloud

Screenshot from iPhone XS iOS Version of Minecraft

Background

At the beginning of the COVID-19 pandemic (March of 2020), I wrote a blog post describing how I hosted a Java Edition Minecraft server in Google Cloud’s Compute Engine. The server worked great for hosting Minecraft players (friends, family, co-workers) using their PCs or Macs. At the time, I was not aware of the open source Pocket Minecraft Server (PocketMine-MP Bedrock Edition). The advantage of the PocketMine-MP Bedrock Edition compared to the the Java Edition, is that iOS Minecraft apps can access the PocketMine-MP server. iOS devices make playing Minecraft more accessible.

Instructions

Step 1 – Create a Google Cloud Account

First, follow Google Cloud’s quick start guide to create an account and learn about Google Cloud. You’ll need to set up billing to perform the next steps.

Step 2 – Create a Google Cloud Project

Second, I recommend creating a dedicated Google Cloud project. This allows you to delete all of the resources you create in the event you want to delete the Minecraft server. Also, since Google bills according to project, you can monitor your expenses associated with hosting a Minecraft server.

Give your project a name. For this example, I used the pre-filled project name.

Step 3 – Create and Start a Virtual Machine in Google Cloud Compute Engine

With Google Cloud, you can create a new virtual machine several different ways, to include the command line (gcloud SDK, APIs, etc). To keep it simple, you can create and configure a compute instance from the console as follows. Click on the drop down menu, then select the Compute Engine sub-menu , and finally select the VM Instances option beneath Virtual Machines.

Google Cloud will take a few minutes to enable Compute Engine, if this is the first time you used Compute Engine in the project. Then click on ‘Create’.

After clicking on create, you will be presented with a user interface for configuring the virtual machine. According to the PocketMine-MP setup requirements, you’ll need a minimum of a 64-bit CPU & operating system and 1 GB of memory (recommended dual-core or better CPU). However, the PocketMine creators emphasize lack of multi-core support, so I recommend against configuring a machine with more than two cores.

Configuration Options:

  • Name: minecraft-server or name of your choosing
  • Region: choose a region near your geographic location
  • Machine configuration*
    • Series: E2
    • Machine type: e2-micro (2 vCPUs, 1 GB memory)

*You can always configure the machine differently later. For example, if you need more compute power or memory, stop your VM and change the processor or memory configuration.

Next, you will want to give your new virtual machine a network tag. Network tags let you target specific instances with firewall rules.

Once you have configured the compute instance, click ‘Create’. The virtual machine will take a few moments to spin-up. Once the machine is created you can stop and start the machine as needed. Be sure to stop the machine when you are not using it to not incur charges.

You also have the option to reserve an external IP address. This can be done by editing the virtual machine configuration in the Network Interfaces section.

The external IP address illustrated here is no longer associated with the Minecraft Server

Step 4 – Open Firewall for Minecraft Server

Next, you’ll need to create a firewall rule to allow Minecraft players to connect to the Minecraft server running on your newly created VM. Select VPC network and then select Firewall.

At the top of the Google Cloud Console, click on ‘Create Firewall Rule’.

Give the firewall rule a descriptive name, specify the Target Tag as minecraft-server or whatever Network Tag you gave the compute instance you just created, and then specify the permitted source IP ranges.

You can permit all IP ranges (0.0.0.0/0) or only select IP addresses (like those IP addresses you want to give access to).

Finally, specify the TCP and UDP ports 19132 and click ‘Create’.

Step 5 – SSH into Compute Instance and Install the Minecraft Server.

You’ll need to SSH into the Compute Instance in order to install the Minecraft Server software. Go back to the Compute Engine VM Instances view. Click on ‘SSH’ to open a web browser based SSH terminal.

The terminal window will look something like this. Then follow the install instructions located here.

curl -sL https://get.pmmp.io | bash -s -

After you install the software, run:

./start.sh

You’ll be prompted to configure your Minecraft server. Follow the server configuration instructions on the PocketMinecraft-MP website.

Step 6 – Setup iOS Minecraft App to Contact Server

Now, on your iOS device, add a server. Enter the external IP address you assigned to your compute instance. Leave the port as 19132.

Step 7 – Host a Minecraft world

That’s it! Enjoy playing. You’ll want to look at the PocketMinecraft-MP documents for Minecraft server configuration options, such as whitelisting and banning players.