Google Cloud Platform is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning (Wikipedia).
Google Compute Engine is what you probably know as a virtual private server (VPS). You get a virtual machine (VM) with a freely usable operating system, in this case Ubuntu Linux. What’s really great about it is that after registration with a normal Google account, you get credits worth $300 to try out the platform for 12 months if you enter your credit card details. Just go to their Console, accept the terms of service and activate the free trial. You’ll never be charged unless you explicity order any paid services after you’ve run out of free credits! Google only needs the CC info to make sure you don’t create new accounts over and over.
I’m writing this article in the context of my Fusion guide, so I’ll use the staking node setup as an example here, but of course you can do whatever you want with your system, just adapt the settings according to your needs.
If you’re looking for an alternative to Google, you can also check out my Hetzner guide.
After you registered, please select Compute Engine > VM Instances in the left hand menu bar. The platform will be running some initialization tasks now, including setting up an initial project called My First Project, so you don’t have to take care of that. Projects allow you to keep different tasks entirely separate from each other. When the platform is finished, you can create your first VM by hitting the corresponding button.
I already changed some settings here. I gave my VM a descriptive Name and chose a Region. Note that the region affects the costs, I didn’t dig through the docs but it’s probably based on usage and connectivity. Click Details on the right side to see a more detailed cost breakdown. You can also get discounts for sustained use, because that allows Google to optimize and plan its capacities in advance. I want to make my VM last as long as possible with my free credits, so I also clicked Customize in the Machine type section and chose 2 cores (vCPUs aren’t actual cores but compute slices on available physical cores, but let’s just say cores here) and 4GB of RAM, which isn’t available in the list of predefined types.
Further down I changed my Boot disk Image to Ubuntu 18.04 LTS on 120GB of standard persistent disk storage. You can also choose SSD storage, which is of course faster but also more expensive. Note that Google encrypts all storage by default, so don’t worry that your data might crop up elsewhere long after you deleted your VM.
Finally open the section Management, security, disks, networking, sole tenancy.
You can leave most of the settings here at their defaults, but what you most likely want to do is paste your SSH key into the corresponding field on the Security tab, so you can access the system using SSH later. If you don’t know what that is or how to use it, please check out my extensive SSH guide.
Note that the username you’ll later use to login to your system is derived from the key comment and will be shown to the left (marked red here). If the comment contains an email address, only the part in front of the @ will be used.
If you need to execute only very few commands on the system and rarely ever touch it, you could theoretically also skip this and just use Google’s browser based SSH client (which works surprisingly well, see further below).
Now switch to the Networking tab.
Here you need to change two things. First, add a Network tag. This will later be needed to apply firewall rules, so the system is accessible from its public external IP address. Speaking of which, VMs have ephemeral IP addresses by default, so after each reboot (or crash) you’d get a new one. For my use case, running a staking node, this is definitely not what I want, so I changed the default interface’s external IP setting accordingly by selecting the Create IP address option and assigning a name to it. I also chose the Premium Network Service Tier in the process, because I want the best available peerings on Google’s backbone for fast connectivity.
That’s it, you can now start the VM by clicking the Create button.
You generally may have to assign a lot of unique names within a project when working with Google’s platform, so if you plan to use it extensively it’s probably a good idea to think about a personal naming convention and some kind of scheme before you start with the deployment. If I wanted to run multiple Fusion nodes for example, it wouldn’t have been too smart to call this first one just fusion.
You should be redirected to your list of VMs after a few moments, where you’ll see the one you just created up and running along with its external IP address.
You can now access your VM from here, as well as doing basic stuff like stopping and starting it.
Please select SSH > Open in browser window from the Connect column to see if you can actually connect to the system. This will take a moment while the platform sends your SSH key to the VM, then a browser based console window should open, presenting you with a shell prompt. It’s so advanced that you can even use the regular copy and paste hotkeys. You can see the user you’re logged in as at the beginning of the prompt, in the form username@hostname, or by typing the command whoami. Use the command sudo -s to become root.
If you want to connect using a third-party SSH client like PuTTY your username will differ, as it’s the one derived from your key comment as described further up. Use that username and the VM’s external IP address to establish a connection.
Looking back at the VM list now, please open the three dots menu on its right side and select View network details. Unlike other providers, Google doesn’t expose your system to the whole internet by default. Instead, only the ICMP protocol (used for example to ping a system), RDP (remote desktop) and SSH as well as network internal access are allowed by default, as can be seen here.
You want to add additional ports to this list, so please select Firewall rules from the menu to the left and then Create Firewall Rule.
I skipped the naming stuff at the top here, you already know how to handle that. Please make sure that Ingress is selected as the Direction of traffic, which means incoming traffic, and that Action on match is set to Allow. Both are the defaults though. Enter the Network tag you chose during the VM creation process earlier in the Target tags field. You probably want to make the ports available to everyone, so enter 0.0.0.0/0 as the Source IP range, which means every IPv4 address in existence. I want to allow external access to port 40408 for both TCP and UDP, so I entered this information accordingly.
You can now click the Create button and should be redirected to the list of default firewall rules, where you’ll see the newly created custom rule on top.
Congratulations, you have a free basic system running now. Depending on your requirements, the free credits should be sufficient to run a VM for some weeks or even months. Google’s pricing isn’t especially cheap, but it’s transparent and fair I guess and you get access to a super reliable, secure and versatile platform. Of course, if you like the services they offer, pay for them.
If you want to manage your VM from your smartphone, I can recommend Termius (SSH only), or the official Google Cloud Console app, which is a lot more powerful but also more complex, you probably won’t need the other features. Both apps are available for iOS as well as Android.
Note that if you actually wanted to run a Fusion node, the next and final step would be to execute the following command to complete the setup:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/FUSIONFoundation/efsn/master/QuickNodeSetup/fsnNode.sh)"
If you think this article was helpful in any way, feel free to buy me a beer!