Brick By Brick Learn GCP By Setting Up A Minecraft Server

From E-learn Portal
Jump to: navigation, search

How much will this all cost?



GCP offers a fantastic suite of Always Free Products. And since you are the Chief Technology Officer and Chief Financial Officer of your household you've already taken advantage many Always Free Products, such as GCS and Cloud Functions that help you manage your spending. Based on the scale that you've created with this guide, your cost should look like the following.



Compute Engine



The n1-1-standard-1 costs under $0.05 an 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



- Google Cloud Functions are included in 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. Whether you pay or they do depends on how generous you are feeling, and if the chores are getting done.



What should I 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. This is just a small part of the many things you can do with GCP. Here is a not-so-short list of things you could do to increase the capability and lower the cost of your Minecraft server.



Make it easier to connect



Register a domain on Google Cloud DNS. Convert all IP connection information onto DNS. Have the server register itself with the CNAME record as part of the startup script so you have a consistent URL for connecting to the game. This idea can be extended to the URLs that allow you to control the server and add friends.



Spend smarter



Make your server a Preemptible virtual machine (VM), and add the startup script to automatically create the latest backups every time the server turns off. Now your hourly server costs can be reduced by around 80%.



Change the startup scripts to use an ephemeral IP address on the server, thus eliminating any cost for using a static IP address.



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 off the server at a certain time, and prevents it from being started during those "you should be asleep" hours. irc101



Learn more about monitoring, alerting and logging updates



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



Use Stackdriver monitoring and alerting to:



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



Monitor the server's CPU or connections to detect idle time and turn it off. This server will not be turned off by your "users". Chit Chat Chit Chat



Bonus: Let the server text your children first, and then only include you after a certain period of time.



Explore some data science enhancements



Analyze server logs for information about how often your friends and relatives play. Create a chargeback report to map 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? You may need more data. Install a mod on your server that exports game data to a local log file. Next, export that to BigQuery.



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). Use persistent storage or autoloading to manage and launch your game. Learn what changes are necessary to make all previous functionality work in the same manner when using containers.



Wrapping up



You are now on your way to becoming the coolest parent ever-not to mention a professional GCP rockstar! Enjoy this project, and you'll be amazed at how many tools and products can be linked to your architecture to make your users, err kids, happy. You can also gain insight into your data and optimize uptime while lowering costs.