Denis Petrenko
Denis Petrenko

Reputation: 1

Cannot ssh into GCP instance

I cannot ssh into Google compute engine instance. Here is scenario.

Is there any solution to address this problem?

Thanks in advance.

Upvotes: 0

Views: 1710

Answers (3)

Muhammad Saad
Muhammad Saad

Reputation: 57

A complete tutorial is linked: https://youtu.be/HSBTnfDsVRs

In this video, I talked about how to SSH into GCP using Windows Terminal. There are three methods to do so:

Access via Chrome Access via Command Prompt Access via a custom Windows Terminal tab (best!!) Process for Chrome:

Open Google Chrome Type "https://console.cloud.google.com/" And you can access it!! Process for Installing Google Cloud SDK:

Install Google Cloud SDK (https://cloud.google.com/sdk/docs/downloads-interactive) Click "Next" Click "I Agree" It's installed!! Process for Command Prompt (via PuTTy):

Open Windows Terminal Then, open Command Prompt Type "gcloud cloud-shell ssh" And you can access it!! Process for a custom Windows Terminal tab:

Open Windows Terminal

Go to Settings and click "Open JSON file"

Then add the following:

{ 
   "backgroundImage": "C:/Users/user/Downloads/Pictures/gcp.png",   
   "backgroundImageOpacity": 0.2, 
   "commandline": "wsl ~/ssh-gcloud-env.sh [email] [project_id]",
   "hidden": false, 
   "icon": "C:/Users/user/Downloads/Pictures/gcp.png", 
   "name": "SSH into GCP" 
 },

Then, open your wsl2 Ubuntu VM, and in your /home/user/ directory make a file named "ssh-gcloud-env.sh". And type in the following commands:

gcloud auth login $1 
gcloud config set project $2 
gcloud cloud-shell ssh 

Save the file and type the following: "chmod +x ssh-gcloud-env.sh"

Finally, go to your Windows Terminal and open the custom tab.

Yay! We did it

Upvotes: 0

PIERPAOLO MASELLA
PIERPAOLO MASELLA

Reputation: 134

I faced the same problem during these days, and I solved it using winSCP to access the storage and delete a lot of heavy files created by my scripts, also because the the instructions here have been not so useful. If you do not know how to configure winSCP and GCP, follow my steps or this video.

winSCP - Create Keys

While creating a new site in winSCP

  • go to advanced --> ssh --> Authentication
  • click on Tools and open the Putty gen
  • generate public and private key
  • save them

copy the public key and open GCP

Setting your GCP instance

Click on your instance to edit its settings

  • scroll down until you reach ssh keys enter image description here
  • paste your key
  • save

Done, now you can access your instance storage and remove some files; after that, your instance will be able to boot correctly creating the temporary files needed.

Upvotes: 1

Asif Tanwir
Asif Tanwir

Reputation: 119

As Dan mentioned, you need to connect on serial console to expand the filesystem making use of the additional disk space allocated. You can also attempt to free up some space etc.

Upvotes: 0

Related Questions