Brick By Brick: Learn GCP By Setting Up A Minecraft Server


How much will this all cost?



GCP has a great range of Always Free products. As the CTO/CFO for your household, you have already taken advantage of many Always Free products, including GCS, Cloud Functions, to manage your spending. At the scale you''ve set up with this guide, your costs should end up like the following:



Compute Engine



- The n1_standard-1 cost just $0.05/hour to run. A static IP addresses cost just $7 per month. Cloud Storage



- Your Google Cloud Storage is covered by the GCP Free Tier.


Cloud Functions



- Your Google Cloud Functions will be covered by the GCP Free Tier.


Thus, if your kids play Minecraft for an average of two hours per day, hosting your own Minecraft server will cost about $10/month. The amount you pay and how generous you feel will determine whether they pay or not. It also depends on how busy you are with chores.



What to build next?



Now all the requirements have been met. The server runs and automatically backs-up game data. It can also be turned on or off via a URL. It also makes it easy to add friends. GCP is capable of so much more! Here is a not-so-short list of things you could do to increase the capability and lower the cost of your Minecraft server.
Minecraft Servers List



Make it easier to connect



Register a domain with Google Cloud DNS and convert all IP connection information to DNS. Register the server with the CNAME records as part of the startup script to ensure a consistent URL for connecting the game. This idea can be extended to the URLs that allow you to control the server and add friends.





Spend smarter



You can switch your server to a Preemptible Virtual Machine, create a custom image of the machine, and then expand the startup script so that the server automatically grabs the latest backup. This will reduce your hourly server cost by approximately 80%.





Change the startup scripts to use an elastic IP address on the server. This eliminates any cost for a static one.





Automatically clean out friends'' firewall entries



Use Google Cloud Pub/Sub, modify your serverless functionality to place all add a friend firewall entries into a Pub/Sub Topic, and create another function to clean them up every night.





Be sure to keep your children from playing too long!



Set up a "curfew", script that automatically shuts the server off at a set time and prevents it starting during "you should sleep" hours.





Learn about monitoring and alerting.



Use Stackdriver logging to export the Minecraft server logs so you can troubleshoot any in-game problems in real-time.





Stackdriver Monitoring and Alerting is a great tool to help you:





Send a SMS message to the server when it turns off or on.





Monitor system CPU or server connections to tell when the server is idle, and automatically power it down. This server will be forgotten by the "users".





Bonus: have the server text your kids first, and only involve you after a certain amount of time.



Explore data science upgrades



Analyze server logs to determine how often your family members play, and create a chargeback report that maps to household chores!





BigQuery allows you to export log data and generate reports that show how long it takes for the server to run, how many users have logged in, and other basic metrics.





Want more data? Install a server mod which exports detailed game data into a local logfile. After that, export it to BigQuery to see how you can query how many blocks were mined in the server per day.





Go even farther and create a dashboard with Google Cloud DataLab that takes that information in real time and creates intelligence around the players.



Play with containers



Move the Minecraft Server to a Docker container running on Google Kubernetes Engine (GKE). To manage and launch the game, you can use persistent storage or autoloading scripts. Discover what changes are needed to make all of the previous functionality work in the same way when using containers.





Wrapping up



You are now on your path to becoming the coolest and most influential parent you can be, as well as a professional GCP rockstar. Have fun with the project and discover how many other products and tools you can add to your architecture. Plus, gain insight into your data, and maximize uptime while lowering costs.