Posts

Showing posts with the label compute engine

SSH to Google Compute Engine

Image
Introduction I previously wrote a guide on creating a Virtual Machine (VM) instance on Google Cloud and accessing it via gcloud . However, if your Google Cloud account lacks permission to manage VM instances, or if you want to create a VM instance that allows SSH for easy sharing with other users and compatibility with various SSH tools, follow the steps below. Configure SSH access for VM instance Firstly, you need to create a compute instance as follows: gcloud compute instances create {instance name} \ --zone={zone} \ --machine-type= { machine type} # ex: gcloud compute instances create instance-1 \ --zone=asia-southeast1-a \ --machine-type=e2-micro Next, SSH into this VM to perform the necessary configurations. Typically, a Google VM instance will have a Distributor ID of Debian . Use the following command to check this before proceeding with the next steps. lsb_release -a Next, set the password for the root account as follows: sudo passwd Next, use t...

Using Terraform to Create VM Instances and Connect via SSH

Image
Introduction In the previous article, I introduced some basic concepts about Terraform , as well as the advantages of using Terraform . If you're not familiar with it yet, take a look to get some basic knowledge before diving into the next topics . In this article, I will guide you through writing Terraform files to deploy a Virtual Machine (VM) instance to the Google Cloud Provider . Creating a Service Account If you already have a Google Cloud account with the necessary permissions, you can log in to work with Terraform as I instructed in the previous article. However, if for some reason you can't log in, or if you need a better authentication method, you can create a Service Account to use. In simple terms, a Google Cloud account is allowed to create Service Accounts . Each Service Account is assigned roles , and each role has corresponding permissions allowing the Service Account to perform specific tasks based on permissions . To create a Service Account , use th...