Gcloud offers free credits for their cloud platform. One of the services in this cloud platform is Google Compute Engine (GCE). This is a quick guide to using and hosting on GCE.
Install the necessary gcloud CLI, the following command works for Debian and Ubuntu systems:
sudo apt update && sudo apt install -y google-cloud-cli
gcloud --version # check if installed
Next you need to login :
gcloud auth login
This should redirect you to a page which asks you to sign in through your google account and approve permissions. Once that’s done go to google cloud console and create a project in the same google account.
Now you need to enter that project on your device:
gcloud config set project [PROJECT_ID]
Your PROJECT_ID will be generated by google and visible on your cloud console page.
Next up, you’ll create a VM instance. (All GCE instances you create, internally, are VM’s on google’s servers). You can choose the compute power and features of the google cloud engine that you want based on your use case.
gcloud compute instances create my-instance \\
--machine-type= \\ # Choose VM's Compute power
--image-family=debian-11 \\ # Choose VM's OS
--image-project=debian-cloud \\ # Choose VM's base image for OS
--zone=us-central1-a # Choose location of host server
Your choice of OS and base image are project specific, but go with debian by default if you don’t have any specific needs. Choose your zone wisely. It will affect the latency for both users and yourself (when you ssh into your VM).
You can check all the GCE instances you have, along with its status and public IP:
gcloud compute instances list
IMP : Make note of the public ip, you will need it later to interact with the server.
SSH into your GCE instance using: