فاينفرفاينفر
EN
ديفوبس 2 min read

Connect Your Google Cloud VM on Your Terminal

Asha Vardhan

Asha Vardhan

April 9, 2026

Hello folks,

I wanted to share a quick tip with you all. I've noticed many of you are connecting to Google Cloud VM SSH through the browser, which can be a real-time-suck.

Did you know you can connect directly from your computer's terminal? It's super easy and takes less than 2 minutes!

Here's how:

Step 1: Create Key pair

First, create a private and public key pair on your computer. To do this, open your terminal and run:

Or, for more customization:

ssh-keygen -t rsa -b 2048 -f ./key-name -C "your_email@example.com"

it will ask you to enter a passcord. you can just enter if you don't want to add it. replace key-name with any name you want.

it will create 2 files. for my example the files are as follows,

key-name -> Private key

key-name.pub -> Public Key

Works on Windows, Ubuntu, Linux, and Mac OS!

Step 2: Add Public key to Google Cloud VM meta

Now that we have our private and public key pair, let's add the public key to your Google Cloud VM metadata.

In order to do that.

  1. Login to Google Cloud

  2. Navigate to Compute Engine

  3. Click on 'Metadata' under Settings

  4. Select the 'SSH Keys' tab

Then Click the Edit link from the top nav menu as see you In the following image

Then you will see an option to ADD ITEM, an input field will show up when you click the button. copy and paste the content of the key-name.pub file. and Press SAVE

Step 3: Connect to your VM using SSH

You are almost done now. just connect the VM to your terminal

Open Command prompt/PowerShell/Terminal as per your OS and run this command

ssh -i <path-to-your-private-key-dir>/key-name username@<server-public-ip>

it may ask you to enter the code which you are using on key creation.

Done 🎉. you can connect to the VM successfully

If you are geting any error related to the file permission.

You can just run sudo chmode 600 <path-to-your-private-key-dir>/key-name

Conclusion

Now you can to connect Google Cloud VM using SSH on your machine. I hope this helps you.

Related Articles

More insights from our engineering team

إذا كنت تدير نشاطًا تجاريًا صغيرًا؟ هذه الأداة الذكية قد تجعل حياتك أسهل.
عمل
May 18, 2026

إذا كنت تدير نشاطًا تجاريًا صغيرًا؟ هذه الأداة الذكية قد تجعل حياتك أسهل.

إدارة مشروع صغير تعني القيام بكل شيء في نفس الوقت — متابعة الفواتير، الرد على العملاء، إدارة الرواتب، التسويق، ومحاولة إيجاد وقت لتطوير العمل.

Understanding .env in Node.js
ديفوبس
May 17, 2026

Understanding .env in Node.js

When building a Node.js app, you’ll often see a file called .env. At first, it may look confusing, but it’s actually one of the most important parts of managing your application properly.

SEO vs GEO vs AEO - What’s the Difference?
تطوير الويب
May 12, 2026

SEO vs GEO vs AEO - What’s the Difference?

إذا كنت تدير موقعًا تجاريًا اليوم، فمن المحتمل أنك سمعت مصطلحات مثل تحسين محركات البحث (SEO)، وتحسين المحركات التوليدية (GEO)، وتحسين المحركات الإجابية (AEO) في كل مكان.