Reputation: 112
I use the GCP browser ssh to host my python file. After a week or so, the ssh of the VM Instance stops and when I try to connect to it, first it shows
Connection via Cloud Identity-Aware Proxy Failed
Code: 4003
Reason: failed to connect to backend
You may be able to connect without using the Cloud Identity-Aware Proxy.
when I try to connect without using the Cloud Identity-Aware Proxy it gives me this error
Connection Failed
We are unable to connect to the VM on port 22. Learn more about possible causes of this issue.
I don't think I changed those settings that cause this.
EDIT 1
I found out its a firewall issue. I made a firewall rule that did allow to connect to port 22 but it still gave the same error.
EDIT 2
A day after I made the firewall rule, now, the Instance started working again. I was able to access the SSH.
Upvotes: 0
Views: 621
Reputation: 2448
Regarding the problem with your SSH, the error code 4003, this error could have many explanations:
If your instance is running well,we could check points 1 and 2 using a port scanner, we could check tough port 22 for ssh if it is reachable. If it is not in green it means that it could be a problem in the firewall or with the SSH service.
If you have problems with your firewall, please check this documentation to create the proper rules.
If the problem is with your metadata it could be necessary to Install the guest environment in-place, you could validate if the guest environment is working by inspecting system logs emitted to the console while an instance starts up, please check this document of Validating the guest environment for more information.
You should see something like Started Google Compute Engine Startup Scripts. if your metadata is working properly (I test it in Ubuntu).
Since you are not able to connect to the instance via SSH button, you have to enable the serial console of this vm instance to get into the command line of the vm instance.
Please try to create a startup-script to create a user and password and with this login in the VM from serial ports, the script would be like this:
#! /bin/bash
useradd -G sudo <user>
echo '<user>:<password>' | chpasswd
If your metadata is not working properly, you should to install the guest environment in your VM:
sudo apt-add-repository universe
sudo apt update
sudo apt install -y gce-compute-image-packages
Make sure you have an external IP or that you are following one of the options described here.
If your problem is related with CPU usage or your VM Instance is running out of memory, please consider changing the machine type.
Changing a machine type
1.- Go to the VM Instances page.
2.- In the Name column, click your instance.
From the instance details page, complete the following steps:
a) Click the Stop button to stop the instance, if you have not stopped it yet.
b) After the instance stops, click the Edit button at the top of the page.
c) Under the Machine configuration section, select the machine type you want to use, or create a custom machine type to increase only the Memory.
d) Save your changes and start again your VM Instance.
Upvotes: 2