Create a Minecraft (PE)Bedrock Server in GCP

Chris Hillman
5 min readAug 18, 2020
Image from nvidia : https://www.nvidia.com/en-us/geforce/guides/minecraft-rtx-world-conversion-guide/

My eldest daughter, plays with her friends a lot with the Minecraft Pocket Edition (PE). The PE Edition, really limits it to WiiU, xbox or ipad. This is the most convient gaming version for them as they all have iPads.

Occassionally the world they are all playing on gets corrupted and she looses all the work they have done. There is ways to recover it, but its rather time consuming.

So thought I would look into making a server for them. This means we have more control over the backup process. I am not a GCP expert, but this was a great little process to get familiar with some of the functionality that comes with GCP.

Create a new Project

Navigate to Google Cloud Console

In the left side, there will be a drop down, and you can navigate here to Create a new project.

Google Cloud Console — Create New Project

I named this project Minecraft.

The ProjectID that it generates is important for a future step, so you can copy and paste that to a notepad, or write it down.

On the left side there will be 3 horizonatal lines, which we will refer to as the GCP Console, its the quick navigation to all the googles functionality.

Google Cloud Console — Navigation drop down

Create the VM (Virtual Machine)

In the GCP console, click Compute Engine > VM Instances
Click create instance

We want to the below options to be input:

Under Management, security, disks, networking, sole tenancy.

Click first on Disks

Click Add new Disk

We want to the below options to be input:

Click Done

Click now on Networking

We want to the below options to be input:

Click Done

Click Create

Setup the firewall

In the GCP console, Click on VPC Network > Firewall rules
Click on create firewall rule

We want to the below options to be input:

Click Create

Setup the VM

This disk is attached to the compute instance, but its not mounted.

Click on SSH to pop out a terminal and connect to your compute instance
Create a directory that will become the mount point for the disk

Then we need to format the disk run. The disk name may vary

in my case it was /dev/sda1

To mount the disk run the following

Update the OS repositories on the VM, runing the below

now install unzip, wget, screen, htop, headless JRE

Now lets install the bedrock server (which is specific for Pocket Edition)

Run the server

Create Backups

In the GCP console, Click on Compute Engine > VM Instances

We already have the mc-server created, so click on SSH

We want to create a global unique bucket name

Now we want to create a backup shell script.

The below code will enable you to save the world, to your backup bucket

Press Ctrl O, then Enter to Save, then Ctrl X to exit

We can then allow the script to execute

We can test the script is working by running

Then verify it in the Storage by navigating here
https://console.cloud.google.com/storage/browser

Some other utility scripts I created are here;

Start up scripts on server

Click on mc-server
Click edit
Custom metadata add a new key/value pair

Key:

startup-script

Value:

Key:

shutdown-script

Value:

Click Save

Create Auto Start/Shutdown Instance

In the GCP console, Click on Cloud Scheduler
Click on Create Job

For my server, I want it to start at 2pm, and close by 10pm.

We want to the below options to be input:

In the GCP console, Click on Cloud Functions

Click on Create Functions

We want to the below options to be input:

Code:

Click on Create Functions

We want to the below options to be input:

Code:

There is likely lots of improvements that can be made on this, so if you do have any recommendations let me know.

--

--

Chris Hillman

Data Engineer with enthusiasm on creating culture growth environments.