google-cloud-platformgoogle-compute-enginefirewallgoogle-vpc

GCP VM SSH - port timed out


I have created a GCP compute engine on default vpc, allowing all ports. In the IP range, I have mentioned the external IP address of the compute engine. I was able to ssh to the host via cloudshell gcloud.

Later after 2 days, I was unable to SSH to the host and running into an error - "We are unable to connect to the VM on port 22". So I created a new firewall rule as per the doc https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-ssh-errors and was able to ssh to host successfully.

gcloud compute firewall-rules create firewall_name --allow tcp:22

Question: The initial firewall already has 'Protocols and ports' as 'all' (pls see the above image). Then why I was unable to ssh until I created another firewall rule with explicit mention of port 22?

Update: removed the screenshot per comment. I'm trying to connect from my mac laptop (chrome), connecting to GCP console, ssh via cloud shell (also tried ssh via web option).


Solution

  • turns out, devops admin has revoked gcloud ssh access to everyone citing - gcloud shell gets a seperate IP which is outside of IAP so please use your local terminal or just click on ssh through webconsole